Changeset 129026 in webkit


Ignore:
Timestamp:
Sep 19, 2012 11:52:18 AM (12 years ago)
Author:
haraken@chromium.org
Message:

[V8] Remove WorkerContextExecutionProxy::runScript()
https://bugs.webkit.org/show_bug.cgi?id=97060

Reviewed by Adam Barth.

To kill WorkerContextExecutionProxy, this patch removes
WorkerContextExecutionProxy::runScript() by replacing it
with ScriptRunner::runCompiledScript().

For the replacement, this patch moves TryCatch logic in
runCompiledScript() to the caller side. The reason why
we have to avoid nesting TryCatches is a V8 bug:
http://code.google.com/p/v8/issues/detail?id=2166

No tests. No change in behavior.

  • bindings/v8/ScriptController.cpp:

(WebCore::ScriptController::compileAndRunScript):

  • bindings/v8/ScriptRunner.cpp:

(WebCore::ScriptRunner::runCompiledScript):

  • bindings/v8/WorkerContextExecutionProxy.cpp:

(WebCore::WorkerContextExecutionProxy::evaluate):

  • bindings/v8/WorkerContextExecutionProxy.h:

(WorkerContextExecutionProxy):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r129024 r129026  
     12012-09-19  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Remove WorkerContextExecutionProxy::runScript()
     4        https://bugs.webkit.org/show_bug.cgi?id=97060
     5
     6        Reviewed by Adam Barth.
     7
     8        To kill WorkerContextExecutionProxy, this patch removes
     9        WorkerContextExecutionProxy::runScript() by replacing it
     10        with ScriptRunner::runCompiledScript().
     11
     12        For the replacement, this patch moves TryCatch logic in
     13        runCompiledScript() to the caller side. The reason why
     14        we have to avoid nesting TryCatches is a V8 bug:
     15        http://code.google.com/p/v8/issues/detail?id=2166
     16
     17        No tests. No change in behavior.
     18
     19        * bindings/v8/ScriptController.cpp:
     20        (WebCore::ScriptController::compileAndRunScript):
     21        * bindings/v8/ScriptRunner.cpp:
     22        (WebCore::ScriptRunner::runCompiledScript):
     23        * bindings/v8/WorkerContextExecutionProxy.cpp:
     24        (WebCore::WorkerContextExecutionProxy::evaluate):
     25        * bindings/v8/WorkerContextExecutionProxy.h:
     26        (WorkerContextExecutionProxy):
     27
    1282012-09-19  Rob Buis  <rbuis@rim.com>
    229
  • trunk/Source/WebCore/bindings/v8/ScriptController.cpp

    r128687 r129026  
    282282        RefPtr<Frame> protect(m_frame);
    283283        result = ScriptRunner::runCompiledScript(script, m_frame->document());
     284        ASSERT(!tryCatch.HasCaught() || result.IsEmpty());
    284285    }
    285286
  • trunk/Source/WebCore/bindings/v8/ScriptRunner.cpp

    r126399 r129026  
    4848    // Run the script and keep track of the current recursion depth.
    4949    v8::Local<v8::Value> result;
    50     v8::TryCatch tryCatch;
    51     tryCatch.SetVerbose(true);
    5250    {
    5351        V8RecursionScope recursionScope(context);
     
    5755    if (handleOutOfMemory())
    5856        ASSERT(result.IsEmpty());
    59 
    60     // Handle V8 internal error situation.
    61     if (tryCatch.HasCaught()) {
    62         ASSERT(result.IsEmpty());
    63         return v8::Local<v8::Value>();
    64     }
    6557
    6658    if (result.IsEmpty())
  • trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp

    r128390 r129026  
    3939#include "Event.h"
    4040#include "ScriptCallStack.h"
     41#include "ScriptRunner.h"
    4142#include "ScriptSourceCode.h"
    4243#include "SharedWorker.h"
     
    224225    v8::Local<v8::String> scriptString = v8ExternalString(script);
    225226    v8::Handle<v8::Script> compiledScript = ScriptSourceCode::compileScript(scriptString, fileName, scriptStartPosition);
    226     v8::Local<v8::Value> result = runScript(compiledScript);
     227    v8::Local<v8::Value> result = ScriptRunner::runCompiledScript(compiledScript, m_workerContext);
    227228
    228229    if (!exceptionCatcher.CanContinue()) {
     
    257258}
    258259
    259 v8::Local<v8::Value> WorkerContextExecutionProxy::runScript(v8::Handle<v8::Script> script)
    260 {
    261     if (script.IsEmpty())
    262         return v8::Local<v8::Value>();
    263 
    264     // Compute the source string and prevent against infinite recursion.
    265     if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth) {
    266         v8::Local<v8::String> code = v8ExternalString("throw RangeError('Recursion too deep')");
    267         script = ScriptSourceCode::compileScript(code, "", TextPosition::minimumPosition());
    268     }
    269 
    270     if (handleOutOfMemory())
    271         ASSERT(script.IsEmpty());
    272 
    273     if (script.IsEmpty())
    274         return v8::Local<v8::Value>();
    275 
    276     // Run the script and keep track of the current recursion depth.
    277     v8::Local<v8::Value> result;
    278     {
    279         V8RecursionScope recursionScope(m_workerContext);
    280         result = script->Run();
    281     }
    282 
    283     // Handle V8 internal error situation (Out-of-memory).
    284     if (result.IsEmpty())
    285         return v8::Local<v8::Value>();
    286 
    287     return result;
    288 }
    289 
    290260void WorkerContextExecutionProxy::trackEvent(Event* event)
    291261{
  • trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.h

    r128382 r129026  
    8383        void dispose();
    8484
    85         // Run an already compiled script.
    86         v8::Local<v8::Value> runScript(v8::Handle<v8::Script>);
    87 
    8885        static bool forgetV8EventObject(Event*);
    8986
Note: See TracChangeset for help on using the changeset viewer.