Changeset 176479 in webkit
- Timestamp:
- Nov 21, 2014, 3:41:26 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r176473 r176479 1 2014-11-21 Michael Saboff <msaboff@apple.com> 2 3 Allocate local ScopeChain register 4 https://bugs.webkit.org/show_bug.cgi?id=138793 5 6 Reviewed by Geoffrey Garen. 7 8 New test that sets a breakpoint in a callee of a DFG caller. While stopped in the 9 breakpoint, it modifies a global via the scope chain of the DFG caller as well as 10 a local of the DFG caller. 11 12 * inspector-protocol/debugger/resources/breakpoint.js: 13 (notInlineable3): 14 (dfgWithoutInline3): 15 * inspector-protocol/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local-expected.txt: Added. 16 * inspector-protocol/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local.html: Added. 17 1 18 2014-11-21 Glenn Adams <glenn@skynav.com> and Myles C. Maxfield <mmaxfield@apple.com> 2 19 -
trunk/LayoutTests/inspector-protocol/debugger/resources/breakpoint.js
r165008 r176479 92 92 } 93 93 94 function notInlineable3(x) 95 { 96 var func = new Function("return x + 100;"); 97 if (x == 1999) 98 breakpointBasic(); 99 return x + 3; 100 } 101 102 var globalVal3 = 0; 103 104 function dfgWithoutInline3() 105 { 106 globalVal3 = 0; 107 var i; 108 var result = 0; 109 var localVal3 = 0; 110 for (i = 0; i < 2000; i++) 111 result += notInlineable3(i); 112 if (globalVal3) 113 result = globalVal3 + localVal3; 114 log("result: " + result); 115 } -
trunk/Source/JavaScriptCore/ChangeLog
r176446 r176479 1 2014-11-21 Michael Saboff <msaboff@apple.com> 2 3 Allocate local ScopeChain register 4 https://bugs.webkit.org/show_bug.cgi?id=138793 5 6 Reviewed by Geoffrey Garen. 7 8 Now we allocate the scope register as a local. The allocated register is stored in the 9 CodeBlock for use by other components. Update the DFG to work with a local scope register. 10 Changed usage of JSStack::ScopeChain access to the CallFrame header to use the allocated 11 local register. 12 13 * bytecode/BytecodeUseDef.h: 14 (JSC::computeUsesForBytecodeOffset): 15 (JSC::computeDefsForBytecodeOffset): 16 Updated to properly represent the operand inputs and bytecode result. 17 18 * bytecode/CodeBlock.cpp: 19 (JSC::CodeBlock::CodeBlock): 20 * bytecode/CodeBlock.h: 21 (JSC::CodeBlock::setScopeRegister): 22 (JSC::CodeBlock::scopeRegister): 23 * bytecode/UnlinkedCodeBlock.h: 24 (JSC::UnlinkedCodeBlock::setScopeRegister): 25 (JSC::UnlinkedCodeBlock::scopeRegister): 26 Added scope register member and accessors. 27 28 * bytecompiler/BytecodeGenerator.cpp: 29 (JSC::BytecodeGenerator::BytecodeGenerator): 30 (JSC::BytecodeGenerator::allocateAndEmitScope): 31 * bytecompiler/BytecodeGenerator.h: 32 (JSC::BytecodeGenerator::scopeRegister): 33 Change m_scopeRegister to an allocated register. Added allocateAndEmitScope helper to 34 allocate the scope register, set the CodeBlock with its value and emit op_get_scope. 35 36 * debugger/DebuggerCallFrame.cpp: 37 (JSC::DebuggerCallFrame::scope): Changed to access the scope using the new convention. 38 39 * dfg/DFGByteCodeParser.cpp: 40 (JSC::DFG::ByteCodeParser::get): 41 (JSC::DFG::ByteCodeParser::flush): 42 (JSC::DFG::ByteCodeParser::inlineCall): 43 (JSC::DFG::ByteCodeParser::parseBlock): 44 Changed op_create_lexical_environment to set the scope VirtualRegister operand. 45 Filled out op_get_scope processing to emit a GetScope node putting the result in 46 the scope VirtualRegister result operand. 47 Added Phantoms where appropriate to keep the Scope register alive in places where 48 it use is optimized away, but where the baseline JIT would need to use its value. 49 Eliminated uses of JSStack::ScopeChain. 50 51 * dfg/DFGStackLayoutPhase.cpp: 52 (JSC::DFG::StackLayoutPhase::run): 53 Make sure that the scope register stack location is allocated using the same place 54 that the codeBlock expects. 55 56 * dfg/DFGStrengthReductionPhase.cpp: 57 (JSC::DFG::StrengthReductionPhase::handleNode): 58 Allow strength reduction of Flush to skip of GetScope nodes looking for a prior 59 corresponding SetLocal. 60 61 * interpreter/CallFrame.h: 62 (JSC::ExecState::scope): 63 (JSC::ExecState::setScope): 64 Added new scope() and setScope() helpers that take a VirtualRegister offset. 65 66 * interpreter/Interpreter.cpp: 67 (JSC::eval): 68 Changed eval() to get the scope from the caller's scope register instead of from the 69 temporary frame created for eval. 70 71 * interpreter/Interpreter.cpp: 72 (JSC::Interpreter::unwind): 73 Changed unwind() to manipulate the scope n the allocated register instead of from the 74 call frame slot. 75 76 * interpreter/StackVisitor.cpp: 77 (JSC::StackVisitor::readNonInlinedFrame): 78 (JSC::StackVisitor::readInlinedFrame): 79 * interpreter/StackVisitor.h: 80 (JSC::StackVisitor::Frame::callee): 81 (JSC::StackVisitor::Frame::scope): Deleted. 82 Eliminated the scope member as it needed to change and no StackVisitor users use it. 83 84 * jit/JITOperations.cpp: 85 (JSC::operationPushNameScope): 86 (JSC::operationPushWithScope): 87 * runtime/JSNameScope.h: 88 (JSC::JSNameScope::create): 89 * runtime/JSWithScope.h: 90 (JSC::JSWithScope::create): Deleted. 91 * llint/LLIntSlowPaths.cpp: 92 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 93 Deleted JSNameScope::create() and JSWithScope::create() flavors tht used the ScopeChain slot 94 in the CallFrame header. Changed the only user of these function, op_push_name_scope and 95 op_push_with_scope helpers, to use the remaining create variants that require explicit scope. 96 Those operations get the scope from the register pointed to by their scope operands. 97 98 * llint/LowLevelInterpreter32_64.asm: 99 * llint/LowLevelInterpreter64.asm: 100 Changed resolveScope to use the allocated register. 101 1 102 2014-11-21 Csaba Osztrogonác <ossy@webkit.org> 2 103 -
trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h
r175508 r176479 45 45 case op_throw_static_error: 46 46 case op_debug: 47 case op_resolve_scope:48 case op_pop_scope:49 47 case op_jneq_ptr: 50 case op_new_func_exp:51 48 case op_loop_hint: 52 49 case op_jmp: … … 58 55 case op_touch_entry: 59 56 return; 60 case op_new_func: 61 case op_create_lexical_environment: 57 case op_create_lexical_environment: 62 58 case op_get_scope: 63 59 case op_create_arguments: 64 60 case op_to_this: 61 case op_pop_scope: 65 62 case op_profile_will_call: 66 63 case op_profile_did_call: 67 64 case op_profile_type: 68 65 case op_throw: 69 case op_push_with_scope:70 66 case op_end: 71 67 case op_ret: … … 79 75 return; 80 76 } 77 case op_new_func: 81 78 case op_ret_object_or_this: 82 79 case op_jlesseq: … … 118 115 } 119 116 case op_get_enumerable_length: 117 case op_new_func_exp: 120 118 case op_to_index_string: 121 119 case op_init_global_const_nop: 122 120 case op_init_global_const: 123 121 case op_push_name_scope: 122 case op_push_with_scope: 123 case op_resolve_scope: 124 124 case op_get_from_scope: 125 125 case op_to_primitive: … … 245 245 case op_init_global_const: 246 246 case op_init_global_const_nop: 247 case op_push_name_scope:248 case op_push_with_scope:249 247 case op_put_to_scope: 250 case op_pop_scope:251 248 case op_end: 252 249 case op_profile_will_call: … … 302 299 case op_get_structure_property_enumerator: 303 300 case op_next_enumerator_pname: 301 case op_pop_scope: 302 case op_push_name_scope: 303 case op_push_with_scope: 304 304 case op_resolve_scope: 305 305 case op_strcat: … … 366 366 case op_get_callee: 367 367 case op_init_lazy_reg: 368 case op_create_lexical_environment:369 368 case op_get_scope: 370 369 case op_create_arguments: … … 375 374 return; 376 375 } 376 case op_create_lexical_environment: { 377 functor(codeBlock, instruction, opcodeID, instruction[1].u.operand); 378 functor(codeBlock, instruction, opcodeID, instruction[2].u.operand); 379 return; 380 } 377 381 case op_enter: { 378 382 for (unsigned i = codeBlock->m_numVars; i--;) -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r176109 r176479 1631 1631 , m_instructions(other.m_instructions) 1632 1632 , m_thisRegister(other.m_thisRegister) 1633 , m_scopeRegister(other.m_scopeRegister) 1633 1634 , m_argumentsRegister(other.m_argumentsRegister) 1634 1635 , m_lexicalEnvironmentRegister(other.m_lexicalEnvironmentRegister) … … 1690 1691 , m_vm(unlinkedCodeBlock->vm()) 1691 1692 , m_thisRegister(unlinkedCodeBlock->thisRegister()) 1693 , m_scopeRegister(unlinkedCodeBlock->scopeRegister()) 1692 1694 , m_argumentsRegister(unlinkedCodeBlock->argumentsRegister()) 1693 1695 , m_lexicalEnvironmentRegister(unlinkedCodeBlock->activationRegister()) -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r175691 r176479 324 324 bool usesEval() const { return m_unlinkedCode->usesEval(); } 325 325 326 void setScopeRegister(VirtualRegister scopeRegister) 327 { 328 m_scopeRegister = scopeRegister; 329 } 330 331 VirtualRegister scopeRegister() const 332 { 333 ASSERT(m_scopeRegister.isValid()); 334 return m_scopeRegister; 335 } 336 326 337 void setArgumentsRegister(VirtualRegister argumentsRegister) 327 338 { … … 341 352 return argumentsRegister(); 342 353 } 354 343 355 void setActivationRegister(VirtualRegister activationRegister) 344 356 { … … 1033 1045 WriteBarrier<SymbolTable> m_symbolTable; 1034 1046 VirtualRegister m_thisRegister; 1047 VirtualRegister m_scopeRegister; 1035 1048 VirtualRegister m_argumentsRegister; 1036 1049 VirtualRegister m_lexicalEnvironmentRegister; -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
r173517 r176479 283 283 // Special registers 284 284 void setThisRegister(VirtualRegister thisRegister) { m_thisRegister = thisRegister; } 285 void setScopeRegister(VirtualRegister scopeRegister) { m_scopeRegister = scopeRegister; } 285 286 void setActivationRegister(VirtualRegister activationRegister) { m_lexicalEnvironmentRegister = activationRegister; } 286 287 … … 430 431 431 432 VirtualRegister thisRegister() const { return m_thisRegister; } 433 VirtualRegister scopeRegister() const { return m_scopeRegister; } 432 434 VirtualRegister activationRegister() const { return m_lexicalEnvironmentRegister; } 433 435 bool hasActivationRegister() const { return m_lexicalEnvironmentRegister.isValid(); } … … 521 523 VirtualRegister m_thisRegister; 522 524 VirtualRegister m_argumentsRegister; 525 VirtualRegister m_scopeRegister; 523 526 VirtualRegister m_lexicalEnvironmentRegister; 524 527 VirtualRegister m_globalObjectRegister; -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r176109 r176479 165 165 , m_codeBlock(vm, codeBlock) 166 166 , m_thisRegister(CallFrame::thisArgumentOffset()) 167 , m_scopeRegister( JSStack::ScopeChain)167 , m_scopeRegister(0) 168 168 , m_lexicalEnvironmentRegister(0) 169 169 , m_emptyValueRegister(0) … … 191 191 emitOpcode(op_enter); 192 192 193 emitGetScope();193 allocateAndEmitScope(); 194 194 195 195 const VarStack& varStack = programNode->varStack(); … … 213 213 , m_scopeNode(functionBody) 214 214 , m_codeBlock(vm, codeBlock) 215 , m_scopeRegister( JSStack::ScopeChain)215 , m_scopeRegister(0) 216 216 , m_lexicalEnvironmentRegister(0) 217 217 , m_emptyValueRegister(0) … … 252 252 emitOpcode(op_enter); 253 253 254 emitGetScope();254 allocateAndEmitScope(); 255 255 256 256 if (m_codeBlock->needsFullScopeChain() || m_shouldEmitDebugHooks) { … … 453 453 , m_codeBlock(vm, codeBlock) 454 454 , m_thisRegister(CallFrame::thisArgumentOffset()) 455 , m_scopeRegister( JSStack::ScopeChain)455 , m_scopeRegister(0) 456 456 , m_lexicalEnvironmentRegister(0) 457 457 , m_emptyValueRegister(0) … … 480 480 emitOpcode(op_enter); 481 481 482 emitGetScope();482 allocateAndEmitScope(); 483 483 484 484 const DeclarationStacks::FunctionStack& functionStack = evalNode->functionStack(); … … 2217 2217 } 2218 2218 return LabelScopePtr::null(); 2219 } 2220 2221 void BytecodeGenerator::allocateAndEmitScope() 2222 { 2223 m_scopeRegister = addVar(); 2224 m_scopeRegister->ref(); 2225 m_codeBlock->setScopeRegister(scopeRegister()->virtualRegister()); 2226 emitGetScope(); 2219 2227 } 2220 2228 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r175508 r176479 291 291 RegisterID* thisRegister() { return &m_thisRegister; } 292 292 293 RegisterID* scopeRegister() { return &m_scopeRegister; }293 RegisterID* scopeRegister() { return m_scopeRegister; } 294 294 295 295 // Returns the next available temporary register. Registers returned by … … 595 595 ALWAYS_INLINE void rewindUnaryOp(); 596 596 597 void allocateAndEmitScope(); 597 598 void emitComplexPopScopes(RegisterID*, ControlFlowContext* topScope, ControlFlowContext* bottomScope); 598 599 … … 755 756 RegisterID m_thisRegister; 756 757 RegisterID m_calleeRegister; 757 RegisterID m_scopeRegister;758 RegisterID* m_scopeRegister; 758 759 RegisterID* m_lexicalEnvironmentRegister; 759 760 RegisterID* m_emptyValueRegister; -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
r173896 r176479 144 144 if (!m_scope) { 145 145 VM& vm = m_callFrame->vm(); 146 JSScope* scope; 146 147 CodeBlock* codeBlock = m_callFrame->codeBlock(); 147 if (codeBlock && codeBlock->needsActivation() && !m_callFrame->hasActivation()) { 148 ASSERT(!m_callFrame->scope()->isWithScope()); 149 JSLexicalEnvironment* lexicalEnvironment = JSLexicalEnvironment::create(vm, m_callFrame, codeBlock); 150 m_callFrame->setActivation(lexicalEnvironment); 151 m_callFrame->setScope(lexicalEnvironment); 152 } 153 154 m_scope.set(vm, DebuggerScope::create(vm, m_callFrame->scope())); 148 if (codeBlock && codeBlock->scopeRegister().isValid()) 149 scope = m_callFrame->scope(codeBlock->scopeRegister().offset()); 150 else 151 scope = jsCast<JSCallee*>(m_callFrame->callee())->scope(); 152 153 m_scope.set(vm, DebuggerScope::create(vm, scope)); 155 154 } 156 155 return m_scope.get(); -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r176109 r176479 263 263 if (operand.offset() == JSStack::Callee) 264 264 return weakJSConstant(callee); 265 if (operand .offset() == JSStack::ScopeChain)265 if (operand == m_inlineStackTop->m_codeBlock->scopeRegister()) 266 266 return weakJSConstant(callee->scope()); 267 267 } 268 268 } else if (operand.offset() == JSStack::Callee) 269 269 return addToGraph(GetCallee); 270 else if (operand.offset() == JSStack::ScopeChain)271 return addToGraph(GetMyScope);272 270 273 271 return getDirect(m_inlineStackTop->remapOperand(operand)); … … 527 525 if (InlineCallFrame* inlineCallFrame = inlineStackEntry->m_inlineCallFrame) { 528 526 numArguments = inlineCallFrame->arguments.size(); 529 if (inlineCallFrame->isClosureCall) {527 if (inlineCallFrame->isClosureCall) 530 528 flushDirect(inlineStackEntry->remapOperand(VirtualRegister(JSStack::Callee))); 531 flushDirect(inlineStackEntry->remapOperand(VirtualRegister(JSStack::ScopeChain)));532 }533 529 } else 534 530 numArguments = inlineStackEntry->m_codeBlock->numParameters(); … … 1263 1259 VariableAccessData* calleeVariable = 1264 1260 set(VirtualRegister(JSStack::Callee), callTargetNode, ImmediateNakedSet)->variableAccessData(); 1265 VariableAccessData* scopeVariable =1266 set(VirtualRegister(JSStack::ScopeChain), addToGraph(GetScope, callTargetNode), ImmediateNakedSet)->variableAccessData();1267 1261 1268 1262 calleeVariable->mergeShouldNeverUnbox(true); 1269 scopeVariable->mergeShouldNeverUnbox(true);1270 1263 1271 1264 inlineVariableData.calleeVariable = calleeVariable; … … 3196 3189 && lexicalEnvironment->symbolTable()->m_functionEnteredOnce.isStillValid()) { 3197 3190 addToGraph(FunctionReentryWatchpoint, OpInfo(lexicalEnvironment->symbolTable())); 3191 addToGraph(Phantom, getDirect(m_inlineStackTop->remapOperand(VirtualRegister(currentInstruction[2].u.operand)))); 3198 3192 set(VirtualRegister(dst), weakJSConstant(lexicalEnvironment)); 3199 3193 break; 3200 3194 } 3201 3195 set(VirtualRegister(dst), getScope(VirtualRegister(currentInstruction[2].u.operand), depth)); 3196 if (inlineCallFrame()) 3197 addToGraph(Phantom, getDirect(m_inlineStackTop->remapOperand(VirtualRegister(currentInstruction[2].u.operand)))); 3202 3198 break; 3203 3199 } … … 3396 3392 3397 3393 case op_create_lexical_environment: { 3398 set(VirtualRegister(currentInstruction[1].u.operand), addToGraph(CreateActivation, get(VirtualRegister(currentInstruction[1].u.operand)))); 3394 Node* lexicalEnvironment = addToGraph(CreateActivation, get(VirtualRegister(currentInstruction[1].u.operand))); 3395 set(VirtualRegister(currentInstruction[1].u.operand), lexicalEnvironment); 3396 set(VirtualRegister(currentInstruction[2].u.operand), lexicalEnvironment); 3399 3397 NEXT_OPCODE(op_create_lexical_environment); 3400 3398 } 3401 3399 3402 3400 case op_get_scope: { 3401 set(VirtualRegister(currentInstruction[1].u.operand), addToGraph(GetScope, get(VirtualRegister(JSStack::Callee)))); 3403 3402 NEXT_OPCODE(op_get_scope); 3404 3403 } -
trunk/Source/JavaScriptCore/dfg/DFGStackLayoutPhase.cpp
r174165 r176479 169 169 } 170 170 171 if (codeBlock()->scopeRegister().isValid()) { 172 codeBlock()->setScopeRegister( 173 virtualRegisterForLocal(allocation[codeBlock()->scopeRegister().toLocal()])); 174 } 175 171 176 for (unsigned i = m_graph.m_inlineVariableData.size(); i--;) { 172 177 InlineVariableData data = m_graph.m_inlineVariableData[i]; -
trunk/Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp
r172129 r176479 256 256 case DoubleConstant: 257 257 case Int52Constant: 258 case GetScope: 258 259 break; 259 260 -
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r175967 r176479 52 52 } 53 53 54 JSScope* scope(int scopeRegisterOffset) const 55 { 56 ASSERT(this[scopeRegisterOffset].Register::scope()); 57 return this[scopeRegisterOffset].Register::scope(); 58 } 59 54 60 bool hasActivation() const; 55 61 JSLexicalEnvironment* lexicalEnvironment() const; … … 187 193 void setCallerFrame(CallFrame* frame) { callerFrameAndPC().callerFrame = frame; } 188 194 void setScope(JSScope* scope) { static_cast<Register*>(this)[JSStack::ScopeChain] = scope; } 195 void setScope(int scopeRegisterOffset, JSScope* scope) { static_cast<Register*>(this)[scopeRegisterOffset] = scope; } 189 196 void setActivation(JSLexicalEnvironment*); 190 197 -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r174361 r176479 106 106 CallFrame* callerFrame = callFrame->callerFrame(); 107 107 CodeBlock* callerCodeBlock = callerFrame->codeBlock(); 108 JSScope* callerScopeChain = callerFrame-> scope();108 JSScope* callerScopeChain = callerFrame->uncheckedR(callerCodeBlock->scopeRegister().offset()).Register::scope(); 109 109 EvalExecutable* eval = callerCodeBlock->evalCodeCache().tryGet(callerCodeBlock->isStrictMode(), programSource, callerScopeChain); 110 110 … … 727 727 ++targetScopeDepth; 728 728 729 JSScope* scope = callFrame->scope(); 729 int scopeRegisterOffset = codeBlock->scopeRegister().offset(); 730 JSScope* scope = callFrame->scope(scopeRegisterOffset); 730 731 int scopeDelta = scope->depth() - targetScopeDepth; 731 732 RELEASE_ASSERT(scopeDelta >= 0); … … 733 734 while (scopeDelta--) 734 735 scope = scope->next(); 735 callFrame->setScope(scope); 736 737 callFrame->setScope(scopeRegisterOffset, scope); 736 738 737 739 return handler; -
trunk/Source/JavaScriptCore/interpreter/StackVisitor.cpp
r175967 r176479 122 122 m_frame.m_callerIsVMEntryFrame = m_frame.m_CallerVMEntryFrame != m_frame.m_VMEntryFrame; 123 123 m_frame.m_callee = callFrame->callee(); 124 m_frame.m_scope = callFrame->scope();125 124 m_frame.m_codeBlock = callFrame->codeBlock(); 126 125 m_frame.m_bytecodeOffset = !m_frame.codeBlock() ? 0 … … 156 155 157 156 JSFunction* callee = inlineCallFrame->calleeForCallFrame(callFrame); 158 m_frame.m_scope = callee->scope();159 157 m_frame.m_callee = callee; 160 ASSERT(m_frame.scope());161 158 ASSERT(m_frame.callee()); 162 159 -
trunk/Source/JavaScriptCore/interpreter/StackVisitor.h
r175706 r176479 61 61 CallFrame* callerFrame() const { return m_callerFrame; } 62 62 JSObject* callee() const { return m_callee; } 63 JSScope* scope() const { return m_scope; }64 63 CodeBlock* codeBlock() const { return m_codeBlock; } 65 64 unsigned bytecodeOffset() const { return m_bytecodeOffset; } … … 102 101 CallFrame* m_callerFrame; 103 102 JSObject* m_callee; 104 JSScope* m_scope;105 103 CodeBlock* m_codeBlock; 106 104 unsigned m_bytecodeOffset; -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r176109 r176479 1314 1314 NativeCallFrameTracer tracer(&vm, exec); 1315 1315 1316 // FIXME: This won't work if this operation is called from the DFG or FTL. 1317 // This should be changed to pass in the new scope. 1318 JSScope* currentScope = exec->uncheckedR(dst).Register::scope(); 1316 1319 JSNameScope::Type scopeType = static_cast<JSNameScope::Type>(type); 1317 JSNameScope* scope = JSNameScope::create(exec, *identifier, JSValue::decode(encodedValue), attibutes, scopeType); 1318 1320 JSNameScope* scope = JSNameScope::create(exec, currentScope, *identifier, JSValue::decode(encodedValue), attibutes, scopeType); 1321 1322 // FIXME: This won't work if this operation is called from the DFG or FTL. 1323 // This should be changed to return the new scope. 1319 1324 exec->uncheckedR(dst) = scope; 1320 1325 } … … 1341 1346 return; 1342 1347 1343 exec->uncheckedR(dst) = JSWithScope::create(exec, o); 1348 // FIXME: This won't work if this operation is called from the DFG or FTL. 1349 // This should be changed to pass in the old scope and return the new scope. 1350 JSScope* currentScope = exec->uncheckedR(dst).Register::scope(); 1351 exec->uncheckedR(dst) = JSWithScope::create(exec, o, currentScope); 1344 1352 } 1345 1353 -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r176109 r176479 1236 1236 execCallee->setCallerFrame(exec); 1237 1237 execCallee->uncheckedR(JSStack::Callee) = calleeAsValue; 1238 execCallee->setScope(exec->scope()); 1238 JSScope* callerScope = exec->uncheckedR(exec->codeBlock()->scopeRegister().offset()).Register::scope(); 1239 execCallee->setScope(callerScope); 1239 1240 execCallee->setReturnPC(LLInt::getCodePtr(llint_generic_return_point)); 1240 1241 execCallee->setCodeBlock(0); … … 1276 1277 LLINT_CHECK_EXCEPTION(); 1277 1278 1278 exec->uncheckedR(pc[1].u.operand) = JSWithScope::create(exec, o); 1279 int scopeReg = pc[1].u.operand; 1280 JSScope* currentScope = exec->uncheckedR(scopeReg).Register::scope(); 1281 exec->uncheckedR(scopeReg) = JSWithScope::create(exec, o, currentScope); 1279 1282 1280 1283 LLINT_END(); … … 1294 1297 LLINT_BEGIN(); 1295 1298 CodeBlock* codeBlock = exec->codeBlock(); 1299 int scopeReg = pc[1].u.operand; 1300 JSScope* currentScope = exec->uncheckedR(scopeReg).Register::scope(); 1296 1301 JSNameScope::Type type = static_cast<JSNameScope::Type>(pc[5].u.operand); 1297 JSNameScope* scope = JSNameScope::create(exec, c odeBlock->identifier(pc[2].u.operand), LLINT_OP(3).jsValue(), pc[4].u.operand, type);1298 exec->uncheckedR( pc[1].u.operand) = scope;1302 JSNameScope* scope = JSNameScope::create(exec, currentScope, codeBlock->identifier(pc[2].u.operand), LLINT_OP(3).jsValue(), pc[4].u.operand, type); 1303 exec->uncheckedR(scopeReg) = scope; 1299 1304 LLINT_END(); 1300 1305 } -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r176109 r176479 2172 2172 loadisFromInstruction(5, t2) 2173 2173 2174 loadp ScopeChain + PayloadOffset[cfr], t0 2174 loadisFromInstruction(2, t0) 2175 loadp PayloadOffset[cfr, t0, 8], t0 2175 2176 btiz t2, .resolveScopeLoopEnd 2176 2177 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r176109 r176479 2001 2001 2002 2002 macro resolveScope() 2003 loadp CodeBlock[cfr], t02004 2003 loadisFromInstruction(5, t2) 2005 loadp ScopeChain[cfr], t0 2004 loadisFromInstruction(2, t0) 2005 loadp [cfr, t0, 8], t0 2006 2006 btiz t2, .resolveScopeLoopEnd 2007 2007 -
trunk/Source/JavaScriptCore/runtime/JSNameScope.h
r176357 r176479 42 42 }; 43 43 44 static JSNameScope* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes, Type type)44 static JSNameScope* create(ExecState* exec, JSScope* currentScope, const Identifier& identifier, JSValue value, unsigned attributes, Type type) 45 45 { 46 46 VM& vm = exec->vm(); 47 JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, exec->lexicalGlobalObject(), exec->scope(), type);47 JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(vm, exec->lexicalGlobalObject(), currentScope, type); 48 48 scopeObject->finishCreation(vm, identifier, value, attributes); 49 49 return scopeObject; -
trunk/Source/JavaScriptCore/runtime/JSWithScope.h
r171939 r176479 34 34 public: 35 35 typedef JSScope Base; 36 37 static JSWithScope* create(ExecState* exec, JSObject* object)38 {39 JSWithScope* withScope = new (NotNull, allocateCell<JSWithScope>(*exec->heap())) JSWithScope(exec, object);40 withScope->finishCreation(exec->vm());41 return withScope;42 }43 36 44 37 static JSWithScope* create(ExecState* exec, JSObject* object, JSScope* next)
Note:
See TracChangeset
for help on using the changeset viewer.