Ignore:
Timestamp:
Oct 15, 2007, 6:30:22 PM (18 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Darin.


  • kjs/testkjs.cpp: (TestFunctionImp::callAsFunction): Implement "load" for compatibility with SpiderMonkey. (TestFunctionImp::): ditto (doIt): ditto (kjsmain): Drop useless --> from output.

SunSpider:

Reviewed by Darin.


A start on a new JavaScript benchmark, with standalone and
browser-hosted drivers.


The test content is still incomplete and the drivers could use
some more features but there is enough here to make a good start.


The drivers compute a 95% confidence interval on the mean for the
whole test, each category, and each individual test to make it
easier to tell whether differences are statistically
significant. The confidence interval can be narrowed by running
the test more times.


  • TODO: Added. Remaining things that need to be done.
  • sunspider: Added. Perl script that acts as the standalone test driver.
  • resources/sunspider-standalone-driver.js: Added. JavaScript part of standalone test driver.
  • resources/sunspider-analyze-results.js: Added. JavaScript statistical analysis code.
  • resources/TEMPLATE.html: Added. Template for browser-hosted tests.
  • make-hosted: Added. Script to generate browser-hosted tests.
  • hosted/sunspider.html: Added. Start page for browser-hosted test.
  • hosted/sunspider-driver.html: Added. Driver for browser-hosted tests.
  • hosted/sunspider-results.html: Added. Results page for browser-hosted tests.
  • hosted/sunspider-record-result.js: Added. Helper file for browser-hosted tests.
  • tests/LIST: Added. List of tests to use.
  • tests/bitops-3bit-bits-in-byte.js: Added. Some initial test content.
  • tests/bitops-bits-in-byte.js: Added. Ditto.
  • tests/bitops-bitwise-and.js: Added. Ditto.
  • tests/math-cordic.js: Added. Ditto.

WebKitTools:

Reviewed by Darin.

  • Scripts/run-sunspider: Added. Wrapper to run sunspider on the current development or release build of JavaScriptCore.
File:
1 edited

Legend:

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

    r26185 r26639  
    124124  virtual JSValue* callAsFunction(ExecState* exec, JSObject* thisObj, const List &args);
    125125
    126   enum { Print, Debug, Quit, GC, Version, Run };
     126  enum { Print, Debug, Quit, GC, Version, Run, Load };
    127127
    128128private:
     
    139139  switch (id) {
    140140    case Print:
    141       printf("--> %s\n", args[0]->toString(exec).UTF8String().c_str());
     141      printf("%s\n", args[0]->toString(exec).UTF8String().c_str());
    142142      return jsUndefined();
    143143    case Debug:
     
    159159      char* fileName = strdup(args[0]->toString(exec).UTF8String().c_str());
    160160      char* script = createStringWithContentsOfFile(fileName);
    161       if (!script)
     161      if (!script) {
     162        free(fileName);
    162163        return throwError(exec, GeneralError, "Could not open file.");
     164      }
    163165
    164166      stopWatch.start();
     
    170172     
    171173      return jsNumber(stopWatch.getElapsedMS());
     174    }
     175    case Load:
     176    {
     177      char* fileName = strdup(args[0]->toString(exec).UTF8String().c_str());
     178      char* script = createStringWithContentsOfFile(fileName);
     179      if (!script) {
     180        free(fileName);
     181        return throwError(exec, GeneralError, "Could not open file.");
     182      }
     183
     184      exec->dynamicInterpreter()->evaluate(fileName, 0, script);
     185
     186      free(script);
     187      free(fileName);
     188     
     189      return jsUndefined();
    172190    }
    173191    case Quit:
     
    247265  global->put(interp->globalExec(), "version", new TestFunctionImp(TestFunctionImp::Version, 1));
    248266  global->put(interp->globalExec(), "run", new TestFunctionImp(TestFunctionImp::Run, 1));
     267  global->put(interp->globalExec(), "load", new TestFunctionImp(TestFunctionImp::Load, 1));
    249268 
    250269  Interpreter::setShouldPrintExceptions(true);
     
    307326#endif
    308327
    309   if (success)
    310     fprintf(stderr, "OK.\n");
    311  
    312328#ifdef KJS_DEBUG_MEM
    313329  Interpreter::finalCheck();
Note: See TracChangeset for help on using the changeset viewer.