Changeset 79904 in webkit for trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
- Timestamp:
- Feb 28, 2011, 1:05:22 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r79475 r79904 77 77 78 78 // Returns the depth of the scope chain within a given call frame. 79 static int depth(CodeBlock* codeBlock, ScopeChain &sc)79 static int depth(CodeBlock* codeBlock, ScopeChainNode* sc) 80 80 { 81 81 if (!codeBlock->needsFullScopeChain()) 82 82 return 0; 83 return sc .localDepth();83 return sc->localDepth(); 84 84 } 85 85 … … 580 580 } 581 581 582 if (oldCodeBlock->needsFullScopeChain())583 scopeChain->deref();584 585 582 CallFrame* callerFrame = callFrame->callerFrame(); 586 583 if (callerFrame->hasHostCallFrameFlag()) … … 711 708 // Unwind the scope chain within the exception handler's call frame. 712 709 ScopeChainNode* scopeChain = callFrame->scopeChain(); 713 ScopeChain sc(scopeChain);714 710 int scopeDelta = 0; 715 711 if (!codeBlock->needsFullScopeChain() || codeBlock->codeType() != FunctionCode 716 712 || callFrame->uncheckedR(codeBlock->activationRegister()).jsValue()) 717 scopeDelta = depth(codeBlock, sc ) - handler->scopeDepth;713 scopeDelta = depth(codeBlock, scopeChain) - handler->scopeDepth; 718 714 ASSERT(scopeDelta >= 0); 719 715 while (scopeDelta--) … … 762 758 newCallFrame->uncheckedR(newCallFrame->hostThisRegister()) = JSValue(thisObj); 763 759 764 if (codeBlock->needsFullScopeChain()) 765 scopeChain->ref(); 766 767 DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject); 760 DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject.get()); 768 761 769 762 Profiler** profiler = Profiler::enabledProfilerReference(); … … 836 829 newCallFrame->init(newCodeBlock, 0, callDataScopeChain, callFrame->addHostCallFrameFlag(), argCount, function); 837 830 838 DynamicGlobalObjectScope globalObjectScope(newCallFrame, callDataScopeChain->globalObject );831 DynamicGlobalObjectScope globalObjectScope(newCallFrame, callDataScopeChain->globalObject.get()); 839 832 840 833 Profiler** profiler = Profiler::enabledProfilerReference(); … … 868 861 newCallFrame->init(0, 0, scopeChain, callFrame->addHostCallFrameFlag(), argCount, function); 869 862 870 DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject );863 DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject.get()); 871 864 872 865 Profiler** profiler = Profiler::enabledProfilerReference(); … … 925 918 newCallFrame->init(newCodeBlock, 0, constructDataScopeChain, callFrame->addHostCallFrameFlag(), argCount, constructor); 926 919 927 DynamicGlobalObjectScope globalObjectScope(newCallFrame, constructDataScopeChain->globalObject );920 DynamicGlobalObjectScope globalObjectScope(newCallFrame, constructDataScopeChain->globalObject.get()); 928 921 929 922 Profiler** profiler = Profiler::enabledProfilerReference(); … … 960 953 newCallFrame->init(0, 0, scopeChain, callFrame->addHostCallFrameFlag(), argCount, constructor); 961 954 962 DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject );955 DynamicGlobalObjectScope globalObjectScope(newCallFrame, scopeChain->globalObject.get()); 963 956 964 957 Profiler** profiler = Profiler::enabledProfilerReference(); … … 1077 1070 return checkedReturn(throwStackOverflowError(callFrame)); 1078 1071 1079 DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject );1072 DynamicGlobalObjectScope globalObjectScope(callFrame, scopeChain->globalObject.get()); 1080 1073 1081 1074 JSObject* compileError = eval->compile(callFrame, scopeChain); … … 1085 1078 1086 1079 JSObject* variableObject; 1087 for (ScopeChainNode* node = scopeChain; ; node = node->next ) {1080 for (ScopeChainNode* node = scopeChain; ; node = node->next.get()) { 1088 1081 ASSERT(node); 1089 1082 if (node->object->isVariableObject()) { … … 1133 1126 newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), codeBlock->m_numParameters, 0); 1134 1127 newCallFrame->uncheckedR(newCallFrame->hostThisRegister()) = JSValue(thisObj); 1135 1136 if (codeBlock->needsFullScopeChain())1137 scopeChain->ref();1138 1128 1139 1129 Profiler** profiler = Profiler::enabledProfilerReference(); … … 3806 3796 if (!function->name().isNull()) { 3807 3797 JSStaticScopeObject* functionScopeObject = new (callFrame) JSStaticScopeObject(callFrame, function->name(), func, ReadOnly | DontDelete); 3808 func->s cope().push(functionScopeObject);3798 func->setScope(*globalData, func->scope()->push(functionScopeObject)); 3809 3799 } 3810 3800 … … 3836 3826 Register* argv = newCallFrame - RegisterFile::CallFrameHeaderSize - argCount; 3837 3827 JSValue thisValue = argv[0].jsValue(); 3838 JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject ;3828 JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject.get(); 3839 3829 3840 3830 if (thisValue == globalObject && funcVal == globalObject->evalFunction()) { … … 4151 4141 int result = vPC[1].u.operand; 4152 4142 4153 if (callFrame->codeBlock()->needsFullScopeChain() && callFrame->r(codeBlock->activationRegister()).jsValue())4154 callFrame->scopeChain()->deref();4155 4156 4143 JSValue returnValue = callFrame->r(result).jsValue(); 4157 4144 … … 4192 4179 int result = vPC[1].u.operand; 4193 4180 4194 if (codeBlock->needsFullScopeChain() && callFrame->r(codeBlock->activationRegister()).jsValue())4195 callFrame->scopeChain()->deref();4196 4197 4181 JSValue returnValue = callFrame->r(result).jsValue(); 4198 4182 … … 4239 4223 JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionExecutable*>(codeBlock->ownerExecutable())); 4240 4224 callFrame->r(activationReg) = JSValue(activation); 4241 callFrame->setScopeChain(callFrame->scopeChain()-> copy()->push(activation));4225 callFrame->setScopeChain(callFrame->scopeChain()->push(activation)); 4242 4226 } 4243 4227 vPC += OPCODE_LENGTH(op_create_activation); … … 4278 4262 structure = asObject(proto)->inheritorID(); 4279 4263 else 4280 structure = constructor->scope() .node()->globalObject->emptyObjectStructure();4264 structure = constructor->scope()->globalObject->emptyObjectStructure(); 4281 4265 callFrame->uncheckedR(thisRegister) = constructEmptyObject(callFrame, structure); 4282 4266 … … 4644 4628 */ 4645 4629 4646 if (codeBlock->needsFullScopeChain()) {4647 ScopeChainNode* scopeChain = callFrame->scopeChain();4648 ASSERT(scopeChain->refCount > 1);4649 scopeChain->deref();4650 }4651 4630 int result = vPC[1].u.operand; 4652 4631 return callFrame->r(result).jsValue();
Note:
See TracChangeset
for help on using the changeset viewer.