Changeset 34090 in webkit for trunk/JavaScriptCore/kjs/object.cpp


Ignore:
Timestamp:
May 23, 2008, 2:28:31 PM (17 years ago)
Author:
[email protected]
Message:

2008-05-23 Geoffrey Garen <[email protected]>

Rolling back in r34085, with performance resolved.


Apparently, passing the eval function to callEval gave GCC a hernia.

Reviewed by Darin Adler, Kevin McCullough, and Oliver Hunt.


Fixed <rdar://problem/5959447> Crashes and incorrect reporting in the
JavaScript profiler

  • VM/Machine.cpp: (KJS::callEval): Made this profiler hooks slightly faster by passing in the eval function.


(KJS::Machine::unwindCallFrame): Fixed incorrect reporting / a crash
when unwinding from inside eval and/or program code: detect the
difference, and do the right thing. Also, be sure to notify the profiler
*before* deref'ing the scope chain, since the profiler uses the scope chain.

(KJS::Machine::execute): Fixed incorrect reporting / crash when calling
a JS function re-entrently: Machine::execute(FunctionBodyNode*...)
should not invoke the didExecute hook, because op_ret already does that.
Also, use the new function's ExecState when calling out to the profiler.
(Not important now, but could have become a subtle bug later.)

(KJS::Machine::privateExecute): Fixed a hard to reproduce crash when
profiling JS functions: notify the profiler *before* deref'ing the scope
chain, since the profiler uses the scope chain.

  • kjs/object.cpp: (KJS::JSObject::call): Removed these hooks, because they are now unnecessary.
  • profiler/Profile.cpp: Added a comment to explain a subtlety that only Kevin and I understood previously. (Now, the whole world can understand!)
  • profiler/Profiler.cpp: (KJS::shouldExcludeFunction): Don't exclude .call and .apply. That was a hack to fix bugs that no longer exist.

Finally, sped things up a little bit by changing the "Is the profiler
running?" check into an ASSERT, since we only call into the profiler
when it's running:

(KJS::Profiler::willExecute):
(KJS::Profiler::didExecute):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/object.cpp

    r34086 r34090  
    9292  }
    9393#endif
    94     CallData data;
    95     JSValue *ret;
    96     if (this->getCallData(data) == CallTypeJS) {
    97         // A native function will enter the VM, which will allow the profiler
    98         // to detect entry
    99         ret = callAsFunction(exec,thisObj,args);
    100     } else {
    101         Profiler** profiler = Profiler::enabledProfilerReference();
    102         if (*profiler)
    103             (*profiler)->willExecute(exec, this);
    104        
    105         ret = callAsFunction(exec,thisObj,args);
    106        
    107         if (*profiler)
    108             (*profiler)->didExecute(exec, this);
    109     }
     94  JSValue* ret = callAsFunction(exec,thisObj,args);
     95
    11096#if KJS_MAX_STACK > 0
    11197  --depth;
Note: See TracChangeset for help on using the changeset viewer.