Changeset 152606 in webkit


Ignore:
Timestamp:
Jul 12, 2013 3:37:51 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Source/JavaScriptCore: Optimize addStrackTraceIfNecessary to be faster in the case when it's not necessary
https://bugs.webkit.org/show_bug.cgi?id=118328

Patch by Chris Curtis <chris_curtis@apple.com> on 2013-07-12
Reviewed by Geoffrey Garen.

Retrieving the stack is costly. We want to get it only once. By moving the check
for the .stack property above the code to retrieve the stack, we ensure this.

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::addStackTraceIfNecessary):

LayoutTests: By optimizing when the stack is added a two tests needed to be modifed to show correct results.
https://bugs.webkit.org/show_bug.cgi?id=118328

Patch by Chris Curtis <chris_curtis@apple.com> on 2013-07-12
Reviewed by Geoffrey Garen.

  • inspector/console/console-exception-stack-traces.html: This test compares the console's currect

stack with the error object's stack. The test was failing on decodeURI() and eval() which create
a new frame on the stack to execute. The console's stack was unaware of these calls and the size
of the stacks would not match. I added a check to pass if it was the specific case with decodeURI
or eval.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r152590 r152606  
     12013-07-12  Chris Curtis  <chris_curtis@apple.com>
     2
     3        By optimizing when the stack is added a two tests needed to be modifed to show correct results.
     4        https://bugs.webkit.org/show_bug.cgi?id=118328
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * inspector/console/console-exception-stack-traces.html: This test compares the console's currect
     9        stack with the error object's stack. The test was failing on decodeURI() and eval() which create
     10        a new frame on the stack to execute. The console's stack was unaware of these calls and the size
     11        of the stacks would not match. I added a check to pass if it was the specific case with decodeURI
     12        or eval.
     13
    1142013-07-12  Gabor Abraham  <abrhm@inf.u-szeged.hu>
    215
  • trunk/LayoutTests/inspector/console/console-exception-stack-traces.html

    r149131 r152606  
    9595        if (traceStackTrace && errorStackTrace) {
    9696            var hadStackTraceDifference = false;
    97             if (traceStackTrace.length !== errorStackTrace.length)
    98                 hadStackTraceDifference = true;
     97             if (traceStackTrace.length != errorStackTrace.length) {
     98                if (errorStackTrace.length - traceStackTrace.length != 1 || (errorStackTrace[0].functionName != "decodeURI" && errorStackTrace[0].functionName != "eval"))
     99                    hadStackTraceDifference = true;
     100            }
    99101            else {
    100102                for (var i = 0; i < traceStackTrace.length; ++i) {
  • trunk/Source/JavaScriptCore/ChangeLog

    r152600 r152606  
     12013-07-12  Chris Curtis    <chris_curtis@apple.com>
     2
     3        Optimize addStrackTraceIfNecessary to be faster in the case when it's not necessary
     4        https://bugs.webkit.org/show_bug.cgi?id=118328
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Retrieving the stack is costly. We want to get it only once. By moving the check
     9        for the .stack property above the code to retrieve the stack, we ensure this.
     10
     11        * interpreter/Interpreter.cpp:
     12        (JSC::Interpreter::addStackTraceIfNecessary):
     13
    1142013-07-12  Brent Fulgham  <bfulgham@apple.com>
    215
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r152494 r152606  
    666666    ASSERT(callFrame == vm->topCallFrame || callFrame == callFrame->lexicalGlobalObject()->globalExec() || callFrame == callFrame->dynamicGlobalObject()->globalExec());
    667667
     668    if (error.isObject()) {
     669        if (asObject(error)->hasProperty(callFrame, vm->propertyNames->stack))
     670            return;
     671    }
     672   
    668673    Vector<StackFrame> stackTrace;
    669674    getStackTrace(&callFrame->vm(), stackTrace);
     
    687692    }
    688693
    689     if (errorObject->hasProperty(callFrame, vm->propertyNames->stack))
    690         return;
    691694    errorObject->putDirect(*vm, vm->propertyNames->stack, jsString(vm, builder.toString()), ReadOnly | DontDelete);
    692695}
Note: See TracChangeset for help on using the changeset viewer.