Skip to content
Snippets Groups Projects
Commit abecbe15 authored by test262-automation's avatar test262-automation Committed by Rick Waldron
Browse files

[javascriptcore-test262-automation] Changes from...

[javascriptcore-test262-automation] Changes from https://github.com/webkit/webkit.git at sha f2e2ad6325 on Fri Sep 28 2018 18:30:38 GMT+0000 (Coordinated Universal Time)
parent e9946587
No related branches found
No related tags found
No related merge requests found
(function test() {
// Read this test file using jsc shell's builtins, and check that its content is as expected.
const in_file = 'jsc-read.js';
const check = content_read => {
let testContent = test.toString();
let lineEnding = testContent.match(/\r?\n/)[0];
let expect = `(${testContent})();${lineEnding}`;
if (content_read !== expect)
throw Error('Expected to read this file as-is, instead read:\n==========\n' + content_read + '\n==========');
};
const test_arraybuffer = read_function => {
let file = read_function(in_file, 'binary');
if (typeof file.buffer !== 'object' || file.byteLength === undefined || file.length === undefined || file.BYTES_PER_ELEMENT !== 1 || file.byteOffset !== 0)
throw Error('Expected a Uint8Array');
let str = '';
for (var i = 0; i != file.length; ++i)
str += String.fromCharCode(file[i]); // Assume ASCII.
check(str);
};
const test_string = read_function => {
let str = read_function(in_file);
if (typeof str !== 'string')
throw Error('Expected a string');
check(str);
};
// jsc's original file reading function is `readFile`, whereas SpiderMonkey
// shell's file reading function is `read`. The latter is used by
// emscripten's shell.js (d8 calls it `readbuffer`, which shell.js
// polyfills).
test_arraybuffer(readFile);
test_arraybuffer(read);
test_string(readFile);
test_string(read);
})();
//@ defaultNoNoLLIntRun if $architecture == "arm"
let args = new Array(0x10000);
args.fill();
args = args.map((_, i) => 'a' + i).join(', ');
let gun = eval(`(function () {
class A {
}
class B extends A {
constructor(${args}) {
() => {
${args};
super();
};
class C {
constructor() {
}
trigger() {
(() => {
super.x;
})();
}
triggerWithRestParameters(...args) {
(() => {
super.x;
})();
}
}
return new C();
}
}
return new B();
})()`);
for (let i = 0; i < 0x10000; i++) {
gun.trigger();
gun.triggerWithRestParameters(1, 2, 3);
}
//@ skip if $memoryLimited
try {
var a0 = '\ud801';
var a1 = [];
a2 = a0.padEnd(2147483644,'x');
a1[a2];
} catch (e) {
exception = e;
}
if (exception != "Error: Out of memory")
throw "FAILED";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment