mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
737 B
25 lines
737 B
/*
|
|
* Harness / glue functions for running Kraken
|
|
*
|
|
* Don't print() anything here because it's used by the 'sunspider' command
|
|
* to build loadable source files for result analysis.
|
|
*/
|
|
|
|
function load(filename) {
|
|
alert('Load: ' + filename);
|
|
if (typeof readFile !== 'function') {
|
|
throw new Error('expecting "duk" to provide file i/o bindings');
|
|
}
|
|
try {
|
|
var indirectEval = eval; // use indirect eval to ensure 'var xxx = ...' gets registered to global variables
|
|
var data = readFile(filename);
|
|
return indirectEval('' + data);
|
|
} catch (e) {
|
|
alert(e.stack || e); // may fail on purpose if file not found, just log
|
|
return;
|
|
}
|
|
}
|
|
|
|
function gc() {
|
|
Duktape.gc();
|
|
}
|
|
|