diff options
Diffstat (limited to 'src/qml/jit')
-rw-r--r-- | src/qml/jit/qv4baselinejit.cpp | 11 | ||||
-rw-r--r-- | src/qml/jit/qv4baselinejit_p.h | 1 | ||||
-rw-r--r-- | src/qml/jit/qv4jithelpers.cpp | 6 | ||||
-rw-r--r-- | src/qml/jit/qv4jithelpers_p.h | 1 |
4 files changed, 19 insertions, 0 deletions
diff --git a/src/qml/jit/qv4baselinejit.cpp b/src/qml/jit/qv4baselinejit.cpp index d0ac169e4f..baaab75158 100644 --- a/src/qml/jit/qv4baselinejit.cpp +++ b/src/qml/jit/qv4baselinejit.cpp @@ -956,6 +956,17 @@ void BaselineJIT::generate_InitializeBlockDeadTemporalZone(int firstReg, int cou as->storeReg(i); } +void BaselineJIT::generate_ThrowOnNullOrUndefined() +{ + STORE_ACC(); + as->prepareCallWithArgCount(2); + as->passAccumulatorAsArg(1); + as->passEngineAsArg(0); + BASELINEJIT_GENERATE_RUNTIME_CALL(Helpers::throwOnNullOrUndefined, CallResultDestination::Ignore); + as->checkException(); +} + + void BaselineJIT::startInstruction(Instr::Type /*instr*/) { if (hasLabel()) diff --git a/src/qml/jit/qv4baselinejit_p.h b/src/qml/jit/qv4baselinejit_p.h index 7e3fcfa5e6..f9c876a1e9 100644 --- a/src/qml/jit/qv4baselinejit_p.h +++ b/src/qml/jit/qv4baselinejit_p.h @@ -211,6 +211,7 @@ public: void generate_LoadQmlContext(int result) override; void generate_LoadQmlImportedScripts(int result) override; void generate_InitializeBlockDeadTemporalZone(int firstReg, int count) override; + void generate_ThrowOnNullOrUndefined() override; void startInstruction(Moth::Instr::Type instr) override; void endInstruction(Moth::Instr::Type instr) override; diff --git a/src/qml/jit/qv4jithelpers.cpp b/src/qml/jit/qv4jithelpers.cpp index 7bac5d968d..427356e5ed 100644 --- a/src/qml/jit/qv4jithelpers.cpp +++ b/src/qml/jit/qv4jithelpers.cpp @@ -146,6 +146,12 @@ ReturnedValue deleteName(Function *function, int name) } } +void throwOnNullOrUndefined(ExecutionEngine *engine, const Value &v) +{ + if (v.isNullOrUndefined()) + engine->throwTypeError(); +} + } // Helpers namespace } // JIT namespace } // QV4 namespace diff --git a/src/qml/jit/qv4jithelpers_p.h b/src/qml/jit/qv4jithelpers_p.h index bb10d5722b..dd68452e7f 100644 --- a/src/qml/jit/qv4jithelpers_p.h +++ b/src/qml/jit/qv4jithelpers_p.h @@ -76,6 +76,7 @@ void pushScriptContext(Value *stack, ExecutionEngine *engine, int index); void popScriptContext(Value *stack, ExecutionEngine *engine); ReturnedValue deleteProperty(QV4::Function *function, const QV4::Value &base, const QV4::Value &index); ReturnedValue deleteName(Function *function, int name); +void throwOnNullOrUndefined(ExecutionEngine *engine, const Value &v); } // Helpers namespace } // JIT namespace |