Changeset 201766 in webkit
- Timestamp:
- Jun 7, 2016 12:51:41 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r201756 r201766 1 2016-06-07 Mark Lam <mark.lam@apple.com> 2 3 calculatedDisplayName() and friends actually need a VM& and not a ExecState/CallFrame. 4 https://bugs.webkit.org/show_bug.cgi?id=158488 5 6 Reviewed by Geoffrey Garen. 7 8 calculatedDisplayName() (and some of its friends) actually just need a VM&. 9 Their work has nothing to do with an ExecState at all. This patch will make that 10 clear by changing these functions to take a VM& arg instead of an ExecState* or 11 CallFrame*. 12 13 Also removed the JS_EXPORT_PRIVATE attribute from Interpreter::StackFrame::toString(). 14 The JS_EXPORT_PRIVATE attribute was a holdover from the days when WebInspector 15 was entirely in WebCore. It is no longer needed. 16 17 * debugger/DebuggerCallFrame.cpp: 18 (JSC::DebuggerCallFrame::functionName): 19 * inspector/JSInjectedScriptHost.cpp: 20 (Inspector::JSInjectedScriptHost::functionDetails): 21 * inspector/ScriptCallStackFactory.cpp: 22 (Inspector::createScriptCallStackFromException): 23 * interpreter/CallFrame.cpp: 24 (JSC::CallFrame::friendlyFunctionName): 25 * interpreter/Interpreter.cpp: 26 (JSC::StackFrame::friendlySourceURL): 27 (JSC::StackFrame::friendlyFunctionName): 28 (JSC::StackFrame::expressionInfo): 29 (JSC::StackFrame::toString): 30 (JSC::Interpreter::stackTraceAsString): 31 * interpreter/Interpreter.h: 32 * interpreter/StackVisitor.cpp: 33 (JSC::StackVisitor::Frame::functionName): 34 * runtime/InternalFunction.cpp: 35 (JSC::InternalFunction::name): 36 (JSC::InternalFunction::displayName): 37 (JSC::InternalFunction::getCallData): 38 (JSC::InternalFunction::calculatedDisplayName): 39 * runtime/InternalFunction.h: 40 (JSC::InternalFunction::createStructure): 41 * runtime/JSFunction.cpp: 42 (JSC::JSFunction::name): 43 (JSC::JSFunction::displayName): 44 (JSC::JSFunction::calculatedDisplayName): 45 (JSC::JSFunction::getConstructData): 46 (JSC::getCalculatedDisplayName): 47 * runtime/JSFunction.h: 48 (JSC::JSFunction::executable): 49 * runtime/JSObject.cpp: 50 (JSC::JSObject::calculatedClassName): 51 1 52 2016-06-07 Yusuke Suzuki <utatane.tea@gmail.com> 2 53 -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
r201473 r201766 139 139 if (isTailDeleted()) { 140 140 if (JSFunction* func = jsDynamicCast<JSFunction*>(m_shadowChickenFrame.callee)) 141 return func->calculatedDisplayName(m_validMachineFrame );141 return func->calculatedDisplayName(m_validMachineFrame->vm()); 142 142 return m_shadowChickenFrame.codeBlock->inferredName().data(); 143 143 } -
trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp
r200746 r201766 221 221 columnNumber -= 1; 222 222 223 VM& vm = exec->vm(); 223 224 String scriptID = String::number(sourceCode->provider()->asID()); 224 225 JSObject* location = constructEmptyObject(exec); 225 location->putDirect( exec->vm(), Identifier::fromString(exec, "scriptId"), jsString(exec, scriptID));226 location->putDirect( exec->vm(), Identifier::fromString(exec, "lineNumber"), jsNumber(lineNumber));227 location->putDirect( exec->vm(), Identifier::fromString(exec, "columnNumber"), jsNumber(columnNumber));226 location->putDirect(vm, Identifier::fromString(exec, "scriptId"), jsString(exec, scriptID)); 227 location->putDirect(vm, Identifier::fromString(exec, "lineNumber"), jsNumber(lineNumber)); 228 location->putDirect(vm, Identifier::fromString(exec, "columnNumber"), jsNumber(columnNumber)); 228 229 229 230 JSObject* result = constructEmptyObject(exec); 230 result->putDirect( exec->vm(), Identifier::fromString(exec, "location"), location);231 result->putDirect(vm, Identifier::fromString(exec, "location"), location); 231 232 232 233 String name = function->name(); 233 234 if (!name.isEmpty()) 234 result->putDirect( exec->vm(), Identifier::fromString(exec, "name"), jsString(exec, name));235 236 String displayName = function->displayName( exec);235 result->putDirect(vm, Identifier::fromString(exec, "name"), jsString(exec, name)); 236 237 String displayName = function->displayName(vm); 237 238 if (!displayName.isEmpty()) 238 result->putDirect( exec->vm(), Identifier::fromString(exec, "displayName"), jsString(exec, displayName));239 result->putDirect(vm, Identifier::fromString(exec, "displayName"), jsString(exec, displayName)); 239 240 240 241 // FIXME: provide function scope data in "scopesRaw" property when JSC supports it. -
trunk/Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp
r199852 r201766 139 139 Vector<ScriptCallFrame> frames; 140 140 RefCountedArray<StackFrame> stackTrace = exception->stack(); 141 VM& vm = exec->vm(); 141 142 for (size_t i = 0; i < stackTrace.size() && i < maxStackSize; i++) { 142 143 unsigned line; 143 144 unsigned column; 144 145 stackTrace[i].computeLineAndColumn(line, column); 145 String functionName = stackTrace[i].friendlyFunctionName( exec);146 String functionName = stackTrace[i].friendlyFunctionName(vm); 146 147 frames.append(ScriptCallFrame(functionName, stackTrace[i].friendlySourceURL(), static_cast<SourceID>(stackTrace[i].sourceID), line, column)); 147 148 } -
trunk/Source/JavaScriptCore/interpreter/CallFrame.cpp
r196658 r201766 230 230 case FunctionCode: 231 231 if (callee()) 232 return getCalculatedDisplayName( this, callee());232 return getCalculatedDisplayName(vm(), callee()); 233 233 return emptyString(); 234 234 } -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r201703 r201766 107 107 } 108 108 109 String StackFrame::friendlyFunctionName( CallFrame* callFrame) const109 String StackFrame::friendlyFunctionName(VM& vm) const 110 110 { 111 111 String traceLine; … … 121 121 case StackFrameNativeCode: 122 122 if (callee) 123 traceLine = getCalculatedDisplayName( callFrame, stackFrameCallee).impl();123 traceLine = getCalculatedDisplayName(vm, stackFrameCallee).impl(); 124 124 break; 125 125 case StackFrameFunctionCode: 126 traceLine = getCalculatedDisplayName( callFrame, stackFrameCallee).impl();126 traceLine = getCalculatedDisplayName(vm, stackFrameCallee).impl(); 127 127 break; 128 128 case StackFrameGlobalCode: … … 497 497 } 498 498 499 String StackFrame::toString( CallFrame* callFrame)499 String StackFrame::toString(VM& vm) 500 500 { 501 501 StringBuilder traceBuild; 502 String functionName = friendlyFunctionName( callFrame);502 String functionName = friendlyFunctionName(vm); 503 503 String sourceURL = friendlySourceURL(); 504 504 traceBuild.append(functionName); … … 594 594 // FIXME: JSStringJoiner could be more efficient than StringBuilder here. 595 595 StringBuilder builder; 596 VM& vm = exec->vm(); 596 597 for (unsigned i = 0; i < stackTrace.size(); i++) { 597 builder.append(String(stackTrace[i].toString( exec)));598 builder.append(String(stackTrace[i].toString(vm))); 598 599 if (i != stackTrace.size() - 1) 599 600 builder.append('\n'); -
trunk/Source/JavaScriptCore/interpreter/Interpreter.h
r200879 r201766 96 96 String sourceURL; 97 97 intptr_t sourceID; 98 JS_EXPORT_PRIVATE String toString(CallFrame*);98 String toString(VM&); 99 99 String friendlySourceURL() const; 100 String friendlyFunctionName( CallFrame*) const;100 String friendlyFunctionName(VM&) const; 101 101 JS_EXPORT_PRIVATE void computeLineAndColumn(unsigned& line, unsigned& column); 102 102 -
trunk/Source/JavaScriptCore/interpreter/StackVisitor.cpp
r201641 r201766 224 224 case CodeType::Native: 225 225 if (callee) 226 traceLine = getCalculatedDisplayName(callFrame() , callee).impl();226 traceLine = getCalculatedDisplayName(callFrame()->vm(), callee).impl(); 227 227 break; 228 228 case CodeType::Function: 229 traceLine = getCalculatedDisplayName(callFrame() , callee).impl();229 traceLine = getCalculatedDisplayName(callFrame()->vm(), callee).impl(); 230 230 break; 231 231 case CodeType::Global: -
trunk/Source/JavaScriptCore/runtime/InternalFunction.cpp
r201495 r201766 66 66 } 67 67 68 const String InternalFunction::displayName( ExecState* exec)68 const String InternalFunction::displayName(VM& vm) 69 69 { 70 JSValue displayName = getDirect( exec->vm(), exec->vm().propertyNames->displayName);70 JSValue displayName = getDirect(vm, vm.propertyNames->displayName); 71 71 72 72 if (displayName && isJSString(displayName)) … … 82 82 } 83 83 84 const String InternalFunction::calculatedDisplayName( ExecState* exec)84 const String InternalFunction::calculatedDisplayName(VM& vm) 85 85 { 86 const String explicitName = displayName( exec);86 const String explicitName = displayName(vm); 87 87 88 88 if (!explicitName.isEmpty()) -
trunk/Source/JavaScriptCore/runtime/InternalFunction.h
r200430 r201766 42 42 43 43 JS_EXPORT_PRIVATE const String& name(); 44 const String displayName( ExecState*);45 const String calculatedDisplayName( ExecState*);44 const String displayName(VM&); 45 const String calculatedDisplayName(VM&); 46 46 47 47 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto) -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r201703 r201766 179 179 } 180 180 181 String JSFunction::displayName( ExecState* exec)182 { 183 JSValue displayName = getDirect( exec->vm(), exec->vm().propertyNames->displayName);181 String JSFunction::displayName(VM& vm) 182 { 183 JSValue displayName = getDirect(vm, vm.propertyNames->displayName); 184 184 185 185 if (displayName && isJSString(displayName)) … … 189 189 } 190 190 191 const String JSFunction::calculatedDisplayName( ExecState* exec)192 { 193 const String explicitName = displayName( exec);191 const String JSFunction::calculatedDisplayName(VM& vm) 192 { 193 const String explicitName = displayName(vm); 194 194 195 195 if (!explicitName.isEmpty()) … … 557 557 } 558 558 559 String getCalculatedDisplayName( CallFrame* callFrame, JSObject* object)559 String getCalculatedDisplayName(VM& vm, JSObject* object) 560 560 { 561 561 if (JSFunction* function = jsDynamicCast<JSFunction*>(object)) 562 return function->calculatedDisplayName( callFrame);562 return function->calculatedDisplayName(vm); 563 563 if (InternalFunction* function = jsDynamicCast<InternalFunction*>(object)) 564 return function->calculatedDisplayName( callFrame);564 return function->calculatedDisplayName(vm); 565 565 return emptyString(); 566 566 } -
trunk/Source/JavaScriptCore/runtime/JSFunction.h
r201703 r201766 50 50 JS_EXPORT_PRIVATE EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*); 51 51 52 JS_EXPORT_PRIVATE String getCalculatedDisplayName( CallFrame*, JSObject*);52 JS_EXPORT_PRIVATE String getCalculatedDisplayName(VM&, JSObject*); 53 53 54 54 class JSFunction : public JSCallee { … … 83 83 84 84 JS_EXPORT_PRIVATE String name(); 85 JS_EXPORT_PRIVATE String displayName( ExecState*);86 const String calculatedDisplayName( ExecState*);85 JS_EXPORT_PRIVATE String displayName(VM&); 86 const String calculatedDisplayName(VM&); 87 87 88 88 ExecutableBase* executable() const { return m_executable.get(); } -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r201654 r201766 320 320 if (JSCell* constructorCell = constructorValue.asCell()) { 321 321 if (JSObject* ctorObject = constructorCell->getObject()) { 322 VM& vm = exec->vm(); 322 323 if (JSFunction* constructorFunction = jsDynamicCast<JSFunction*>(ctorObject)) 323 prototypeFunctionName = constructorFunction->calculatedDisplayName( exec);324 prototypeFunctionName = constructorFunction->calculatedDisplayName(vm); 324 325 else if (InternalFunction* constructorFunction = jsDynamicCast<InternalFunction*>(ctorObject)) 325 prototypeFunctionName = constructorFunction->calculatedDisplayName( exec);326 prototypeFunctionName = constructorFunction->calculatedDisplayName(vm); 326 327 } 327 328 }
Note: See TracChangeset
for help on using the changeset viewer.