Title: [175471] trunk/Source/_javascript_Core
Revision
175471
Author
msab...@apple.com
Date
2014-11-03 09:56:29 -0800 (Mon, 03 Nov 2014)

Log Message

Add scope operand to op_resolve_scope
https://bugs.webkit.org/show_bug.cgi?id=138253

Reviewed by Mark Lam.

Added scope operand to op_resolve_scope.  Although the scope register is filled in with
the ScopeChain register, this operand is not used in the processing of the bytecode.
That will be addressed in a future patch.

* bytecode/BytecodeList.json: Lengthened the three bytecodes.
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode): Added code to dump the scope operand.

(JSC::CodeBlock::CodeBlock): 
(JSC::CodeBlock::finalizeUnconditionally):
Updated the operand indecies for the processing of op_resolve_scope.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitResolveScope):
(JSC::BytecodeGenerator::emitGetOwnScope):
(JSC::BytecodeGenerator::emitReturn):
Added scope register to these emit functions and the bytecodes they emit.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emit_op_resolve_scope):
(JSC::JIT::emitSlow_op_resolve_scope):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emit_op_resolve_scope):
(JSC::JIT::emitSlow_op_resolve_scope):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
Updated the operand indecies for the processing of op_resolve_scope.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (175470 => 175471)


--- trunk/Source/_javascript_Core/ChangeLog	2014-11-03 15:47:08 UTC (rev 175470)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-11-03 17:56:29 UTC (rev 175471)
@@ -1,3 +1,44 @@
+2014-11-01  Michael Saboff  <msab...@apple.com>
+
+        Add scope operand to op_resolve_scope
+        https://bugs.webkit.org/show_bug.cgi?id=138253
+
+        Reviewed by Mark Lam.
+
+        Added scope operand to op_resolve_scope.  Although the scope register is filled in with
+        the ScopeChain register, this operand is not used in the processing of the bytecode.
+        That will be addressed in a future patch.
+
+        * bytecode/BytecodeList.json: Lengthened the three bytecodes.
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::dumpBytecode): Added code to dump the scope operand.
+
+        (JSC::CodeBlock::CodeBlock): 
+        (JSC::CodeBlock::finalizeUnconditionally):
+        Updated the operand indecies for the processing of op_resolve_scope.
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::emitResolveScope):
+        (JSC::BytecodeGenerator::emitGetOwnScope):
+        (JSC::BytecodeGenerator::emitReturn):
+        Added scope register to these emit functions and the bytecodes they emit.
+
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::parseBlock):
+        * dfg/DFGCapabilities.cpp:
+        (JSC::DFG::capabilityLevel):
+        * jit/JITPropertyAccess.cpp:
+        (JSC::JIT::emit_op_resolve_scope):
+        (JSC::JIT::emitSlow_op_resolve_scope):
+        * jit/JITPropertyAccess32_64.cpp:
+        (JSC::JIT::emit_op_resolve_scope):
+        (JSC::JIT::emitSlow_op_resolve_scope):
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+        * llint/LowLevelInterpreter32_64.asm:
+        * llint/LowLevelInterpreter64.asm:
+        Updated the operand indecies for the processing of op_resolve_scope.
+
 2014-11-01  Carlos Garcia Campos  <cgar...@igalia.com>
 
         REGRESSION(CMake): Make it possible to build without introspection

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeList.json (175470 => 175471)


--- trunk/Source/_javascript_Core/bytecode/BytecodeList.json	2014-11-03 15:47:08 UTC (rev 175470)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeList.json	2014-11-03 17:56:29 UTC (rev 175471)
@@ -104,7 +104,7 @@
             { "name" : "op_construct_varargs", "length" : 9 },
             { "name" : "op_strcat", "length" : 4 },
             { "name" : "op_to_primitive", "length" : 3 },
-            { "name" : "op_resolve_scope", "length" : 6 },
+            { "name" : "op_resolve_scope", "length" : 7 },
             { "name" : "op_get_from_scope", "length" : 8 },
             { "name" : "op_put_to_scope", "length" : 7 },
             { "name" : "op_push_with_scope", "length" : 3 },

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (175470 => 175471)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2014-11-03 15:47:08 UTC (rev 175470)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2014-11-03 17:56:29 UTC (rev 175471)
@@ -1487,11 +1487,12 @@
         }
         case op_resolve_scope: {
             int r0 = (++it)->u.operand;
+            int scope = (++it)->u.operand;
             int id0 = (++it)->u.operand;
             ResolveModeAndType modeAndType = ResolveModeAndType((++it)->u.operand);
             int depth = (++it)->u.operand;
             printLocationAndOp(out, exec, location, it, "resolve_scope");
-            out.printf("%s, %s, %u<%s|%s>, %d", registerName(r0).data(), idName(id0, identifier(id0)).data(),
+            out.printf("%s, %s, %s, %u<%s|%s>, %d", registerName(r0).data(), registerName(scope).data(), idName(id0, identifier(id0)).data(),
                 modeAndType.operand(), resolveModeName(modeAndType.mode()), resolveTypeName(modeAndType.type()),
                 depth);
             ++it;
@@ -1928,18 +1929,18 @@
         }
 
         case op_resolve_scope: {
-            const Identifier& ident = identifier(pc[2].u.operand);
-            ResolveType type = static_cast<ResolveType>(pc[3].u.operand);
+            const Identifier& ident = identifier(pc[3].u.operand);
+            ResolveType type = static_cast<ResolveType>(pc[4].u.operand);
             if (type == LocalClosureVar) {
-                instructions[i + 3].u.operand = ClosureVar;
+                instructions[i + 4].u.operand = ClosureVar;
                 break;
             }
 
             ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), needsActivation(), scope, ident, Get, type);
-            instructions[i + 3].u.operand = op.type;
-            instructions[i + 4].u.operand = op.depth;
+            instructions[i + 4].u.operand = op.type;
+            instructions[i + 5].u.operand = op.depth;
             if (op.lexicalEnvironment)
-                instructions[i + 5].u.lexicalEnvironment.set(*vm(), ownerExecutable, op.lexicalEnvironment);
+                instructions[i + 6].u.lexicalEnvironment.set(*vm(), ownerExecutable, op.lexicalEnvironment);
             break;
         }
 
@@ -2545,7 +2546,7 @@
                 curInstruction[2].u.jsCell.clear();
                 break;
             case op_resolve_scope: {
-                WriteBarrierBase<JSLexicalEnvironment>& lexicalEnvironment = curInstruction[5].u.lexicalEnvironment;
+                WriteBarrierBase<JSLexicalEnvironment>& lexicalEnvironment = curInstruction[6].u.lexicalEnvironment;
                 if (!lexicalEnvironment || Heap::isMarked(lexicalEnvironment.get()))
                     break;
                 if (Options::verboseOSR())

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (175470 => 175471)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2014-11-03 15:47:08 UTC (rev 175470)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2014-11-03 17:56:29 UTC (rev 175471)
@@ -1296,6 +1296,7 @@
         if (!entry.isNull()) {
             emitOpcode(op_resolve_scope);
             instructions().append(kill(dst));
+            instructions().append(scopeRegister()->index());
             instructions().append(addConstant(identifier));
             instructions().append(LocalClosureVar);
             instructions().append(0);
@@ -1310,6 +1311,7 @@
     // resolve_scope dst, id, ResolveType, depth
     emitOpcode(op_resolve_scope);
     instructions().append(kill(dst));
+    instructions().append(scopeRegister()->index());
     instructions().append(addConstant(identifier));
     instructions().append(resolveType());
     instructions().append(0);
@@ -1322,6 +1324,7 @@
 {
     emitOpcode(op_resolve_scope);
     instructions().append(kill(dst));
+    instructions().append(scopeRegister()->index());
     instructions().append(addConstant(identifier));
     instructions().append(LocalClosureVar);
     // This should be m_localScopeDepth if we aren't doing

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (175470 => 175471)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2014-11-03 15:47:08 UTC (rev 175470)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2014-11-03 17:56:29 UTC (rev 175471)
@@ -3174,8 +3174,8 @@
 
         case op_resolve_scope: {
             int dst = currentInstruction[1].u.operand;
-            ResolveType resolveType = static_cast<ResolveType>(currentInstruction[3].u.operand);
-            unsigned depth = currentInstruction[4].u.operand;
+            ResolveType resolveType = static_cast<ResolveType>(currentInstruction[4].u.operand);
+            unsigned depth = currentInstruction[5].u.operand;
 
             // get_from_scope and put_to_scope depend on this watchpoint forcing OSR exit, so they don't add their own watchpoints.
             if (needsVarInjectionChecks(resolveType))
@@ -3191,7 +3191,7 @@
             case LocalClosureVar:
             case ClosureVar:
             case ClosureVarWithVarInjectionChecks: {
-                JSLexicalEnvironment* lexicalEnvironment = currentInstruction[5].u.lexicalEnvironment.get();
+                JSLexicalEnvironment* lexicalEnvironment = currentInstruction[6].u.lexicalEnvironment.get();
                 if (lexicalEnvironment
                     && lexicalEnvironment->symbolTable()->m_functionEnteredOnce.isStillValid()) {
                     addToGraph(FunctionReentryWatchpoint, OpInfo(lexicalEnvironment->symbolTable()));

Modified: trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp (175470 => 175471)


--- trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp	2014-11-03 15:47:08 UTC (rev 175470)
+++ trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp	2014-11-03 17:56:29 UTC (rev 175471)
@@ -215,7 +215,7 @@
 
     case op_resolve_scope: {
         // We don't compile 'catch' or 'with', so there's no point in compiling variable resolution within them.
-        ResolveType resolveType = ResolveModeAndType(pc[3].u.operand).type();
+        ResolveType resolveType = ResolveModeAndType(pc[4].u.operand).type();
         if (resolveType == Dynamic)
             return CannotCompile;
         return CanCompileAndInline;

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (175470 => 175471)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2014-11-03 15:47:08 UTC (rev 175470)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2014-11-03 17:56:29 UTC (rev 175471)
@@ -602,8 +602,8 @@
 void JIT::emit_op_resolve_scope(Instruction* currentInstruction)
 {
     int dst = currentInstruction[1].u.operand;
-    ResolveType resolveType = static_cast<ResolveType>(currentInstruction[3].u.operand);
-    unsigned depth = currentInstruction[4].u.operand;
+    ResolveType resolveType = static_cast<ResolveType>(currentInstruction[4].u.operand);
+    unsigned depth = currentInstruction[5].u.operand;
 
     switch (resolveType) {
     case GlobalProperty:
@@ -629,13 +629,13 @@
 void JIT::emitSlow_op_resolve_scope(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
 {
     int dst = currentInstruction[1].u.operand;
-    ResolveType resolveType = static_cast<ResolveType>(currentInstruction[3].u.operand);
+    ResolveType resolveType = static_cast<ResolveType>(currentInstruction[4].u.operand);
 
     if (resolveType == GlobalProperty || resolveType == GlobalVar || resolveType == ClosureVar)
         return;
 
     linkSlowCase(iter);
-    int32_t indentifierIndex = currentInstruction[2].u.operand;
+    int32_t indentifierIndex = currentInstruction[3].u.operand;
     callOperation(operationResolveScope, dst, indentifierIndex);
 }
 

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp (175470 => 175471)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2014-11-03 15:47:08 UTC (rev 175470)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2014-11-03 17:56:29 UTC (rev 175471)
@@ -625,8 +625,8 @@
 void JIT::emit_op_resolve_scope(Instruction* currentInstruction)
 {
     int dst = currentInstruction[1].u.operand;
-    ResolveType resolveType = static_cast<ResolveType>(currentInstruction[3].u.operand);
-    unsigned depth = currentInstruction[4].u.operand;
+    ResolveType resolveType = static_cast<ResolveType>(currentInstruction[4].u.operand);
+    unsigned depth = currentInstruction[5].u.operand;
 
     switch (resolveType) {
     case GlobalProperty:
@@ -653,13 +653,13 @@
 void JIT::emitSlow_op_resolve_scope(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
 {
     int dst = currentInstruction[1].u.operand;
-    ResolveType resolveType = static_cast<ResolveType>(currentInstruction[3].u.operand);
+    ResolveType resolveType = static_cast<ResolveType>(currentInstruction[4].u.operand);
 
     if (resolveType == GlobalProperty || resolveType == GlobalVar || resolveType == ClosureVar)
         return;
 
     linkSlowCase(iter);
-    int32_t indentifierIndex = currentInstruction[2].u.operand;
+    int32_t indentifierIndex = currentInstruction[3].u.operand;
     callOperation(operationResolveScope, dst, indentifierIndex);
 }
 

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (175470 => 175471)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2014-11-03 15:47:08 UTC (rev 175470)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2014-11-03 17:56:29 UTC (rev 175471)
@@ -1355,7 +1355,7 @@
 LLINT_SLOW_PATH_DECL(slow_path_resolve_scope)
 {
     LLINT_BEGIN();
-    const Identifier& ident = exec->codeBlock()->identifier(pc[2].u.operand);
+    const Identifier& ident = exec->codeBlock()->identifier(pc[3].u.operand);
     LLINT_RETURN(JSScope::resolve(exec, exec->scope(), ident));
 }
 

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (175470 => 175471)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2014-11-03 15:47:08 UTC (rev 175470)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2014-11-03 17:56:29 UTC (rev 175471)
@@ -2159,7 +2159,7 @@
 
 macro resolveScope()
     loadp CodeBlock[cfr], t0
-    loadisFromInstruction(4, t2)
+    loadisFromInstruction(5, t2)
 
     loadp ScopeChain + PayloadOffset[cfr], t0
     btiz t2, .resolveScopeLoopEnd
@@ -2178,44 +2178,44 @@
 
 _llint_op_resolve_scope:
     traceExecution()
-    loadisFromInstruction(3, t0)
+    loadisFromInstruction(4, t0)
 
 #rGlobalProperty:
     bineq t0, GlobalProperty, .rGlobalVar
     getGlobalObject(1)
-    dispatch(6)
+    dispatch(7)
 
 .rGlobalVar:
     bineq t0, GlobalVar, .rClosureVar
     getGlobalObject(1)
-    dispatch(6)
+    dispatch(7)
 
 .rClosureVar:
     bineq t0, ClosureVar, .rGlobalPropertyWithVarInjectionChecks
     resolveScope()
-    dispatch(6)
+    dispatch(7)
 
 .rGlobalPropertyWithVarInjectionChecks:
     bineq t0, GlobalPropertyWithVarInjectionChecks, .rGlobalVarWithVarInjectionChecks
     varInjectionCheck(.rDynamic)
     getGlobalObject(1)
-    dispatch(6)
+    dispatch(7)
 
 .rGlobalVarWithVarInjectionChecks:
     bineq t0, GlobalVarWithVarInjectionChecks, .rClosureVarWithVarInjectionChecks
     varInjectionCheck(.rDynamic)
     getGlobalObject(1)
-    dispatch(6)
+    dispatch(7)
 
 .rClosureVarWithVarInjectionChecks:
     bineq t0, ClosureVarWithVarInjectionChecks, .rDynamic
     varInjectionCheck(.rDynamic)
     resolveScope()
-    dispatch(6)
+    dispatch(7)
 
 .rDynamic:
     callSlowPath(_llint_slow_path_resolve_scope)
-    dispatch(6)
+    dispatch(7)
 
 
 macro loadWithStructureCheck(operand, slowPath)

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (175470 => 175471)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2014-11-03 15:47:08 UTC (rev 175470)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2014-11-03 17:56:29 UTC (rev 175471)
@@ -1992,7 +1992,7 @@
 
 macro resolveScope()
     loadp CodeBlock[cfr], t0
-    loadisFromInstruction(4, t2)
+    loadisFromInstruction(5, t2)
     loadp ScopeChain[cfr], t0
     btiz t2, .resolveScopeLoopEnd
 
@@ -2009,44 +2009,44 @@
 
 _llint_op_resolve_scope:
     traceExecution()
-    loadisFromInstruction(3, t0)
+    loadisFromInstruction(4, t0)
 
 #rGlobalProperty:
     bineq t0, GlobalProperty, .rGlobalVar
     getGlobalObject(1)
-    dispatch(6)
+    dispatch(7)
 
 .rGlobalVar:
     bineq t0, GlobalVar, .rClosureVar
     getGlobalObject(1)
-    dispatch(6)
+    dispatch(7)
 
 .rClosureVar:
     bineq t0, ClosureVar, .rGlobalPropertyWithVarInjectionChecks
     resolveScope()
-    dispatch(6)
+    dispatch(7)
 
 .rGlobalPropertyWithVarInjectionChecks:
     bineq t0, GlobalPropertyWithVarInjectionChecks, .rGlobalVarWithVarInjectionChecks
     varInjectionCheck(.rDynamic)
     getGlobalObject(1)
-    dispatch(6)
+    dispatch(7)
 
 .rGlobalVarWithVarInjectionChecks:
     bineq t0, GlobalVarWithVarInjectionChecks, .rClosureVarWithVarInjectionChecks
     varInjectionCheck(.rDynamic)
     getGlobalObject(1)
-    dispatch(6)
+    dispatch(7)
 
 .rClosureVarWithVarInjectionChecks:
     bineq t0, ClosureVarWithVarInjectionChecks, .rDynamic
     varInjectionCheck(.rDynamic)
     resolveScope()
-    dispatch(6)
+    dispatch(7)
 
 .rDynamic:
     callSlowPath(_llint_slow_path_resolve_scope)
-    dispatch(6)
+    dispatch(7)
 
 
 macro loadWithStructureCheck(operand, slowPath)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to