Changeset 72842 in webkit for trunk/JavaScriptCore/jsc.cpp


Ignore:
Timestamp:
Nov 29, 2010, 3:35:11 PM (14 years ago)
Author:
[email protected]
Message:

Improved accuracy of command-line SunSpider.

Reviewed by Gavin Barraclough.

JavaScriptCore:

  • jsc.cpp:

(functionRun): Changed the "run" function to run a given test in
its own global object. Previously, all tests ran in the same global
object, which created name conflicts, and made globals from previous
tests artificially survive into later tests.

Also changed "run" to return the elapsed milliseconds when running a
given test, for slightly more accurate numbers.

(functionCheckSyntax): Ditto on returning elapsed milliseconds.

SunSpider:

  • resources/sunspider-standalone-driver.js: Use the returned number of

elapsed milliseconds from "run" and "checkSyntax" instead of measuring
ourselves, for slightly more accurate numbers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jsc.cpp

    r71375 r72842  
    209209EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
    210210{
    211     StopWatch stopWatch;
    212211    UString fileName = exec->argument(0).toString(exec);
    213212    Vector<char> script;
     
    215214        return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
    216215
    217     JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    218 
     216    GlobalObject* globalObject = new (&exec->globalData()) GlobalObject(Vector<UString>());
     217
     218    StopWatch stopWatch;
    219219    stopWatch.start();
    220220    evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName));
     
    246246
    247247    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
     248
     249    StopWatch stopWatch;
     250    stopWatch.start();
    248251    Completion result = checkSyntax(globalObject->globalExec(), makeSource(script.data(), fileName));
     252    stopWatch.stop();
     253
    249254    if (result.complType() == Throw)
    250255        throwError(exec, result.value());
    251     return JSValue::encode(result.value());
     256    return JSValue::encode(jsNumber(stopWatch.getElapsedMS()));
    252257}
    253258
Note: See TracChangeset for help on using the changeset viewer.