Title: [176109] trunk/Source/_javascript_Core
Revision
176109
Author
msab...@apple.com
Date
2014-11-13 17:07:48 -0800 (Thu, 13 Nov 2014)

Log Message

Add scope operand to op_new_func* byte codes
https://bugs.webkit.org/show_bug.cgi?id=138707

Reviewed by Mark Lam.

Added scope operand to op_new_func and op_new_func_expr to replace the implicit use
of exec->scope().

* bytecode/BytecodeList.json: Increased size of op_new_func & op_new_func_expr bytecodes.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode): Added scope operand to dump output.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitNewFunctionInternal):
(JSC::BytecodeGenerator::emitNewFunctionExpression):
Emit scope operand.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
Added new scope source nodes to NewFunction, NewFunctionExpression & NewFunctionNoCheck.
        
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileNewFunctionNoCheck):
(JSC::DFG::SpeculativeJIT::compileNewFunctionExpression):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
Use scope children when making new function JIT_Operation calls.  Use JSScope* value instead of
exec->scope().

* dfg/DFGOperations.h:
* dfg/DFGOperations.cpp:
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* jit/JIT.h:
* jit/JITInlines.h:
(JSC::JIT::callOperation):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_new_func):
(JSC::JIT::emit_op_new_func_exp):
* jit/JITOperations.cpp:
* jit/JITOperations.h:
Added new Jsc JIT_Operation parameter type for JSScope* values.  Created declarations and
definitions for new JIT_Operations with Jsc parameters.  Use the JSScope* parameters in lieu
of exec->scope() in operationNewFunction().
Removed comment for unused Jsa (JSLexicalEnvironment*) JIT_Operation parameter type.

* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
Use the scope operand instead of exec->scope().

* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
Changed the operand indecies for added scope operand.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (176108 => 176109)


--- trunk/Source/_javascript_Core/ChangeLog	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-11-14 01:07:48 UTC (rev 176109)
@@ -1,3 +1,65 @@
+2014-11-13  Michael Saboff  <msab...@apple.com>
+
+        Add scope operand to op_new_func* byte codes
+        https://bugs.webkit.org/show_bug.cgi?id=138707
+
+        Reviewed by Mark Lam.
+
+        Added scope operand to op_new_func and op_new_func_expr to replace the implicit use
+        of exec->scope().
+
+        * bytecode/BytecodeList.json: Increased size of op_new_func & op_new_func_expr bytecodes.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::dumpBytecode): Added scope operand to dump output.
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::emitNewFunctionInternal):
+        (JSC::BytecodeGenerator::emitNewFunctionExpression):
+        Emit scope operand.
+
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::parseBlock):
+        * dfg/DFGFixupPhase.cpp:
+        (JSC::DFG::FixupPhase::fixupNode):
+        Added new scope source nodes to NewFunction, NewFunctionExpression & NewFunctionNoCheck.
+        
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compileNewFunctionNoCheck):
+        (JSC::DFG::SpeculativeJIT::compileNewFunctionExpression):
+        * dfg/DFGSpeculativeJIT32_64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        Use scope children when making new function JIT_Operation calls.  Use JSScope* value instead of
+        exec->scope().
+
+        * dfg/DFGOperations.h:
+        * dfg/DFGOperations.cpp:
+        * dfg/DFGSpeculativeJIT.h:
+        (JSC::DFG::SpeculativeJIT::callOperation):
+        * jit/JIT.h:
+        * jit/JITInlines.h:
+        (JSC::JIT::callOperation):
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::emit_op_new_func):
+        (JSC::JIT::emit_op_new_func_exp):
+        * jit/JITOperations.cpp:
+        * jit/JITOperations.h:
+        Added new Jsc JIT_Operation parameter type for JSScope* values.  Created declarations and
+        definitions for new JIT_Operations with Jsc parameters.  Use the JSScope* parameters in lieu
+        of exec->scope() in operationNewFunction().
+        Removed comment for unused Jsa (JSLexicalEnvironment*) JIT_Operation parameter type.
+
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+        Use the scope operand instead of exec->scope().
+
+        * llint/LowLevelInterpreter.asm:
+        * llint/LowLevelInterpreter32_64.asm:
+        * llint/LowLevelInterpreter64.asm:
+        Changed the operand indecies for added scope operand.
+
 2014-11-13  Mark Lam  <mark....@apple.com>
 
         Change X86/64 JIT probes to save/restore xmm regs as double instead of __m128. [Follow up]

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeList.json (176108 => 176109)


--- trunk/Source/_javascript_Core/bytecode/BytecodeList.json	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeList.json	2014-11-14 01:07:48 UTC (rev 176109)
@@ -93,8 +93,8 @@
             { "name" : "op_switch_imm", "length" : 4 },
             { "name" : "op_switch_char", "length" : 4 },
             { "name" : "op_switch_string", "length" : 4 },
-            { "name" : "op_new_func", "length" : 4 },
-            { "name" : "op_new_func_exp", "length" : 3 },
+            { "name" : "op_new_func", "length" : 5 },
+            { "name" : "op_new_func_exp", "length" : 4 },
             { "name" : "op_call", "length" : 9 },
             { "name" : "op_call_eval", "length" : 9 },
             { "name" : "op_call_varargs", "length" : 9 },

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (176108 => 176109)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2014-11-14 01:07:48 UTC (rev 176109)
@@ -1271,17 +1271,19 @@
         }
         case op_new_func: {
             int r0 = (++it)->u.operand;
+            int r1 = (++it)->u.operand;
             int f0 = (++it)->u.operand;
             int shouldCheck = (++it)->u.operand;
             printLocationAndOp(out, exec, location, it, "new_func");
-            out.printf("%s, f%d, %s", registerName(r0).data(), f0, shouldCheck ? "<Checked>" : "<Unchecked>");
+            out.printf("%s, %s, f%d, %s", registerName(r0).data(), registerName(r1).data(), f0, shouldCheck ? "<Checked>" : "<Unchecked>");
             break;
         }
         case op_new_func_exp: {
             int r0 = (++it)->u.operand;
+            int r1 = (++it)->u.operand;
             int f0 = (++it)->u.operand;
             printLocationAndOp(out, exec, location, it, "new_func_exp");
-            out.printf("%s, f%d", registerName(r0).data(), f0);
+            out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);
             break;
         }
         case op_call: {

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (176108 => 176109)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2014-11-14 01:07:48 UTC (rev 176109)
@@ -1715,6 +1715,7 @@
 {
     emitOpcode(op_new_func);
     instructions().append(dst->index());
+    instructions().append(scopeRegister()->index());
     instructions().append(index);
     instructions().append(doNullCheck);
     return dst;
@@ -1735,6 +1736,7 @@
 
     emitOpcode(op_new_func_exp);
     instructions().append(r0->index());
+    instructions().append(scopeRegister()->index());
     instructions().append(index);
     return r0;
 }

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (176108 => 176109)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2014-11-14 01:07:48 UTC (rev 176109)
@@ -3433,22 +3433,22 @@
         }
             
         case op_new_func: {
-            if (!currentInstruction[3].u.operand) {
+            if (!currentInstruction[4].u.operand) {
                 set(VirtualRegister(currentInstruction[1].u.operand),
-                    addToGraph(NewFunctionNoCheck, OpInfo(currentInstruction[2].u.operand)));
+                    addToGraph(NewFunctionNoCheck, OpInfo(currentInstruction[3].u.operand), get(VirtualRegister(currentInstruction[2].u.operand))));
             } else {
                 set(VirtualRegister(currentInstruction[1].u.operand),
                     addToGraph(
                         NewFunction,
-                        OpInfo(currentInstruction[2].u.operand),
-                        get(VirtualRegister(currentInstruction[1].u.operand))));
+                        OpInfo(currentInstruction[3].u.operand),
+                        get(VirtualRegister(currentInstruction[1].u.operand)), get(VirtualRegister(currentInstruction[2].u.operand))));
             }
             NEXT_OPCODE(op_new_func);
         }
 
         case op_new_func_exp: {
             set(VirtualRegister(currentInstruction[1].u.operand),
-                addToGraph(NewFunctionExpression, OpInfo(currentInstruction[2].u.operand)));
+                addToGraph(NewFunctionExpression, OpInfo(currentInstruction[3].u.operand), get(VirtualRegister(currentInstruction[2].u.operand))));
             NEXT_OPCODE(op_new_func_exp);
         }
 

Modified: trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp (176108 => 176109)


--- trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp	2014-11-14 01:07:48 UTC (rev 176109)
@@ -1172,6 +1172,16 @@
 
             break;
         }
+        case NewFunction: {
+            fixEdge<CellUse>(node->child2());
+            break;
+        }
+
+        case NewFunctionNoCheck:
+        case NewFunctionExpression: {
+            fixEdge<CellUse>(node->child1());
+            break;
+        }
             
 #if !ASSERT_DISABLED
         // Have these no-op cases here to ensure that nobody forgets to add handlers for new opcodes.
@@ -1213,9 +1223,6 @@
         case GetMyArgumentsLength:
         case GetMyArgumentsLengthSafe:
         case CheckArgumentsNotCreated:
-        case NewFunction:
-        case NewFunctionNoCheck:
-        case NewFunctionExpression:
         case Jump:
         case Return:
         case Throw:

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (176108 => 176109)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2014-11-14 01:07:48 UTC (rev 176109)
@@ -820,12 +820,12 @@
     return JSValue::encode(argumentsValue.get(exec, index));
 }
 
-JSCell* JIT_OPERATION operationNewFunctionNoCheck(ExecState* exec, JSCell* functionExecutable)
+JSCell* JIT_OPERATION operationNewFunctionNoCheck(ExecState* exec, JSScope* scope, JSCell* functionExecutable)
 {
     ASSERT(functionExecutable->inherits(FunctionExecutable::info()));
     VM& vm = exec->vm();
     NativeCallFrameTracer tracer(&vm, exec);
-    return JSFunction::create(vm, static_cast<FunctionExecutable*>(functionExecutable), exec->scope());
+    return JSFunction::create(vm, static_cast<FunctionExecutable*>(functionExecutable), scope);
 }
 
 size_t JIT_OPERATION operationIsObject(ExecState* exec, EncodedJSValue value)

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.h (176108 => 176109)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.h	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.h	2014-11-14 01:07:48 UTC (rev 176109)
@@ -101,7 +101,7 @@
 void JIT_OPERATION operationTearOffInlinedArguments(ExecState*, JSCell*, JSCell*, InlineCallFrame*) WTF_INTERNAL;
 EncodedJSValue JIT_OPERATION operationGetInlinedArgumentByVal(ExecState*, int32_t, InlineCallFrame*, int32_t) WTF_INTERNAL;
 EncodedJSValue JIT_OPERATION operationGetArgumentByVal(ExecState*, int32_t, int32_t) WTF_INTERNAL;
-JSCell* JIT_OPERATION operationNewFunctionNoCheck(ExecState*, JSCell*) WTF_INTERNAL;
+JSCell* JIT_OPERATION operationNewFunctionNoCheck(ExecState*, JSScope*, JSCell*) WTF_INTERNAL;
 double JIT_OPERATION operationFModOnInts(int32_t, int32_t) WTF_INTERNAL;
 size_t JIT_OPERATION operationIsObject(ExecState*, EncodedJSValue) WTF_INTERNAL;
 size_t JIT_OPERATION operationIsFunction(EncodedJSValue) WTF_INTERNAL;

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (176108 => 176109)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2014-11-14 01:07:48 UTC (rev 176109)
@@ -4159,9 +4159,11 @@
 {
     GPRFlushedCallResult result(this);
     GPRReg resultGPR = result.gpr();
+    SpeculateCellOperand scope(this, node->child1());
+    GPRReg scopeGPR = scope.gpr();
     flushRegisters();
     callOperation(
-        operationNewFunctionNoCheck, resultGPR, m_jit.codeBlock()->functionDecl(node->functionDeclIndex()));
+        operationNewFunctionNoCheck, resultGPR, scopeGPR, m_jit.codeBlock()->functionDecl(node->functionDeclIndex()));
     cellResult(resultGPR, node);
 }
 
@@ -4169,10 +4171,12 @@
 {
     GPRFlushedCallResult result(this);
     GPRReg resultGPR = result.gpr();
+    SpeculateCellOperand scope(this, node->child1());
+    GPRReg scopeGPR = scope.gpr();
     flushRegisters();
     callOperation(
         operationNewFunctionNoCheck,
-        resultGPR,
+        resultGPR, scopeGPR, 
         m_jit.codeBlock()->functionExpr(node->functionExprIndex()));
     cellResult(resultGPR, node);
 }

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h (176108 => 176109)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2014-11-14 01:07:48 UTC (rev 176109)
@@ -1049,7 +1049,7 @@
         m_jit.setupArgumentsWithExecState(arg1, arg2, arg3);
         return appendCallWithExceptionCheckSetResult(operation, result);
     }
-    JITCompiler::Call callOperation(C_JITOperation_ECC operation, GPRReg result, GPRReg arg1, JSCell* cell)
+    JITCompiler::Call callOperation(C_JITOperation_EJscC operation, GPRReg result, GPRReg arg1, JSCell* cell)
     {
         m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell));
         return appendCallWithExceptionCheckSetResult(operation, result);
@@ -1288,6 +1288,11 @@
         m_jit.setupArgumentsWithExecState(arg1, arg2);
         return appendCallWithExceptionCheckSetResult(operation, result);
     }
+    JITCompiler::Call callOperation(J_JITOperation_EJscC operation, GPRReg result, GPRReg arg1, JSCell* cell)
+    {
+        m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell));
+        return appendCallWithExceptionCheckSetResult(operation, result);
+    }
     JITCompiler::Call callOperation(J_JITOperation_ESsiCI operation, GPRReg result, StructureStubInfo* stubInfo, GPRReg arg1, const StringImpl* uid)
     {
         m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, TrustedImmPtr(uid));
@@ -1595,6 +1600,11 @@
         m_jit.setupArgumentsWithExecState(arg1, arg2);
         return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag);
     }
+    JITCompiler::Call callOperation(J_JITOperation_EJscC operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, JSCell* cell)
+    {
+        m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(cell));
+        return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag);
+    }
     JITCompiler::Call callOperation(J_JITOperation_ESsiCI operation, GPRReg resultTag, GPRReg resultPayload, StructureStubInfo* stubInfo, GPRReg arg1, const StringImpl* uid)
     {
         m_jit.setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, TrustedImmPtr(uid));

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp (176108 => 176109)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2014-11-14 01:07:48 UTC (rev 176109)
@@ -4516,7 +4516,9 @@
         GPRReg valuePayloadGPR = value.payloadGPR();
         GPRReg resultTagGPR = resultTag.gpr();
         GPRReg resultPayloadGPR = resultPayload.gpr();
-        
+        SpeculateCellOperand scope(this, node->child2());
+        GPRReg scopeGPR = scope.gpr();
+
         m_jit.move(valuePayloadGPR, resultPayloadGPR);
         m_jit.move(valueTagGPR, resultTagGPR);
         
@@ -4524,7 +4526,7 @@
         
         addSlowPathGenerator(
             slowPathCall(
-                notCreated, this, operationNewFunction, JSValueRegs(resultTagGPR, resultPayloadGPR),
+                notCreated, this, operationNewFunction, JSValueRegs(resultTagGPR, resultPayloadGPR), scopeGPR,
                 m_jit.codeBlock()->functionDecl(node->functionDeclIndex())));
         
         jsValueResult(resultTagGPR, resultPayloadGPR, node);

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (176108 => 176109)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2014-11-14 01:07:48 UTC (rev 176109)
@@ -4546,6 +4546,8 @@
     case NewFunction: {
         JSValueOperand value(this, node->child1());
         GPRTemporary result(this, Reuse, value);
+        SpeculateCellOperand scope(this, node->child2());
+        GPRReg scopeGPR = scope.gpr();
         
         GPRReg valueGPR = value.gpr();
         GPRReg resultGPR = result.gpr();
@@ -4557,7 +4559,7 @@
         addSlowPathGenerator(
             slowPathCall(
                 notCreated, this, operationNewFunction,
-                resultGPR, m_jit.codeBlock()->functionDecl(node->functionDeclIndex())));
+                resultGPR, scopeGPR, m_jit.codeBlock()->functionDecl(node->functionDeclIndex())));
         
         jsValueResult(resultGPR, node);
         break;

Modified: trunk/Source/_javascript_Core/jit/JIT.h (176108 => 176109)


--- trunk/Source/_javascript_Core/jit/JIT.h	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2014-11-14 01:07:48 UTC (rev 176109)
@@ -697,6 +697,7 @@
 #endif
         MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, const Identifier*);
         MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg);
+        MacroAssembler::Call callOperation(J_JITOperation_EJscC, int, GPRReg, JSCell*);
 #if USE(JSVALUE64)
         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EJJ, int, GPRReg, GPRReg);
 #else

Modified: trunk/Source/_javascript_Core/jit/JITInlines.h (176108 => 176109)


--- trunk/Source/_javascript_Core/jit/JITInlines.h	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h	2014-11-14 01:07:48 UTC (rev 176109)
@@ -258,6 +258,12 @@
     return appendCallWithExceptionCheck(operation);
 }
 
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJscC operation, int dst, GPRReg arg1, JSCell* cell)
+{
+    setupArgumentsWithExecState(arg1, TrustedImmPtr(cell));
+    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
+}
+
 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EP operation, int dst, void* pointer)
 {
     setupArgumentsWithExecState(TrustedImmPtr(pointer));

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (176108 => 176109)


--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2014-11-14 01:07:48 UTC (rev 176109)
@@ -1034,7 +1034,7 @@
 {
     Jump lazyJump;
     int dst = currentInstruction[1].u.operand;
-    if (currentInstruction[3].u.operand) {
+    if (currentInstruction[4].u.operand) {
 #if USE(JSVALUE32_64)
         lazyJump = branch32(NotEqual, tagFor(dst), TrustedImm32(JSValue::EmptyValueTag));
 #else
@@ -1042,18 +1042,28 @@
 #endif
     }
 
-    FunctionExecutable* funcExec = m_codeBlock->functionDecl(currentInstruction[2].u.operand);
-    callOperation(operationNewFunction, dst, funcExec);
+#if USE(JSVALUE64)
+    emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);
+#else
+    emitLoadPayload(currentInstruction[2].u.operand, regT0);
+#endif
+    FunctionExecutable* funcExec = m_codeBlock->functionDecl(currentInstruction[3].u.operand);
+    callOperation(operationNewFunction, dst, regT0, funcExec);
 
-    if (currentInstruction[3].u.operand)
+    if (currentInstruction[4].u.operand)
         lazyJump.link(this);
 }
 
 void JIT::emit_op_new_func_exp(Instruction* currentInstruction)
 {
     int dst = currentInstruction[1].u.operand;
-    FunctionExecutable* funcExpr = m_codeBlock->functionExpr(currentInstruction[2].u.operand);
-    callOperation(operationNewFunction, dst, funcExpr);
+#if USE(JSVALUE64)
+    emitGetVirtualRegister(currentInstruction[2].u.operand, regT0);
+#else
+    emitLoadPayload(currentInstruction[2].u.operand, regT0);
+#endif
+    FunctionExecutable* funcExpr = m_codeBlock->functionExpr(currentInstruction[3].u.operand);
+    callOperation(operationNewFunction, dst, regT0, funcExpr);
 }
 
 void JIT::emit_op_new_array(Instruction* currentInstruction)

Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (176108 => 176109)


--- trunk/Source/_javascript_Core/jit/JITOperations.cpp	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp	2014-11-14 01:07:48 UTC (rev 176109)
@@ -947,12 +947,12 @@
     return JSValue::encode(constructArrayWithSizeQuirk(exec, profile, exec->lexicalGlobalObject(), sizeValue));
 }
 
-EncodedJSValue JIT_OPERATION operationNewFunction(ExecState* exec, JSCell* functionExecutable)
+EncodedJSValue JIT_OPERATION operationNewFunction(ExecState* exec, JSScope* scope, JSCell* functionExecutable)
 {
     ASSERT(functionExecutable->inherits(FunctionExecutable::info()));
     VM& vm = exec->vm();
     NativeCallFrameTracer tracer(&vm, exec);
-    return JSValue::encode(JSFunction::create(vm, static_cast<FunctionExecutable*>(functionExecutable), exec->scope()));
+    return JSValue::encode(JSFunction::create(vm, static_cast<FunctionExecutable*>(functionExecutable), scope));
 }
 
 JSCell* JIT_OPERATION operationNewObject(ExecState* exec, Structure* structure)

Modified: trunk/Source/_javascript_Core/jit/JITOperations.h (176108 => 176109)


--- trunk/Source/_javascript_Core/jit/JITOperations.h	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/jit/JITOperations.h	2014-11-14 01:07:48 UTC (rev 176109)
@@ -69,7 +69,7 @@
     Idc: const Identifier*
     J: EncodedJSValue
     Jcp: const JSValue*
-    Jsa: JSLexicalEnvironment*
+    Jsc: JSScope*
     Jss: JSString*
     O: JSObject*
     P: pointer (char*)
@@ -113,6 +113,7 @@
 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPP)(ExecState*, void*, void*);
 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPS)(ExecState*, void*, size_t);
 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPc)(ExecState*, Instruction*);
+typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJscC)(ExecState*, JSScope*, JSCell*);
 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_ESS)(ExecState*, size_t, size_t);
 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_ESsiCI)(ExecState*, StructureStubInfo*, JSCell*, StringImpl*);
 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_ESsiJI)(ExecState*, StructureStubInfo*, EncodedJSValue, StringImpl*);
@@ -127,6 +128,7 @@
 typedef JSCell* JIT_OPERATION (*C_JITOperation_ECC)(ExecState*, JSCell*, JSCell*);
 typedef JSCell* JIT_OPERATION (*C_JITOperation_EIcf)(ExecState*, InlineCallFrame*);
 typedef JSCell* JIT_OPERATION (*C_JITOperation_EJ)(ExecState*, EncodedJSValue);
+typedef JSCell* JIT_OPERATION (*C_JITOperation_EJscC)(ExecState*, JSScope*, JSCell*);
 typedef JSCell* JIT_OPERATION (*C_JITOperation_EJZ)(ExecState*, EncodedJSValue, int32_t);
 typedef JSCell* JIT_OPERATION (*C_JITOperation_EJZC)(ExecState*, EncodedJSValue, int32_t, JSCell*);
 typedef JSCell* JIT_OPERATION (*C_JITOperation_EJJC)(ExecState*, EncodedJSValue, EncodedJSValue, JSCell*);
@@ -266,7 +268,7 @@
 EncodedJSValue JIT_OPERATION operationNewArrayWithProfile(ExecState*, ArrayAllocationProfile*, const JSValue* values, int32_t size) WTF_INTERNAL;
 EncodedJSValue JIT_OPERATION operationNewArrayBufferWithProfile(ExecState*, ArrayAllocationProfile*, const JSValue* values, int32_t size) WTF_INTERNAL;
 EncodedJSValue JIT_OPERATION operationNewArrayWithSizeAndProfile(ExecState*, ArrayAllocationProfile*, EncodedJSValue size) WTF_INTERNAL;
-EncodedJSValue JIT_OPERATION operationNewFunction(ExecState*, JSCell*) WTF_INTERNAL;
+EncodedJSValue JIT_OPERATION operationNewFunction(ExecState*, JSScope*, JSCell*) WTF_INTERNAL;
 JSCell* JIT_OPERATION operationNewObject(ExecState*, Structure*) WTF_INTERNAL;
 EncodedJSValue JIT_OPERATION operationNewRegexp(ExecState*, void*) WTF_INTERNAL;
 void JIT_OPERATION operationHandleWatchdogTimer(ExecState*) WTF_INTERNAL;

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (176108 => 176109)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2014-11-14 01:07:48 UTC (rev 176109)
@@ -1001,18 +1001,20 @@
     LLINT_BEGIN();
     CodeBlock* codeBlock = exec->codeBlock();
     ASSERT(codeBlock->codeType() != FunctionCode || !codeBlock->needsActivation() || exec->hasActivation());
+    JSScope* scope = exec->uncheckedR(pc[2].u.operand).Register::scope();
 #if LLINT_SLOW_PATH_TRACING
     dataLogF("Creating function!\n");
 #endif
-    LLINT_RETURN(JSFunction::create(vm, codeBlock->functionDecl(pc[2].u.operand), exec->scope()));
+    LLINT_RETURN(JSFunction::create(vm, codeBlock->functionDecl(pc[3].u.operand), scope));
 }
 
 LLINT_SLOW_PATH_DECL(slow_path_new_func_exp)
 {
     LLINT_BEGIN();
     CodeBlock* codeBlock = exec->codeBlock();
-    FunctionExecutable* function = codeBlock->functionExpr(pc[2].u.operand);
-    JSFunction* func = JSFunction::create(vm, function, exec->scope());
+    JSScope* scope = exec->uncheckedR(pc[2].u.operand).Register::scope();
+    FunctionExecutable* function = codeBlock->functionExpr(pc[3].u.operand);
+    JSFunction* func = JSFunction::create(vm, function, scope);
     
     LLINT_RETURN(func);
 }

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (176108 => 176109)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2014-11-14 01:07:48 UTC (rev 176109)
@@ -1132,7 +1132,7 @@
 _llint_op_new_func_exp:
     traceExecution()
     callSlowPath(_llint_slow_path_new_func_exp)
-    dispatch(3)
+    dispatch(4)
 
 
 _llint_op_call:

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (176108 => 176109)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2014-11-14 01:07:48 UTC (rev 176109)
@@ -1911,13 +1911,13 @@
 
 _llint_op_new_func:
     traceExecution()
-    btiz 12[PC], .opNewFuncUnchecked
+    btiz 16[PC], .opNewFuncUnchecked
     loadi 4[PC], t1
     bineq TagOffset[cfr, t1, 8], EmptyValueTag, .opNewFuncDone
 .opNewFuncUnchecked:
     callSlowPath(_llint_slow_path_new_func)
 .opNewFuncDone:
-    dispatch(4)
+    dispatch(5)
 
 macro arrayProfileForCall()
     loadi 16[PC], t3

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (176108 => 176109)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2014-11-14 00:46:53 UTC (rev 176108)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2014-11-14 01:07:48 UTC (rev 176109)
@@ -1769,14 +1769,14 @@
 
 _llint_op_new_func:
     traceExecution()
-    loadisFromInstruction(3, t2)
+    loadisFromInstruction(4, t2)
     btiz t2, .opNewFuncUnchecked
     loadisFromInstruction(1, t1)
     btqnz [cfr, t1, 8], .opNewFuncDone
 .opNewFuncUnchecked:
     callSlowPath(_llint_slow_path_new_func)
 .opNewFuncDone:
-    dispatch(4)
+    dispatch(5)
 
 macro arrayProfileForCall()
     loadisFromInstruction(4, t3)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to