Changeset 44870 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jun 19, 2009, 1:57:33 PM (16 years ago)
Author:
[email protected]
Message:

2009-06-19 Adam Treat <[email protected]>

Reviewed by Oliver Hunt.

https://bugs.webkit.org/show_bug.cgi?id=26540
Currently the SunSpider test driver lacks an option to run a test suite that
will test JavaScriptCore parsing performance only. This patch adds just such
a test suite and option to SunSpider as well as the jsc test shell. I've included
three large javascript source files found in the wild: jquery, mootools and prototype.
Combined with the concatenation of all three, these form a new testsuite to measure
and test pure JavaScriptCore parsing performance.

Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r44868 r44870  
    1 009-06-19  Zoltan Horvath  <[email protected]>
     12009-06-19  Adam Treat  <[email protected]>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=26540
     6        Modify the test shell to add a new function 'checkSyntax' that will
     7        only parse the source instead of executing it. In this way we can test
     8        pure parsing performance against some of the larger scripts in the wild.
     9
     10        * jsc.cpp:
     11        (GlobalObject::GlobalObject):
     12        (functionCheckSyntax):
     13
     142009-06-19  Zoltan Horvath  <[email protected]>
    215
    316        Reviewed by Darin Adler.
  • trunk/JavaScriptCore/jsc.cpp

    r44766 r44870  
    7676static JSValue JSC_HOST_CALL functionRun(ExecState*, JSObject*, JSValue, const ArgList&);
    7777static JSValue JSC_HOST_CALL functionLoad(ExecState*, JSObject*, JSValue, const ArgList&);
     78static JSValue JSC_HOST_CALL functionCheckSyntax(ExecState*, JSObject*, JSValue, const ArgList&);
    7879static JSValue JSC_HOST_CALL functionReadline(ExecState*, JSObject*, JSValue, const ArgList&);
    7980static NO_RETURN JSValue JSC_HOST_CALL functionQuit(ExecState*, JSObject*, JSValue, const ArgList&);
     
    185186    putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "run"), functionRun));
    186187    putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "load"), functionLoad));
     188    putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "checkSyntax"), functionCheckSyntax));
    187189    putDirectFunction(globalExec(), new (globalExec()) NativeFunctionWrapper(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline));
    188190
     
    260262    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    261263    Completion result = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName));
     264    if (result.complType() == Throw)
     265        exec->setException(result.value());
     266    return result.value();
     267}
     268
     269JSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec, JSObject* o, JSValue v, const ArgList& args)
     270{
     271    UNUSED_PARAM(o);
     272    UNUSED_PARAM(v);
     273    UString fileName = args.at(0).toString(exec);
     274    Vector<char> script;
     275    if (!fillBufferWithContentsOfFile(fileName, script))
     276        return throwError(exec, GeneralError, "Could not open file.");
     277
     278    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
     279    Completion result = checkSyntax(globalObject->globalExec(), makeSource(script.data(), fileName));
    262280    if (result.complType() == Throw)
    263281        exec->setException(result.value());
Note: See TracChangeset for help on using the changeset viewer.