Changeset 109568 in webkit


Ignore:
Timestamp:
Mar 2, 2012 5:48:58 AM (12 years ago)
Author:
yurys@chromium.org
Message:

Web Inspector: assertion failure in JSMainThreadExecState::instrumentedCall
https://bugs.webkit.org/show_bug.cgi?id=80152

Extracted common code of JS call instrumentation into instrumentFunctionCall method
and call it directly where the instrumentation is needed instead of calling
JSMainThreadExecState::instrumentedCall which works on the main thread only.

Reviewed by Pavel Feldman.

  • bindings/js/JSCallbackData.cpp:

(WebCore::JSCallbackData::invokeCallback):

  • bindings/js/JSEventListener.cpp:

(WebCore::JSEventListener::handleEvent):

  • bindings/js/JSMainThreadExecState.h:

(WebCore::JSMainThreadExecState::instrumentFunctionCall):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109565 r109568  
     12012-03-02  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: assertion failure in JSMainThreadExecState::instrumentedCall
     4        https://bugs.webkit.org/show_bug.cgi?id=80152
     5
     6        Extracted common code of JS call instrumentation into instrumentFunctionCall method
     7        and call it directly where the instrumentation is needed instead of calling
     8        JSMainThreadExecState::instrumentedCall which works on the main thread only.
     9
     10        Reviewed by Pavel Feldman.
     11
     12        * bindings/js/JSCallbackData.cpp:
     13        (WebCore::JSCallbackData::invokeCallback):
     14        * bindings/js/JSEventListener.cpp:
     15        (WebCore::JSEventListener::handleEvent):
     16        * bindings/js/JSMainThreadExecState.h:
     17        (WebCore::JSMainThreadExecState::instrumentFunctionCall):
     18
    1192012-03-02  Yoshifumi Inoue  <yosin@chromium.org>
    220
  • trunk/Source/WebCore/bindings/js/JSCallbackData.cpp

    r109540 r109568  
    6666
    6767    globalObject()->globalData().timeoutChecker.start();
     68    InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(context, callType, callData);
    6869
    69     JSValue result = JSMainThreadExecState::instrumentedCall(context, exec, function, callType, callData, callback(), args);
     70    bool contextIsDocument = context->isDocument();
     71    JSValue result = contextIsDocument
     72        ? JSMainThreadExecState::call(exec, function, callType, callData, callback(), args)
     73        : JSC::call(exec, function, callType, callData, callback(), args);
    7074
     75    InspectorInstrumentation::didCallFunction(cookie);
    7176    globalObject()->globalData().timeoutChecker.stop();
    7277
    73     if (context->isDocument())
     78    if (contextIsDocument)
    7479        Document::updateStyleForAllDocuments();
    7580
  • trunk/Source/WebCore/bindings/js/JSEventListener.cpp

    r109540 r109568  
    122122
    123123        globalData.timeoutChecker.start();
     124        InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(scriptExecutionContext, callType, callData);
     125
    124126        JSValue thisValue = handleEventFunction == jsFunction ? toJS(exec, globalObject, event->currentTarget()) : jsFunction;
    125         JSValue retval = JSMainThreadExecState::instrumentedCall(scriptExecutionContext, exec, handleEventFunction, callType, callData, thisValue, args);
     127        JSValue retval = scriptExecutionContext->isDocument()
     128            ? JSMainThreadExecState::call(exec, handleEventFunction, callType, callData, thisValue, args)
     129            : JSC::call(exec, handleEventFunction, callType, callData, thisValue, args);
     130
     131        InspectorInstrumentation::didCallFunction(cookie);
    126132        globalData.timeoutChecker.stop();
    127133
  • trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h

    r109540 r109568  
    5757    };
    5858
    59     static JSC::JSValue instrumentedCall(ScriptExecutionContext* context, JSC::ExecState* exec, JSC::JSValue functionObject, JSC::CallType callType, const JSC::CallData& callData, JSC::JSValue thisValue, const JSC::ArgList& args)
     59    static inline InspectorInstrumentationCookie instrumentFunctionCall(ScriptExecutionContext* context, JSC::CallType callType, const JSC::CallData& callData)
    6060    {
    61         InspectorInstrumentationCookie cookie;
    62         if (InspectorInstrumentation::hasFrontends()) {
    63             String resourceName;
    64             int lineNumber = 1;
    65 
    66             if (callType == JSC::CallTypeJS) {
    67                 resourceName = ustringToString(callData.js.functionExecutable->sourceURL());
    68                 lineNumber = callData.js.functionExecutable->lineNo();
    69             } else
    70                 resourceName = "undefined";
    71 
    72             cookie = InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber);
    73         }
    74 
    75         JSC::JSValue value = call(exec, functionObject, callType, callData, thisValue, args);
    76 
    77         InspectorInstrumentation::didCallFunction(cookie);
    78 
    79         return value;
    80     };
     61        if (!InspectorInstrumentation::hasFrontends())
     62            return InspectorInstrumentationCookie();
     63        String resourceName;
     64        int lineNumber = 1;
     65        if (callType == JSC::CallTypeJS) {
     66            resourceName = ustringToString(callData.js.functionExecutable->sourceURL());
     67            lineNumber = callData.js.functionExecutable->lineNo();
     68        } else
     69            resourceName = "undefined";
     70        return InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber);
     71    }
    8172
    8273    static JSC::JSValue evaluate(JSC::ExecState* exec, JSC::ScopeChainNode* chain, const JSC::SourceCode& source, JSC::JSValue thisValue, JSC::JSValue* exception)
Note: See TracChangeset for help on using the changeset viewer.