Changeset 59811 in webkit
- Timestamp:
- May 19, 2010, 7:38:01 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r59801 r59811 1 2010-05-19 Gavin Barraclough <[email protected]> 2 3 Reviewed by Oliver Hunt. 4 5 Bug 39393 - JSFunction need not be a subclass of InternalFunction. 6 7 re-landing r59800. 8 9 * JavaScriptCore.exp: 10 * interpreter/Interpreter.cpp: 11 (JSC::Interpreter::retrieveCaller): 12 (JSC::Interpreter::findFunctionCallFrame): 13 * interpreter/Interpreter.h: 14 * profiler/Profiler.cpp: 15 (JSC::Profiler::createCallIdentifier): 16 * runtime/FunctionPrototype.cpp: 17 (JSC::functionProtoFuncToString): 18 * runtime/JSFunction.cpp: 19 (JSC::): 20 (JSC::JSFunction::JSFunction): 21 (JSC::JSFunction::name): 22 (JSC::JSFunction::displayName): 23 (JSC::JSFunction::calculatedDisplayName): 24 * runtime/JSFunction.h: 25 * runtime/JSObject.cpp: 26 (JSC::JSObject::putDirectFunction): 27 (JSC::JSObject::putDirectFunctionWithoutTransition): 28 * runtime/JSObject.h: 29 * runtime/Lookup.cpp: 30 (JSC::setUpStaticFunctionSlot): 31 1 32 2010-05-19 Gavin Barraclough <[email protected]> 2 33 -
trunk/JavaScriptCore/JavaScriptCore.exp
r59801 r59811 110 110 __ZN3JSC10Identifier4fromEPNS_9ExecStateEj 111 111 __ZN3JSC10Identifier5equalEPKN7WebCore10StringImplEPKc 112 __ZN3JSC10JSFunction4infoE 113 __ZN3JSC10JSFunction4nameEPNS_9ExecStateE 112 114 __ZN3JSC10JSFunctionC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESA_RKNS_7ArgListEE 113 115 __ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeE … … 265 267 __ZN3JSC8JSObject17createInheritorIDEv 266 268 __ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb 269 __ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_10JSFunctionEj 267 270 __ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_16InternalFunctionEj 268 271 __ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj … … 453 456 __ZN7WebCoreplERKNS_6StringES2_ 454 457 __ZNK3JSC10JSFunction23isHostFunctionNonInlineEv 455 __ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_1 6InternalFunctionE458 __ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_10JSFunctionE 456 459 __ZNK3JSC11Interpreter18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_7JSValueE 457 460 __ZNK3JSC12PropertySlot14functionGetterEPNS_9ExecStateE -
trunk/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r59526 r59811 246 246 ?resolveRope@JSString@JSC@@ABEXPAVExecState@2@@Z 247 247 ?restoreAll@Profile@JSC@@QAEXXZ 248 ?retrieveCaller@Interpreter@JSC@@QBE?AVJSValue@2@PAVExecState@2@PAVInternalFunction@2@@Z249 248 ?retrieveLastCaller@Interpreter@JSC@@QBEXPAVExecState@2@AAH1AAVUString@2@AAVJSValue@2@@Z 250 249 ?setAccessorDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@0I@Z -
trunk/JavaScriptCore/interpreter/Interpreter.cpp
r59801 r59811 4425 4425 } 4426 4426 4427 JSValue Interpreter::retrieveCaller(CallFrame* callFrame, InternalFunction* function) const4427 JSValue Interpreter::retrieveCaller(CallFrame* callFrame, JSFunction* function) const 4428 4428 { 4429 4429 CallFrame* functionCallFrame = findFunctionCallFrame(callFrame, function); … … 4463 4463 } 4464 4464 4465 CallFrame* Interpreter::findFunctionCallFrame(CallFrame* callFrame, InternalFunction* function)4465 CallFrame* Interpreter::findFunctionCallFrame(CallFrame* callFrame, JSFunction* function) 4466 4466 { 4467 4467 for (CallFrame* candidate = callFrame; candidate; candidate = candidate->callerFrame()->removeHostCallFrameFlag()) { -
trunk/JavaScriptCore/interpreter/Interpreter.h
r59801 r59811 45 45 class EvalExecutable; 46 46 class FunctionExecutable; 47 class InternalFunction;48 47 class JSFunction; 49 48 class JSGlobalObject; … … 102 101 103 102 JSValue retrieveArguments(CallFrame*, JSFunction*) const; 104 JSValue retrieveCaller(CallFrame*, InternalFunction*) const;103 JSValue retrieveCaller(CallFrame*, JSFunction*) const; 105 104 void retrieveLastCaller(CallFrame*, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValue& function) const; 106 105 … … 144 143 static ALWAYS_INLINE CallFrame* slideRegisterWindowForCall(CodeBlock*, RegisterFile*, CallFrame*, size_t registerOffset, int argc); 145 144 146 static CallFrame* findFunctionCallFrame(CallFrame*, InternalFunction*);145 static CallFrame* findFunctionCallFrame(CallFrame*, JSFunction*); 147 146 148 147 JSValue privateExecute(ExecutionFlag, RegisterFile*, CallFrame*, JSValue* exception); -
trunk/JavaScriptCore/profiler/Profiler.cpp
r59801 r59811 33 33 #include "CallFrame.h" 34 34 #include "CodeBlock.h" 35 #include "InternalFunction.h" 35 36 #include "JSFunction.h" 36 37 #include "JSGlobalObject.h" … … 147 148 return createCallIdentifierFromFunctionImp(exec, function); 148 149 } 150 if (asObject(functionValue)->inherits(&JSFunction::info)) 151 return CallIdentifier(static_cast<JSFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber); 149 152 if (asObject(functionValue)->inherits(&InternalFunction::info)) 150 153 return CallIdentifier(static_cast<InternalFunction*>(asObject(functionValue))->name(exec), defaultSourceURL, defaultLineNumber); -
trunk/JavaScriptCore/runtime/FunctionPrototype.cpp
r59801 r59811 88 88 if (thisValue.inherits(&JSFunction::info)) { 89 89 JSFunction* function = asFunction(thisValue); 90 if ( !function->isHostFunction()) {91 FunctionExecutable* executable = function->jsExecutable();92 UString sourceString = executable->source().toString();93 insertSemicolonIfNeeded(sourceString);94 return jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ",sourceString);95 }90 if (function->isHostFunction()) 91 return jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}"); 92 FunctionExecutable* executable = function->jsExecutable(); 93 UString sourceString = executable->source().toString(); 94 insertSemicolonIfNeeded(sourceString); 95 return jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString); 96 96 } 97 97 -
trunk/JavaScriptCore/runtime/JSFunction.cpp
r59801 r59811 44 44 ASSERT_CLASS_FITS_IN_CELL(JSFunction); 45 45 46 const ClassInfo JSFunction::info = { "Function", &InternalFunction::info, 0, 0 };46 const ClassInfo JSFunction::info = { "Function", 0, 0, 0 }; 47 47 48 48 bool JSFunction::isHostFunctionNonInline() const … … 59 59 60 60 JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, PassRefPtr<NativeExecutable> thunk) 61 : Base( &exec->globalData(), structure, name)61 : Base(structure) 62 62 #if ENABLE(JIT) 63 63 , m_executable(thunk) … … 65 65 , m_scopeChain(NoScopeChain()) 66 66 { 67 putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); 67 68 #if ENABLE(JIT) 68 69 putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); … … 75 76 76 77 JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func) 77 : Base( &exec->globalData(), structure, name)78 : Base(structure) 78 79 #if ENABLE(JIT) 79 80 , m_executable(exec->globalData().getHostFunction(func)) … … 81 82 , m_scopeChain(NoScopeChain()) 82 83 { 84 putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); 83 85 #if ENABLE(JIT) 84 86 putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); … … 91 93 92 94 JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<FunctionExecutable> executable, ScopeChainNode* scopeChainNode) 93 : Base( &exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), executable->name())95 : Base(exec->lexicalGlobalObject()->functionStructure()) 94 96 , m_executable(executable) 95 97 , m_scopeChain(scopeChainNode) 96 98 { 99 const Identifier& name = static_cast<FunctionExecutable*>(m_executable.get())->name(); 100 putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); 97 101 } 98 102 … … 115 119 } 116 120 121 const UString& JSFunction::name(ExecState* exec) 122 { 123 return asString(getDirect(exec->globalData().propertyNames->name))->value(exec); 124 } 125 126 const UString JSFunction::displayName(ExecState* exec) 127 { 128 JSValue displayName = getDirect(exec->globalData().propertyNames->displayName); 129 130 if (displayName && isJSString(&exec->globalData(), displayName)) 131 return asString(displayName)->value(exec); 132 133 return UString::null(); 134 } 135 136 const UString JSFunction::calculatedDisplayName(ExecState* exec) 137 { 138 const UString explicitName = displayName(exec); 139 140 if (!explicitName.isEmpty()) 141 return explicitName; 142 143 return name(exec); 144 } 145 117 146 void JSFunction::markChildren(MarkStack& markStack) 118 147 { -
trunk/JavaScriptCore/runtime/JSFunction.h
r59801 r59811 25 25 #define JSFunction_h 26 26 27 #include " InternalFunction.h"27 #include "JSObject.h" 28 28 29 29 namespace JSC { … … 36 36 class NativeExecutable; 37 37 38 class JSFunction : public InternalFunction{38 class JSFunction : public JSObject { 39 39 friend class JIT; 40 40 friend class JSGlobalData; 41 41 42 typedef InternalFunctionBase;42 typedef JSObject Base; 43 43 44 44 public: … … 50 50 JSObject* construct(ExecState*, const ArgList&); 51 51 JSValue call(ExecState*, JSValue thisValue, const ArgList&); 52 53 const UString& name(ExecState*); 54 const UString displayName(ExecState*); 55 const UString calculatedDisplayName(ExecState*); 52 56 53 57 ScopeChain& scope() … … 81 85 82 86 protected: 83 const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | InternalFunction::StructureFlags;87 const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags; 84 88 85 89 private: -
trunk/JavaScriptCore/runtime/JSObject.cpp
r59801 r59811 28 28 #include "ErrorConstructor.h" 29 29 #include "GetterSetter.h" 30 #include "JSFunction.h" 30 31 #include "JSGlobalObject.h" 31 32 #include "NativeErrorConstructor.h" … … 510 511 } 511 512 513 void JSObject::putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr) 514 { 515 putDirectFunction(Identifier(exec, function->name(exec)), function, attr); 516 } 517 512 518 void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr) 519 { 520 putDirectFunctionWithoutTransition(Identifier(exec, function->name(exec)), function, attr); 521 } 522 523 void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* function, unsigned attr) 513 524 { 514 525 putDirectFunctionWithoutTransition(Identifier(exec, function->name(exec)), function, attr); -
trunk/JavaScriptCore/runtime/JSObject.h
r59801 r59811 177 177 void putDirectFunction(const Identifier& propertyName, JSCell* value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot); 178 178 void putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr = 0); 179 void putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr = 0); 179 180 180 181 void putDirectWithoutTransition(const Identifier& propertyName, JSValue value, unsigned attr = 0); 181 182 void putDirectFunctionWithoutTransition(const Identifier& propertyName, JSCell* value, unsigned attr = 0); 182 183 void putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr = 0); 184 void putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* function, unsigned attr = 0); 183 185 184 186 // Fast access to known property offsets. -
trunk/JavaScriptCore/runtime/Lookup.cpp
r59801 r59811 76 76 77 77 if (!location) { 78 InternalFunction* function;78 NativeFunctionWrapper* function; 79 79 #if ENABLE(JIT) 80 80 if (entry->generator()) -
trunk/WebCore/ChangeLog
r59797 r59811 1 2010-05-19 Gavin Barraclough <[email protected]> 2 3 Rubber Stamped by Sam Weinig. 4 5 JSFunctions are no longer a subclass of InternalFunction. 6 7 * bindings/js/ScriptCallStack.cpp: 8 (WebCore::ScriptCallStack::ScriptCallStack): 9 (WebCore::ScriptCallStack::initialize): 10 * bindings/js/ScriptCallStack.h: 11 1 12 2010-05-19 Jian Li <[email protected]> 2 13 -
trunk/WebCore/bindings/js/ScriptCallStack.cpp
r57231 r59811 34 34 #include <interpreter/CallFrame.h> 35 35 #include <interpreter/Interpreter.h> 36 #include <runtime/ InternalFunction.h>36 #include <runtime/JSFunction.h> 37 37 #include <runtime/JSValue.h> 38 38 #include <runtime/UString.h> … … 58 58 59 59 if (function) { 60 m_caller = as InternalFunction(function);60 m_caller = asFunction(function); 61 61 m_frames.append(ScriptCallFrame(m_caller->name(m_exec), urlString, lineNumber, args, skipArgumentCount)); 62 62 } else { … … 94 94 JSValue func = m_exec->interpreter()->retrieveCaller(m_exec, m_caller); 95 95 while (!func.isNull()) { 96 InternalFunction* internalFunction = asInternalFunction(func);96 JSFunction* jsFunction = asFunction(func); 97 97 ArgList emptyArgList; 98 m_frames.append(ScriptCallFrame( internalFunction->name(m_exec), UString(), 0, emptyArgList, 0));99 func = m_exec->interpreter()->retrieveCaller(m_exec, internalFunction);98 m_frames.append(ScriptCallFrame(jsFunction->name(m_exec), UString(), 0, emptyArgList, 0)); 99 func = m_exec->interpreter()->retrieveCaller(m_exec, jsFunction); 100 100 } 101 101 m_initialized = true; -
trunk/WebCore/bindings/js/ScriptCallStack.h
r57231 r59811 62 62 JSC::ExecState* m_exec; 63 63 Vector<ScriptCallFrame> m_frames; 64 JSC:: InternalFunction* m_caller;64 JSC::JSFunction* m_caller; 65 65 }; 66 66
Note:
See TracChangeset
for help on using the changeset viewer.