Changeset 47412 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Aug 17, 2009, 10:34:52 PM (16 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 1 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Arguments.h
r47404 r47412 117 117 function = callFrame->callee(); 118 118 119 CodeBlock* codeBlock = &function-> body()->generatedBytecode();119 CodeBlock* codeBlock = &function->executable()->generatedBytecode(); 120 120 int numParameters = codeBlock->m_numParameters; 121 121 argc = callFrame->argumentCount(); … … 140 140 getArgumentsData(callFrame, callee, firstParameterIndex, argv, numArguments); 141 141 142 d->numParameters = callee-> body()->parameterCount();142 d->numParameters = callee->executable()->parameterCount(); 143 143 d->firstParameterIndex = firstParameterIndex; 144 144 d->numArguments = numArguments; … … 171 171 , d(new ArgumentsData) 172 172 { 173 ASSERT(!callFrame->callee()-> body()->parameterCount());173 ASSERT(!callFrame->callee()->executable()->parameterCount()); 174 174 175 175 unsigned numArguments = callFrame->argumentCount() - 1; … … 217 217 ASSERT(!d()->registerArray); 218 218 219 size_t numParametersMinusThis = d()->function Body->generatedBytecode().m_numParameters - 1;220 size_t numVars = d()->function Body->generatedBytecode().m_numVars;219 size_t numParametersMinusThis = d()->functionExecutable->generatedBytecode().m_numParameters - 1; 220 size_t numVars = d()->functionExecutable->generatedBytecode().m_numVars; 221 221 size_t numLocals = numVars + numParametersMinusThis; 222 222 -
trunk/JavaScriptCore/runtime/ArrayPrototype.cpp
r47288 r47412 76 76 // If the JIT is enabled then we need to preserve the invariant that every 77 77 // function with a CodeBlock also has JIT code. 78 callData.js.function Body->jitCode(callData.js.scopeChain);79 CodeBlock& codeBlock = callData.js.function Body->generatedBytecode();78 callData.js.functionExecutable->jitCode(callData.js.scopeChain); 79 CodeBlock& codeBlock = callData.js.functionExecutable->generatedBytecode(); 80 80 #else 81 CodeBlock& codeBlock = callData.js.function Body->bytecode(callData.js.scopeChain);81 CodeBlock& codeBlock = callData.js.functionExecutable->bytecode(callData.js.scopeChain); 82 82 #endif 83 83 -
trunk/JavaScriptCore/runtime/CallData.h
r43372 r47412 36 36 class ArgList; 37 37 class ExecState; 38 class Function BodyNode;38 class FunctionExecutable; 39 39 class JSObject; 40 40 class JSValue; … … 54 54 } native; 55 55 struct { 56 Function BodyNode* functionBody;56 FunctionExecutable* functionExecutable; 57 57 ScopeChainNode* scopeChain; 58 58 } js; -
trunk/JavaScriptCore/runtime/Collector.cpp
r47284 r47412 1139 1139 m_globalData->interpreter->registerFile().markCallFrames(markStack, this); 1140 1140 m_globalData->smallStrings.mark(); 1141 if (m_globalData-> scopeNodeBeingReparsed)1142 m_globalData-> scopeNodeBeingReparsed->markAggregate(markStack);1141 if (m_globalData->functionCodeBlockBeingReparsed) 1142 m_globalData->functionCodeBlockBeingReparsed->markAggregate(markStack); 1143 1143 if (m_globalData->firstStringifierToMark) 1144 1144 JSONObject::markStringifiers(markStack, m_globalData->firstStringifierToMark); -
trunk/JavaScriptCore/runtime/ConstructData.h
r43122 r47412 34 34 class ArgList; 35 35 class ExecState; 36 class Function BodyNode;36 class FunctionExecutable; 37 37 class JSObject; 38 38 class JSValue; … … 52 52 } native; 53 53 struct { 54 Function BodyNode* functionBody;54 FunctionExecutable* functionExecutable; 55 55 ScopeChainNode* scopeChain; 56 56 } js; -
trunk/JavaScriptCore/runtime/ExceptionHelpers.cpp
r43122 r47412 75 75 UString message = "Can't find variable: "; 76 76 message.append(ident.ustring()); 77 JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->owner Node()->sourceID(), codeBlock->ownerNode()->sourceURL());77 JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); 78 78 exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); 79 79 exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); … … 137 137 int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset); 138 138 UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, message); 139 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->owner Node()->sourceID(), codeBlock->ownerNode()->sourceURL());139 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); 140 140 exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); 141 141 exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); … … 158 158 159 159 UString errorMessage = createErrorMessage(exec, codeBlock, line, startPoint, divotPoint, value, "not a constructor"); 160 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->owner Node()->sourceID(), codeBlock->ownerNode()->sourceURL());160 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); 161 161 exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); 162 162 exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); … … 172 172 int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset); 173 173 UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, value, "not a function"); 174 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->owner Node()->sourceID(), codeBlock->ownerNode()->sourceURL());174 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); 175 175 exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); 176 176 exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); … … 202 202 int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset); 203 203 UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, error->isNull() ? jsNull() : jsUndefined(), "not an object"); 204 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->owner Node()->sourceID(), codeBlock->ownerNode()->sourceURL());204 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); 205 205 exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); 206 206 exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); -
trunk/JavaScriptCore/runtime/Executable.h
r47405 r47412 31 31 namespace JSC { 32 32 33 template<class ASTNodeType, class CodeBlockType> 34 class TemplateExecutable { 35 public: 36 TemplateExecutable(const SourceCode& source) 33 class CodeBlock; 34 class EvalCodeBlock; 35 class ProgramCodeBlock; 36 class ScopeChainNode; 37 38 struct ExceptionInfo; 39 40 class ExecutableBase { 41 friend class JIT; 42 public: 43 virtual ~ExecutableBase() {} 44 45 ExecutableBase(const SourceCode& source) 37 46 : m_source(source) 38 47 { 39 48 } 40 49 41 void markAggregate(MarkStack& markStack) 42 { 43 m_node->markAggregate(markStack); 44 } 45 50 const SourceCode& source() { return m_source; } 51 intptr_t sourceID() const { return m_node->sourceID(); } 46 52 const UString& sourceURL() const { return m_node->sourceURL(); } 47 53 int lineNo() const { return m_node->lineNo(); } 48 CodeBlockType& bytecode(ScopeChainNode* scopeChainNode) { return m_node->bytecode(scopeChainNode); } 49 50 #if ENABLE(JIT) 51 JITCode& jitCode(ScopeChainNode* scopeChainNode) { return m_node->jitCode(scopeChainNode); } 52 #endif 54 int lastLine() const { return m_node->lastLine(); } 55 56 bool usesEval() const { return m_node->usesEval(); } 57 bool usesArguments() const { return m_node->usesArguments(); } 58 bool needsActivation() const { return m_node->needsActivation(); } 59 60 virtual ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) = 0; 61 62 ScopeNode* astNode() { return m_node.get(); } 53 63 54 64 protected: 55 RefPtr< ASTNodeType> m_node;65 RefPtr<ScopeNode> m_node; 56 66 SourceCode m_source; 57 }; 58 59 class EvalExecutable : public TemplateExecutable<EvalNode, EvalCodeBlock> { 67 68 private: 69 // For use making native thunk. 70 friend class FunctionExecutable; 71 ExecutableBase() 72 { 73 } 74 75 #if ENABLE(JIT) 76 public: 77 JITCode& generatedJITCode() 78 { 79 ASSERT(m_jitCode); 80 return m_jitCode; 81 } 82 83 ExecutablePool* getExecutablePool() 84 { 85 return m_jitCode.getExecutablePool(); 86 } 87 88 protected: 89 JITCode m_jitCode; 90 #endif 91 }; 92 93 class EvalExecutable : public ExecutableBase { 60 94 public: 61 95 EvalExecutable(const SourceCode& source) 62 : TemplateExecutable<EvalNode, EvalCodeBlock>(source) 63 { 64 } 96 : ExecutableBase(source) 97 , m_evalCodeBlock(0) 98 { 99 } 100 101 ~EvalExecutable(); 65 102 66 103 JSObject* parse(ExecState* exec, bool allowDebug = true); 104 105 EvalCodeBlock& bytecode(ScopeChainNode* scopeChainNode) 106 { 107 if (!m_evalCodeBlock) 108 generateBytecode(scopeChainNode); 109 return *m_evalCodeBlock; 110 } 111 112 DeclarationStacks::VarStack& varStack() { return m_node->varStack(); } 113 114 ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*); 115 116 private: 117 EvalNode* evalNode() { return static_cast<EvalNode*>(m_node.get()); } 118 119 void generateBytecode(ScopeChainNode*); 120 121 EvalCodeBlock* m_evalCodeBlock; 122 123 #if ENABLE(JIT) 124 public: 125 JITCode& jitCode(ScopeChainNode* scopeChainNode) 126 { 127 if (!m_jitCode) 128 generateJITCode(scopeChainNode); 129 return m_jitCode; 130 } 131 132 private: 133 void generateJITCode(ScopeChainNode*); 134 #endif 67 135 }; 68 136 … … 78 146 }; 79 147 80 class ProgramExecutable : public TemplateExecutable<ProgramNode, ProgramCodeBlock>{148 class ProgramExecutable : public ExecutableBase { 81 149 public: 82 150 ProgramExecutable(const SourceCode& source) 83 : TemplateExecutable<ProgramNode, ProgramCodeBlock>(source) 84 { 85 } 151 : ExecutableBase(source) 152 , m_programCodeBlock(0) 153 { 154 } 155 156 ~ProgramExecutable(); 86 157 87 158 JSObject* parse(ExecState* exec, bool allowDebug = true); 159 160 // CodeBlocks for program code are transient and therefore to not gain from from throwing out there exception information. 161 ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) { ASSERT_NOT_REACHED(); return 0; } 162 163 ProgramCodeBlock& bytecode(ScopeChainNode* scopeChainNode) 164 { 165 if (!m_programCodeBlock) 166 generateBytecode(scopeChainNode); 167 return *m_programCodeBlock; 168 } 169 170 private: 171 ProgramNode* programNode() { return static_cast<ProgramNode*>(m_node.get()); } 172 173 void generateBytecode(ScopeChainNode*); 174 175 ProgramCodeBlock* m_programCodeBlock; 176 177 #if ENABLE(JIT) 178 public: 179 JITCode& jitCode(ScopeChainNode* scopeChainNode) 180 { 181 if (!m_jitCode) 182 generateJITCode(scopeChainNode); 183 return m_jitCode; 184 } 185 186 private: 187 void generateJITCode(ScopeChainNode*); 188 #endif 189 }; 190 191 class FunctionExecutable : public ExecutableBase, public RefCounted<FunctionExecutable> { 192 friend class JIT; 193 public: 194 FunctionExecutable(const Identifier& name, FunctionBodyNode* body) 195 : ExecutableBase(body->source()) 196 , m_codeBlock(0) 197 , m_name(name) 198 { 199 m_node = body; 200 } 201 202 ~FunctionExecutable(); 203 204 const Identifier& name() { return m_name; } 205 206 JSFunction* make(ExecState* exec, ScopeChainNode* scopeChain); 207 208 CodeBlock& bytecode(ScopeChainNode* scopeChainNode) 209 { 210 ASSERT(scopeChainNode); 211 if (!m_codeBlock) 212 generateBytecode(scopeChainNode); 213 return *m_codeBlock; 214 } 215 CodeBlock& generatedBytecode() 216 { 217 ASSERT(m_codeBlock); 218 return *m_codeBlock; 219 } 220 221 bool usesEval() const { return body()->usesEval(); } 222 bool usesArguments() const { return body()->usesArguments(); } 223 size_t parameterCount() const { return body()->parameterCount(); } 224 UString paramString() const { return body()->paramString(); } 225 226 bool isHostFunction() const; 227 bool isGenerated() const 228 { 229 return m_codeBlock; 230 } 231 232 void recompile(ExecState* exec); 233 234 ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*); 235 236 void markAggregate(MarkStack& markStack); 237 238 private: 239 FunctionBodyNode* body() const { return static_cast<FunctionBodyNode*>(m_node.get()); } 240 241 void generateBytecode(ScopeChainNode*); 242 243 CodeBlock* m_codeBlock; 244 const Identifier& m_name; 245 246 #if ENABLE(JIT) 247 public: 248 JITCode& jitCode(ScopeChainNode* scopeChainNode) 249 { 250 if (!m_jitCode) 251 generateJITCode(scopeChainNode); 252 return m_jitCode; 253 } 254 255 static PassRefPtr<FunctionExecutable> createNativeThunk(ExecState* exec) 256 { 257 return adoptRef(new FunctionExecutable(exec)); 258 } 259 260 private: 261 FunctionExecutable(ExecState* exec); 262 void generateJITCode(ScopeChainNode*); 263 #endif 88 264 }; 89 265 -
trunk/JavaScriptCore/runtime/FunctionConstructor.cpp
r47304 r47412 94 94 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 95 95 ScopeChain scopeChain(globalObject, globalObject->globalData(), exec->globalThisValue()); 96 return new (exec) JSFunction(exec, functionName, body.get(), scopeChain.node());96 return new (exec) JSFunction(exec, adoptRef(new FunctionExecutable(functionName, body.get())), scopeChain.node()); 97 97 } 98 98 -
trunk/JavaScriptCore/runtime/FunctionPrototype.cpp
r47288 r47412 87 87 if (thisValue.inherits(&JSFunction::info)) { 88 88 JSFunction* function = asFunction(thisValue); 89 Function BodyNode* body = function->body();90 if (! body->isHostFunction()) {91 UString bodySourceString = body->toSourceString();92 insertSemicolonIfNeeded( bodySourceString);93 return jsString(exec, "function " + function->name(&exec->globalData()) + "(" + body->paramString() + ") " + bodySourceString);89 FunctionExecutable* executable = function->executable(); 90 if (!executable->isHostFunction()) { 91 UString sourceString = executable->source().toString(); 92 insertSemicolonIfNeeded(sourceString); 93 return jsString(exec, "function " + function->name(&exec->globalData()) + "(" + executable->paramString() + ") " + sourceString); 94 94 } 95 95 } -
trunk/JavaScriptCore/runtime/JSActivation.cpp
r47288 r47412 40 40 const ClassInfo JSActivation::info = { "JSActivation", 0, 0, 0 }; 41 41 42 JSActivation::JSActivation(CallFrame* callFrame, PassRefPtr<Function BodyNode> functionBody)43 : Base(callFrame->globalData().activationStructure, new JSActivationData(function Body, callFrame->registers()))42 JSActivation::JSActivation(CallFrame* callFrame, PassRefPtr<FunctionExecutable> functionExecutable) 43 : Base(callFrame->globalData().activationStructure, new JSActivationData(functionExecutable, callFrame->registers())) 44 44 { 45 45 } … … 58 58 return; 59 59 60 size_t numParametersMinusThis = d()->function Body->generatedBytecode().m_numParameters - 1;60 size_t numParametersMinusThis = d()->functionExecutable->generatedBytecode().m_numParameters - 1; 61 61 62 62 size_t count = numParametersMinusThis; 63 63 markStack.appendValues(registerArray, count); 64 64 65 size_t numVars = d()->function Body->generatedBytecode().m_numVars;65 size_t numVars = d()->functionExecutable->generatedBytecode().m_numVars; 66 66 67 67 // Skip the call frame, which sits between the parameters and vars. … … 137 137 bool JSActivation::isDynamicScope() const 138 138 { 139 return d()->function Body->usesEval();139 return d()->functionExecutable->usesEval(); 140 140 } 141 141 … … 144 144 JSActivation* activation = asActivation(slot.slotBase()); 145 145 146 if (activation->d()->function Body->usesArguments()) {146 if (activation->d()->functionExecutable->usesArguments()) { 147 147 PropertySlot slot; 148 148 activation->symbolTableGet(exec->propertyNames().arguments, slot); -
trunk/JavaScriptCore/runtime/JSActivation.h
r47022 r47412 44 44 typedef JSVariableObject Base; 45 45 public: 46 JSActivation(CallFrame*, PassRefPtr<Function BodyNode>);46 JSActivation(CallFrame*, PassRefPtr<FunctionExecutable>); 47 47 virtual ~JSActivation(); 48 48 … … 71 71 private: 72 72 struct JSActivationData : public JSVariableObjectData { 73 JSActivationData(PassRefPtr<Function BodyNode> functionBody, Register* registers)74 : JSVariableObjectData(&function Body->generatedBytecode().symbolTable(), registers)75 , function Body(functionBody)73 JSActivationData(PassRefPtr<FunctionExecutable> functionExecutable, Register* registers) 74 : JSVariableObjectData(&functionExecutable->generatedBytecode().symbolTable(), registers) 75 , functionExecutable(functionExecutable) 76 76 { 77 77 } 78 78 79 RefPtr<Function BodyNode> functionBody;79 RefPtr<FunctionExecutable> functionExecutable; 80 80 }; 81 81 -
trunk/JavaScriptCore/runtime/JSFunction.cpp
r47236 r47412 48 48 inline bool JSFunction::isHostFunction() const 49 49 { 50 return m_ body && m_body->isHostFunction();50 return m_executable && m_executable->isHostFunction(); 51 51 } 52 52 … … 65 65 : Base(&exec->globalData(), structure, name) 66 66 #if ENABLE(JIT) 67 , m_ body(FunctionBodyNode::createNativeThunk(&exec->globalData()))67 , m_executable(FunctionExecutable::createNativeThunk(exec)) 68 68 #endif 69 69 { … … 78 78 } 79 79 80 JSFunction::JSFunction(ExecState* exec, const Identifier& name, PassRefPtr<FunctionBodyNode> body, ScopeChainNode* scopeChainNode)81 : Base(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), name)82 , m_ body(body)80 JSFunction::JSFunction(ExecState* exec, PassRefPtr<FunctionExecutable> executable, ScopeChainNode* scopeChainNode) 81 : Base(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), executable->name()) 82 , m_executable(executable) 83 83 { 84 84 setScopeChain(scopeChainNode); … … 91 91 // this memory is freed and may be reused (potentially for another, different JSFunction). 92 92 #if ENABLE(JIT_OPTIMIZE_CALL) 93 if (m_ body && m_body->isGenerated())94 m_ body->generatedBytecode().unlinkCallers();93 if (m_executable && m_executable->isGenerated()) 94 m_executable->generatedBytecode().unlinkCallers(); 95 95 #endif 96 96 if (!isHostFunction()) … … 101 101 { 102 102 Base::markChildren(markStack); 103 m_ body->markAggregate(markStack);103 m_executable->markAggregate(markStack); 104 104 if (!isHostFunction()) 105 105 scopeChain().markAggregate(markStack); … … 112 112 return CallTypeHost; 113 113 } 114 callData.js.function Body = m_body.get();114 callData.js.functionExecutable = m_executable.get(); 115 115 callData.js.scopeChain = scopeChain().node(); 116 116 return CallTypeJS; … … 120 120 { 121 121 ASSERT(!isHostFunction()); 122 return exec->interpreter()->execute(m_ body.get(), exec, this, thisValue.toThisObject(exec), args, scopeChain().node(), exec->exceptionSlot());122 return exec->interpreter()->execute(m_executable.get(), exec, this, thisValue.toThisObject(exec), args, scopeChain().node(), exec->exceptionSlot()); 123 123 } 124 124 … … 141 141 JSFunction* thisObj = asFunction(slot.slotBase()); 142 142 ASSERT(!thisObj->isHostFunction()); 143 return jsNumber(exec, thisObj->m_ body->parameterCount());143 return jsNumber(exec, thisObj->m_executable->parameterCount()); 144 144 } 145 145 … … 205 205 if (isHostFunction()) 206 206 return ConstructTypeNone; 207 constructData.js.function Body = m_body.get();207 constructData.js.functionExecutable = m_executable.get(); 208 208 constructData.js.scopeChain = scopeChain().node(); 209 209 return ConstructTypeJS; … … 221 221 JSObject* thisObj = new (exec) JSObject(structure); 222 222 223 JSValue result = exec->interpreter()->execute(m_ body.get(), exec, this, thisObj, args, scopeChain().node(), exec->exceptionSlot());223 JSValue result = exec->interpreter()->execute(m_executable.get(), exec, this, thisObj, args, scopeChain().node(), exec->exceptionSlot()); 224 224 if (exec->hadException() || !result.isObject()) 225 225 return thisObj; … … 227 227 } 228 228 229 void JSFunction::setBody(PassRefPtr<FunctionBodyNode> body)230 {231 m_body = body;232 }233 234 229 } // namespace JSC -
trunk/JavaScriptCore/runtime/JSFunction.h
r47236 r47412 25 25 #define JSFunction_h 26 26 27 #include "Executable.h" 27 28 #include "InternalFunction.h" 28 29 29 30 namespace JSC { 30 31 31 class FunctionBodyNode;32 32 class FunctionPrototype; 33 33 class JSActivation; … … 42 42 public: 43 43 JSFunction(ExecState*, PassRefPtr<Structure>, int length, const Identifier&, NativeFunction); 44 JSFunction(ExecState*, const Identifier&, PassRefPtr<FunctionBodyNode>, ScopeChainNode*);44 JSFunction(ExecState*, PassRefPtr<FunctionExecutable>, ScopeChainNode*); 45 45 virtual ~JSFunction(); 46 46 … … 51 51 ScopeChain& scope() { return scopeChain(); } 52 52 53 void setBody(PassRefPtr<FunctionBodyNode>); 54 FunctionBodyNode* body() const { return m_body.get(); } 53 FunctionExecutable* executable() const { return m_executable.get(); } 55 54 56 55 static JS_EXPORTDATA const ClassInfo info; … … 87 86 static JSValue lengthGetter(ExecState*, const Identifier&, const PropertySlot&); 88 87 89 RefPtr<Function BodyNode> m_body;88 RefPtr<FunctionExecutable> m_executable; 90 89 ScopeChain& scopeChain() 91 90 { … … 123 122 } 124 123 124 inline JSFunction* FunctionExecutable::make(ExecState* exec, ScopeChainNode* scopeChain) 125 { 126 return new (exec) JSFunction(exec, this, scopeChain); 127 } 128 125 129 } // namespace JSC 126 130 -
trunk/JavaScriptCore/runtime/JSGlobalData.cpp
r47304 r47412 145 145 , head(0) 146 146 , dynamicGlobalObject(0) 147 , scopeNodeBeingReparsed(0)147 , functionCodeBlockBeingReparsed(0) 148 148 , firstStringifierToMark(0) 149 149 , markStack(vptrSet.jsArrayVPtr) … … 238 238 initializingLazyNumericCompareFunction = true; 239 239 RefPtr<FunctionBodyNode> functionBody = parser->parseFunctionFromGlobalCode(exec, 0, makeSource(UString("(function (v1, v2) { return v1 - v2; })")), 0, 0); 240 lazyNumericCompareFunction = functionBody->bytecode(exec->scopeChain()).instructions(); 240 FunctionExecutable function(functionBody->ident(), functionBody.get()); 241 lazyNumericCompareFunction = function.bytecode(exec->scopeChain()).instructions(); 241 242 initializingLazyNumericCompareFunction = false; 242 243 } -
trunk/JavaScriptCore/runtime/JSGlobalData.h
r47022 r47412 46 46 namespace JSC { 47 47 48 class CodeBlock; 48 49 class CommonIdentifiers; 49 class FunctionBodyNode;50 50 class IdentifierTable; 51 51 class Interpreter; … … 54 54 class Lexer; 55 55 class Parser; 56 class ScopeNode;57 56 class Stringifier; 58 57 class Structure; … … 146 145 HashSet<JSObject*> arrayVisitedElements; 147 146 148 ScopeNode* scopeNodeBeingReparsed;147 CodeBlock* functionCodeBlockBeingReparsed; 149 148 Stringifier* firstStringifierToMark; 150 149
Note:
See TracChangeset
for help on using the changeset viewer.