Title: [175998] trunk/Source/_javascript_Core
Revision
175998
Author
msab...@apple.com
Date
2014-11-11 18:33:43 -0800 (Tue, 11 Nov 2014)

Log Message

Use scope register when processing op_resolve_scope in LLInt and Baseline JIT
https://bugs.webkit.org/show_bug.cgi?id=138637

Reviewed by Mark Lam.

Filled out op_resolve_scope processing to use the scope operand to access the current
scope chain.

* jit/JIT.h:
* jit/JITInlines.h:
(JSC::JIT::callOperation):
* jit/JITOperations.cpp:
* jit/JITOperations.h:
Added scope virtual register parameter to emitResolveClosure().  Added new callOperation() to
support the additional argument.

* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitResolveClosure):
(JSC::JIT::emit_op_resolve_scope):
(JSC::JIT::emitSlow_op_resolve_scope):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emitResolveClosure):
(JSC::JIT::emit_op_resolve_scope):
(JSC::JIT::emitSlow_op_resolve_scope):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
Added "scope" parameter to emitResolveClosure().  Passed scope register index to slow path.
Used scope virtual register instead of JSStack::ScopeChain.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (175997 => 175998)


--- trunk/Source/_javascript_Core/ChangeLog	2014-11-12 01:51:39 UTC (rev 175997)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-11-12 02:33:43 UTC (rev 175998)
@@ -1,3 +1,34 @@
+2014-11-11  Michael Saboff  <msab...@apple.com>
+
+        Use scope register when processing op_resolve_scope in LLInt and Baseline JIT
+        https://bugs.webkit.org/show_bug.cgi?id=138637
+
+        Reviewed by Mark Lam.
+
+        Filled out op_resolve_scope processing to use the scope operand to access the current
+        scope chain.
+
+        * jit/JIT.h:
+        * jit/JITInlines.h:
+        (JSC::JIT::callOperation):
+        * jit/JITOperations.cpp:
+        * jit/JITOperations.h:
+        Added scope virtual register parameter to emitResolveClosure().  Added new callOperation() to
+        support the additional argument.
+
+        * jit/JITPropertyAccess.cpp:
+        (JSC::JIT::emitResolveClosure):
+        (JSC::JIT::emit_op_resolve_scope):
+        (JSC::JIT::emitSlow_op_resolve_scope):
+        * jit/JITPropertyAccess32_64.cpp:
+        (JSC::JIT::emitResolveClosure):
+        (JSC::JIT::emit_op_resolve_scope):
+        (JSC::JIT::emitSlow_op_resolve_scope):
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+        Added "scope" parameter to emitResolveClosure().  Passed scope register index to slow path.
+        Used scope virtual register instead of JSStack::ScopeChain.
+
 2014-11-11  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Don't require a debugger be attached for inspector auto attach

Modified: trunk/Source/_javascript_Core/jit/JIT.h (175997 => 175998)


--- trunk/Source/_javascript_Core/jit/JIT.h	2014-11-12 01:51:39 UTC (rev 175997)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2014-11-12 02:33:43 UTC (rev 175998)
@@ -625,7 +625,7 @@
         void emitRightShiftSlowCase(Instruction*, Vector<SlowCaseEntry>::iterator&, bool isUnsigned);
 
         void emitVarInjectionCheck(bool needsVarInjectionChecks);
-        void emitResolveClosure(int dst, bool needsVarInjectionChecks, unsigned depth);
+        void emitResolveClosure(int dst, int scope, bool needsVarInjectionChecks, unsigned depth);
         void emitLoadWithStructureCheck(int scope, Structure** structureSlot);
         void emitGetGlobalProperty(uintptr_t* operandSlot);
         void emitGetGlobalVar(uintptr_t operand);
@@ -705,6 +705,7 @@
         MacroAssembler::Call callOperation(J_JITOperation_EP, int, void*);
         MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_EPc, int, Instruction*);
         MacroAssembler::Call callOperation(J_JITOperation_EZ, int, int32_t);
+        MacroAssembler::Call callOperation(J_JITOperation_EZZ, int, int32_t, int32_t);
         MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, size_t);
         MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID);
         MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID);

Modified: trunk/Source/_javascript_Core/jit/JITInlines.h (175997 => 175998)


--- trunk/Source/_javascript_Core/jit/JITInlines.h	2014-11-12 01:51:39 UTC (rev 175997)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h	2014-11-12 02:33:43 UTC (rev 175998)
@@ -276,6 +276,12 @@
     return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
 }
 
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EZZ operation, int dst, int32_t arg1, int32_t arg2)
+{
+    setupArgumentsWithExecState(TrustedImm32(arg1), TrustedImm32(arg2));
+    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
+}
+
 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(S_JITOperation_ECC operation, RegisterID regOp1, RegisterID regOp2)
 {
     setupArgumentsWithExecState(regOp1, regOp2);

Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (175997 => 175998)


--- trunk/Source/_javascript_Core/jit/JITOperations.cpp	2014-11-12 01:51:39 UTC (rev 175997)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp	2014-11-12 02:33:43 UTC (rev 175998)
@@ -1718,12 +1718,13 @@
     return reinterpret_cast<char*>(result);
 }
 
-EncodedJSValue JIT_OPERATION operationResolveScope(ExecState* exec, int32_t identifierIndex)
+EncodedJSValue JIT_OPERATION operationResolveScope(ExecState* exec, int32_t scopeReg, int32_t identifierIndex)
 {
     VM& vm = exec->vm();
     NativeCallFrameTracer tracer(&vm, exec);
     const Identifier& ident = exec->codeBlock()->identifier(identifierIndex);
-    return JSValue::encode(JSScope::resolve(exec, exec->scope(), ident));
+    JSScope* scope = exec->uncheckedR(scopeReg).Register::scope();
+    return JSValue::encode(JSScope::resolve(exec, scope, ident));
 }
 
 EncodedJSValue JIT_OPERATION operationGetFromScope(ExecState* exec, Instruction* bytecodePC)

Modified: trunk/Source/_javascript_Core/jit/JITOperations.h (175997 => 175998)


--- trunk/Source/_javascript_Core/jit/JITOperations.h	2014-11-12 01:51:39 UTC (rev 175997)
+++ trunk/Source/_javascript_Core/jit/JITOperations.h	2014-11-12 02:33:43 UTC (rev 175998)
@@ -310,7 +310,7 @@
 char* JIT_OPERATION operationSwitchCharWithUnknownKeyType(ExecState*, EncodedJSValue key, size_t tableIndex) WTF_INTERNAL;
 char* JIT_OPERATION operationSwitchImmWithUnknownKeyType(ExecState*, EncodedJSValue key, size_t tableIndex) WTF_INTERNAL;
 char* JIT_OPERATION operationSwitchStringWithUnknownKeyType(ExecState*, EncodedJSValue key, size_t tableIndex) WTF_INTERNAL;
-EncodedJSValue JIT_OPERATION operationResolveScope(ExecState*, int32_t identifierIndex) WTF_INTERNAL;
+EncodedJSValue JIT_OPERATION operationResolveScope(ExecState*, int32_t scope, int32_t identifierIndex) WTF_INTERNAL;
 EncodedJSValue JIT_OPERATION operationGetFromScope(ExecState*, Instruction* bytecodePC) WTF_INTERNAL;
 void JIT_OPERATION operationPutToScope(ExecState*, Instruction* bytecodePC) WTF_INTERNAL;
 

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (175997 => 175998)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2014-11-12 01:51:39 UTC (rev 175997)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2014-11-12 02:33:43 UTC (rev 175998)
@@ -590,10 +590,10 @@
     addSlowCase(branch8(Equal, AbsoluteAddress(m_codeBlock->globalObject()->varInjectionWatchpoint()->addressOfState()), TrustedImm32(IsInvalidated)));
 }
 
-void JIT::emitResolveClosure(int dst, bool needsVarInjectionChecks, unsigned depth)
+void JIT::emitResolveClosure(int dst, int scope, bool needsVarInjectionChecks, unsigned depth)
 {
     emitVarInjectionCheck(needsVarInjectionChecks);
-    emitGetVirtualRegister(JSStack::ScopeChain, regT0);
+    emitGetVirtualRegister(scope, regT0);
     for (unsigned i = 0; i < depth; ++i)
         loadPtr(Address(regT0, JSScope::offsetOfNext()), regT0);
     emitPutVirtualRegister(dst);
@@ -602,6 +602,7 @@
 void JIT::emit_op_resolve_scope(Instruction* currentInstruction)
 {
     int dst = currentInstruction[1].u.operand;
+    int scope = currentInstruction[2].u.operand;
     ResolveType resolveType = static_cast<ResolveType>(currentInstruction[4].u.operand);
     unsigned depth = currentInstruction[5].u.operand;
 
@@ -616,7 +617,7 @@
         break;
     case ClosureVar:
     case ClosureVarWithVarInjectionChecks:
-        emitResolveClosure(dst, needsVarInjectionChecks(resolveType), depth);
+        emitResolveClosure(dst, scope, needsVarInjectionChecks(resolveType), depth);
         break;
     case Dynamic:
         addSlowCase(jump());
@@ -635,8 +636,9 @@
         return;
 
     linkSlowCase(iter);
+    int32_t scope = currentInstruction[2].u.operand;
     int32_t indentifierIndex = currentInstruction[3].u.operand;
-    callOperation(operationResolveScope, dst, indentifierIndex);
+    callOperation(operationResolveScope, dst, scope, indentifierIndex);
 }
 
 void JIT::emitLoadWithStructureCheck(int scope, Structure** structureSlot)

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp (175997 => 175998)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2014-11-12 01:51:39 UTC (rev 175997)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2014-11-12 02:33:43 UTC (rev 175998)
@@ -612,11 +612,11 @@
     addSlowCase(branch8(Equal, AbsoluteAddress(m_codeBlock->globalObject()->varInjectionWatchpoint()->addressOfState()), TrustedImm32(IsInvalidated)));
 }
 
-void JIT::emitResolveClosure(int dst, bool needsVarInjectionChecks, unsigned depth)
+void JIT::emitResolveClosure(int dst, int scope, bool needsVarInjectionChecks, unsigned depth)
 {
     emitVarInjectionCheck(needsVarInjectionChecks);
     move(TrustedImm32(JSValue::CellTag), regT1);
-    emitLoadPayload(JSStack::ScopeChain, regT0);
+    emitLoadPayload(scope, regT0);
     for (unsigned i = 0; i < depth; ++i)
         loadPtr(Address(regT0, JSScope::offsetOfNext()), regT0);
     emitStore(dst, regT1, regT0);
@@ -625,6 +625,7 @@
 void JIT::emit_op_resolve_scope(Instruction* currentInstruction)
 {
     int dst = currentInstruction[1].u.operand;
+    int scope = currentInstruction[2].u.operand;
     ResolveType resolveType = static_cast<ResolveType>(currentInstruction[4].u.operand);
     unsigned depth = currentInstruction[5].u.operand;
 
@@ -640,7 +641,7 @@
         break;
     case ClosureVar:
     case ClosureVarWithVarInjectionChecks:
-        emitResolveClosure(dst, needsVarInjectionChecks(resolveType), depth);
+        emitResolveClosure(dst, scope, needsVarInjectionChecks(resolveType), depth);
         break;
     case Dynamic:
         addSlowCase(jump());
@@ -659,8 +660,9 @@
         return;
 
     linkSlowCase(iter);
+    int32_t scope = currentInstruction[2].u.operand;
     int32_t indentifierIndex = currentInstruction[3].u.operand;
-    callOperation(operationResolveScope, dst, indentifierIndex);
+    callOperation(operationResolveScope, dst, scope, indentifierIndex);
 }
 
 void JIT::emitLoadWithStructureCheck(int scope, Structure** structureSlot)

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (175997 => 175998)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2014-11-12 01:51:39 UTC (rev 175997)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2014-11-12 02:33:43 UTC (rev 175998)
@@ -1358,7 +1358,8 @@
 {
     LLINT_BEGIN();
     const Identifier& ident = exec->codeBlock()->identifier(pc[3].u.operand);
-    LLINT_RETURN(JSScope::resolve(exec, exec->scope(), ident));
+    JSScope* scope = LLINT_OP(2).Register::scope();
+    LLINT_RETURN(JSScope::resolve(exec, scope, ident));
 }
 
 LLINT_SLOW_PATH_DECL(slow_path_get_from_scope)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to