diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-05-11 21:10:11 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-11 20:52:40 +0000 |
commit | 2d6b08bd17377aa6bcb663029a196a8d19cac6ac (patch) | |
tree | 4bce8e27455c38b919a5a1706c6bb5b8b7f8813a /src/qml/jit | |
parent | bde97ab6a72acafaa29d2da0f7a31ae23918a6b0 (diff) |
Give for loops a per-iteration context as well
Regular for loops also have a per iteration context for lexically
declared variables as well.
Change-Id: I35cb58bfb198c7dc32d70f41ea0ced7ddefcc37e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jit')
-rw-r--r-- | src/qml/jit/qv4jit.cpp | 16 | ||||
-rw-r--r-- | src/qml/jit/qv4jit_p.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/qml/jit/qv4jit.cpp b/src/qml/jit/qv4jit.cpp index f659ddfb00..4f95232f0d 100644 --- a/src/qml/jit/qv4jit.cpp +++ b/src/qml/jit/qv4jit.cpp @@ -659,6 +659,19 @@ void BaselineJIT::generate_PushBlockContext(int reg, int index) JIT_GENERATE_RUNTIME_CALL(pushBlockContextHelper, Assembler::IgnoreResult); } +static void cloneBlockContextHelper(QV4::Value *contextSlot) +{ + *contextSlot = Runtime::method_cloneBlockContext(static_cast<QV4::ExecutionContext *>(contextSlot)); +} + +void BaselineJIT::generate_CloneBlockContext() +{ + as->saveAccumulatorInFrame(); + as->prepareCallWithArgCount(1); + as->passRegAsArg(CallData::Context, 0); + JIT_GENERATE_RUNTIME_CALL(cloneBlockContextHelper, Assembler::IgnoreResult); +} + static void pushScriptContextHelper(QV4::Value *stack, ExecutionEngine *engine, int index) { stack[CallData::Context] = Runtime::method_createScriptContext(engine, index); @@ -1236,6 +1249,9 @@ void BaselineJIT::collectLabelsInBytecode() MOTH_BEGIN_INSTR(PushBlockContext) MOTH_END_INSTR(PushBlockContext) + MOTH_BEGIN_INSTR(CloneBlockContext) + MOTH_END_INSTR(CloneBlockContext) + MOTH_BEGIN_INSTR(PushScriptContext) MOTH_END_INSTR(PushScriptContext) diff --git a/src/qml/jit/qv4jit_p.h b/src/qml/jit/qv4jit_p.h index 97dd2ef2a5..333cf05f09 100644 --- a/src/qml/jit/qv4jit_p.h +++ b/src/qml/jit/qv4jit_p.h @@ -181,6 +181,7 @@ public: void generate_PushCatchContext(int reg, int index, int name) override; void generate_PushWithContext(int reg) override; void generate_PushBlockContext(int reg, int index) override; + void generate_CloneBlockContext() override; void generate_PushScriptContext(int index) override; void generate_PopScriptContext() override; void generate_PopContext(int reg) override; |