diff --git a/implementation-contributed/javascriptcore/controlFlowProfiler/arrowfunction-expression.js b/implementation-contributed/javascriptcore/controlFlowProfiler/arrowfunction-expression.js deleted file mode 100644 index 613560e118..0000000000 --- a/implementation-contributed/javascriptcore/controlFlowProfiler/arrowfunction-expression.js +++ /dev/null @@ -1,63 +0,0 @@ -load("./driver/driver.js"); - -var afSimple = y => y + 1, - afBlock = y => { y++; return y + 1;}, - afBlockWithCondition = x => { x > 0 ? x++ : x--; return x;}; - -checkBasicBlock(afSimple, "y + 1", ShouldNotHaveExecuted); -afSimple(1); -checkBasicBlock(afSimple, "y + 1", ShouldHaveExecuted); - - -checkBasicBlock(afBlock, "y++", ShouldNotHaveExecuted); -afBlock(2); -checkBasicBlock(afBlock, "y++", ShouldHaveExecuted); -checkBasicBlock(afBlock, "return y + 1", ShouldHaveExecuted); - - -checkBasicBlock(afBlockWithCondition,'x++', ShouldNotHaveExecuted); -afBlockWithCondition(10); -checkBasicBlock(afBlockWithCondition,'x++', ShouldHaveExecuted); -checkBasicBlock(afBlockWithCondition,'return x', ShouldHaveExecuted); -checkBasicBlock(afBlockWithCondition,'x--', ShouldNotHaveExecuted); - - -afBlockWithCondition(-10); -checkBasicBlock(afBlockWithCondition,'x--', ShouldHaveExecuted); - -function foo1(test) { - var f1 = () => { "hello"; } - if (test) - f1(); -} -foo1(false); -checkBasicBlock(foo1, '() =>', ShouldNotHaveExecuted); -checkBasicBlock(foo1, '; }', ShouldNotHaveExecuted); -foo1(true); -checkBasicBlock(foo1, '() =>', ShouldHaveExecuted); -checkBasicBlock(foo1, '; }', ShouldHaveExecuted); - -function foo2(test) { - var f1 = x => { "hello"; } - if (test) - f1(); -} -foo2(false); -checkBasicBlock(foo2, 'x =>', ShouldNotHaveExecuted); -checkBasicBlock(foo2, '; }', ShouldNotHaveExecuted); -foo2(true); -checkBasicBlock(foo2, 'x =>', ShouldHaveExecuted); -checkBasicBlock(foo2, '; }', ShouldHaveExecuted); - - -function foo3(test) { - var f1 = (xyz) => { "hello"; } - if (test) - f1(); -} -foo3(false); -checkBasicBlock(foo3, '(xyz) =>', ShouldNotHaveExecuted); -checkBasicBlock(foo3, '; }', ShouldNotHaveExecuted); -foo3(true); -checkBasicBlock(foo3, '(xyz) =>', ShouldHaveExecuted); -checkBasicBlock(foo3, '; }', ShouldHaveExecuted); diff --git a/implementation-contributed/javascriptcore/controlFlowProfiler/brace-location.js b/implementation-contributed/javascriptcore/controlFlowProfiler/brace-location.js deleted file mode 100644 index 8663cb8e8d..0000000000 --- a/implementation-contributed/javascriptcore/controlFlowProfiler/brace-location.js +++ /dev/null @@ -1,159 +0,0 @@ -load("./driver/driver.js"); - -function foo() {} -function bar() {} -function baz() {} - -function testIf(x) { - if (x < 10) { foo(); } else if (x < 20) { bar(); } else { baz() } -} -testIf(9); -// Note, the check will be against the basic block that contains the first matched character. -// So in this following case, the block that contains the '{'. -checkBasicBlock(testIf, "{ foo", ShouldHaveExecuted); -// In this case, it will test the basic block that contains the ' ' character. -checkBasicBlock(testIf, " foo", ShouldHaveExecuted); -checkBasicBlock(testIf, "} else if", ShouldHaveExecuted); -checkBasicBlock(testIf, "else if", ShouldNotHaveExecuted); -checkBasicBlock(testIf, "{ bar", ShouldNotHaveExecuted); -checkBasicBlock(testIf, " bar", ShouldNotHaveExecuted); -checkBasicBlock(testIf, "else {", ShouldNotHaveExecuted); -checkBasicBlock(testIf, "{ baz", ShouldNotHaveExecuted); -checkBasicBlock(testIf, " baz", ShouldNotHaveExecuted); -testIf(21); -checkBasicBlock(testIf, "else if (x < 20)", ShouldHaveExecuted); -checkBasicBlock(testIf, "{ bar", ShouldNotHaveExecuted); -checkBasicBlock(testIf, " bar", ShouldNotHaveExecuted); -checkBasicBlock(testIf, "else {", ShouldHaveExecuted); -checkBasicBlock(testIf, "{ baz", ShouldHaveExecuted); -checkBasicBlock(testIf, " baz", ShouldHaveExecuted); -testIf(11); -checkBasicBlock(testIf, "{ bar", ShouldHaveExecuted); -checkBasicBlock(testIf, " bar", ShouldHaveExecuted); - -function testForRegular(x) { - for (var i = 0; i < x; i++) { foo(); } bar(); -} -testForRegular(0); -checkBasicBlock(testForRegular, "{ foo", ShouldNotHaveExecuted); -checkBasicBlock(testForRegular, "} bar", ShouldNotHaveExecuted); -checkBasicBlock(testForRegular, " bar", ShouldHaveExecuted); -testForRegular(1); -checkBasicBlock(testForRegular, "{ foo", ShouldHaveExecuted); -checkBasicBlock(testForRegular, "} bar", ShouldHaveExecuted); - -function testForIn(x) { - for (var i in x) { foo(); } bar(); -} -testForIn({}); -checkBasicBlock(testForIn, "{ foo", ShouldNotHaveExecuted); -checkBasicBlock(testForIn, "} bar", ShouldNotHaveExecuted); -checkBasicBlock(testForIn, " bar", ShouldHaveExecuted); -testForIn({foo: 20}); -checkBasicBlock(testForIn, "{ foo", ShouldHaveExecuted); -checkBasicBlock(testForIn, "} bar", ShouldHaveExecuted); - -function testForOf(x) { - for (var i of x) { foo(); } bar(); -} -testForOf([]); -checkBasicBlock(testForOf, "{ foo", ShouldNotHaveExecuted); -checkBasicBlock(testForOf, " foo", ShouldNotHaveExecuted); -checkBasicBlock(testForOf, "} bar", ShouldNotHaveExecuted); -checkBasicBlock(testForOf, " bar", ShouldHaveExecuted); -testForOf([20]); -checkBasicBlock(testForOf, "{ foo", ShouldHaveExecuted); -checkBasicBlock(testForOf, "} bar", ShouldHaveExecuted); - -function testWhile(x) { - var i = 0; while (i++ < x) { foo(); } bar(); -} -testWhile(0); -checkBasicBlock(testWhile, "{ foo", ShouldNotHaveExecuted); -checkBasicBlock(testWhile, " foo", ShouldNotHaveExecuted); -checkBasicBlock(testWhile, "} bar", ShouldNotHaveExecuted); -checkBasicBlock(testWhile, " bar", ShouldHaveExecuted); -testWhile(1); -checkBasicBlock(testWhile, "{ foo", ShouldHaveExecuted); -checkBasicBlock(testWhile, "} bar", ShouldHaveExecuted); - - -// No braces tests. - -function testIfNoBraces(x) { - if (x < 10) foo(); else if (x < 20) bar(); else baz(); -} -testIfNoBraces(9); -checkBasicBlock(testIfNoBraces, "foo", ShouldHaveExecuted); -checkBasicBlock(testIfNoBraces, " foo", ShouldHaveExecuted); -checkBasicBlock(testIfNoBraces, "; else if", ShouldHaveExecuted); -checkBasicBlock(testIfNoBraces, " else if", ShouldNotHaveExecuted); -checkBasicBlock(testIfNoBraces, " bar", ShouldNotHaveExecuted); -checkBasicBlock(testIfNoBraces, "bar", ShouldNotHaveExecuted); -checkBasicBlock(testIfNoBraces, "else baz", ShouldNotHaveExecuted); -checkBasicBlock(testIfNoBraces, "baz", ShouldNotHaveExecuted); -testIfNoBraces(21); -checkBasicBlock(testIfNoBraces, "else baz", ShouldHaveExecuted); -checkBasicBlock(testIfNoBraces, "baz", ShouldHaveExecuted); -checkBasicBlock(testIfNoBraces, "; else baz", ShouldNotHaveExecuted); -checkBasicBlock(testIfNoBraces, "else if (x < 20)", ShouldHaveExecuted); -// Note that the whitespace preceding bar is part of the previous basic block. -// An if statement's if-true basic block text offset begins at the start offset -// of the if-true block, in this case, just the expression "bar()". -checkBasicBlock(testIfNoBraces, " bar", ShouldHaveExecuted); -checkBasicBlock(testIfNoBraces, "bar", ShouldNotHaveExecuted); -testIfNoBraces(11); -checkBasicBlock(testIfNoBraces, " bar", ShouldHaveExecuted); -checkBasicBlock(testIfNoBraces, "bar", ShouldHaveExecuted); - -function testForRegularNoBraces(x) { - for (var i = 0; i < x; i++) foo(); bar(); -} -testForRegularNoBraces(0); -checkBasicBlock(testForRegularNoBraces, " foo", ShouldHaveExecuted); -checkBasicBlock(testForRegularNoBraces, "foo", ShouldNotHaveExecuted); -checkBasicBlock(testForRegularNoBraces, "; bar", ShouldNotHaveExecuted); -checkBasicBlock(testForRegularNoBraces, " bar", ShouldHaveExecuted); -testForRegularNoBraces(1); -checkBasicBlock(testForRegularNoBraces, " foo", ShouldHaveExecuted); -checkBasicBlock(testForRegularNoBraces, "foo", ShouldHaveExecuted); -checkBasicBlock(testForRegularNoBraces, " bar", ShouldHaveExecuted); - -function testForInNoBraces(x) { - for (var i in x) foo(); bar(); -} -testForInNoBraces({}); -checkBasicBlock(testForInNoBraces, " foo", ShouldHaveExecuted); -checkBasicBlock(testForInNoBraces, "foo", ShouldNotHaveExecuted); -checkBasicBlock(testForInNoBraces, "; bar", ShouldNotHaveExecuted); -checkBasicBlock(testForInNoBraces, " bar", ShouldHaveExecuted); -testForInNoBraces({foo: 20}); -checkBasicBlock(testForInNoBraces, " foo", ShouldHaveExecuted); -checkBasicBlock(testForInNoBraces, "foo", ShouldHaveExecuted); -checkBasicBlock(testForInNoBraces, "; bar", ShouldHaveExecuted); - -function testForOfNoBraces(x) { - for (var i of x) foo(); bar(); -} -testForOfNoBraces([]); -checkBasicBlock(testForOfNoBraces, " foo", ShouldHaveExecuted); -checkBasicBlock(testForOfNoBraces, "foo", ShouldNotHaveExecuted); -checkBasicBlock(testForOfNoBraces, "; bar", ShouldNotHaveExecuted); -checkBasicBlock(testForOfNoBraces, " bar", ShouldHaveExecuted); -testForOfNoBraces([20]); -checkBasicBlock(testForOfNoBraces, " foo", ShouldHaveExecuted); -checkBasicBlock(testForOfNoBraces, "foo", ShouldHaveExecuted); -checkBasicBlock(testForOfNoBraces, "; bar", ShouldHaveExecuted); - -function testWhileNoBraces(x) { - var i = 0; while (i++ < x) foo(); bar(); -} -testWhileNoBraces(0); -checkBasicBlock(testWhileNoBraces, " foo", ShouldHaveExecuted); -checkBasicBlock(testWhileNoBraces, "foo", ShouldNotHaveExecuted); -checkBasicBlock(testWhileNoBraces, "; bar", ShouldNotHaveExecuted); -checkBasicBlock(testWhileNoBraces, " bar", ShouldHaveExecuted); -testWhileNoBraces(1); -checkBasicBlock(testWhileNoBraces, " foo", ShouldHaveExecuted); -checkBasicBlock(testWhileNoBraces, "foo", ShouldHaveExecuted); -checkBasicBlock(testWhileNoBraces, "; bar", ShouldHaveExecuted); diff --git a/implementation-contributed/javascriptcore/controlFlowProfiler/conditional-expression.js b/implementation-contributed/javascriptcore/controlFlowProfiler/conditional-expression.js deleted file mode 100644 index ecb0ffac02..0000000000 --- a/implementation-contributed/javascriptcore/controlFlowProfiler/conditional-expression.js +++ /dev/null @@ -1,44 +0,0 @@ -load("./driver/driver.js"); - -function foo(){ } -function bar(){ } -function baz(){ } - -function testConditionalBasic(x) { - return x ? 10 : 20; -} - - -testConditionalBasic(false); -checkBasicBlock(testConditionalBasic, "x", ShouldHaveExecuted); -checkBasicBlock(testConditionalBasic, "20", ShouldHaveExecuted); -checkBasicBlock(testConditionalBasic, "10", ShouldNotHaveExecuted); - -testConditionalBasic(true); -checkBasicBlock(testConditionalBasic, "10", ShouldHaveExecuted); - - -function testConditionalFunctionCall(x, y) { - x ? y ? foo() - : baz() - : bar() -} -testConditionalFunctionCall(false, false); -checkBasicBlock(testConditionalFunctionCall, "x ?", ShouldHaveExecuted); -checkBasicBlock(testConditionalFunctionCall, "? y", ShouldHaveExecuted); -checkBasicBlock(testConditionalFunctionCall, "bar", ShouldHaveExecuted); -checkBasicBlock(testConditionalFunctionCall, ": bar", ShouldHaveExecuted); -checkBasicBlock(testConditionalFunctionCall, "y ?", ShouldNotHaveExecuted); -checkBasicBlock(testConditionalFunctionCall, "? foo", ShouldNotHaveExecuted); -checkBasicBlock(testConditionalFunctionCall, "foo", ShouldNotHaveExecuted); -checkBasicBlock(testConditionalFunctionCall, "baz", ShouldNotHaveExecuted); - -testConditionalFunctionCall(true, false); -checkBasicBlock(testConditionalFunctionCall, "y ?", ShouldHaveExecuted); -checkBasicBlock(testConditionalFunctionCall, "? foo", ShouldHaveExecuted); -checkBasicBlock(testConditionalFunctionCall, ": baz", ShouldHaveExecuted); -checkBasicBlock(testConditionalFunctionCall, "baz", ShouldHaveExecuted); -checkBasicBlock(testConditionalFunctionCall, "foo", ShouldNotHaveExecuted); - -testConditionalFunctionCall(true, true); -checkBasicBlock(testConditionalFunctionCall, "foo", ShouldHaveExecuted); diff --git a/implementation-contributed/javascriptcore/controlFlowProfiler/driver/driver.js b/implementation-contributed/javascriptcore/controlFlowProfiler/driver/driver.js deleted file mode 100644 index d0f93efc2c..0000000000 --- a/implementation-contributed/javascriptcore/controlFlowProfiler/driver/driver.js +++ /dev/null @@ -1,16 +0,0 @@ -var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted; - -function assert(condition, reason) { - if (!condition) - throw new Error(reason); -} - -var ShouldHaveExecuted = true; -var ShouldNotHaveExecuted = false; - -function checkBasicBlock(func, expr, expectation) { - if (expectation === ShouldHaveExecuted) - assert(hasBasicBlockExecuted(func, expr, "should have executed")); - else - assert(!hasBasicBlockExecuted(func, expr, "should not have executed")); -} diff --git a/implementation-contributed/javascriptcore/controlFlowProfiler/execution-count.js b/implementation-contributed/javascriptcore/controlFlowProfiler/execution-count.js deleted file mode 100644 index 6fe1886be9..0000000000 --- a/implementation-contributed/javascriptcore/controlFlowProfiler/execution-count.js +++ /dev/null @@ -1,72 +0,0 @@ -var basicBlockExecutionCount = $vm.basicBlockExecutionCount; - -load("./driver/driver.js"); - -function noop() { ; } -function foo(num) { - for (let i = 0; i < num; i++) { - noop(); - } -} - -function a() { ; } -function b() { ; } - -function baz(num) { - for (let i = 0; i < num; i++) { - i % 2 ? a() : b(); - } -} - -function jaz(num) { - for (let i = 0; i < num; i++) { - if (i % 2) - a(); - else - b(); - } -} - -function testWhile(num) { - let i = num; - while (i--) { - noop(); - if (i % 2) - a(); - else - b(); - } -} - -foo(120); -assert(basicBlockExecutionCount(foo, "noop()") === 120); -noop(); -assert(basicBlockExecutionCount(noop, ";") === 121); - -baz(140); -assert(basicBlockExecutionCount(baz, "a()") === 140/2); -assert(basicBlockExecutionCount(baz, "b()") === 140/2); -assert(basicBlockExecutionCount(a, ";") === 140/2); -assert(basicBlockExecutionCount(b, ";") === 140/2); - -jaz(140); -assert(basicBlockExecutionCount(jaz, "a()") === 140/2); -assert(basicBlockExecutionCount(jaz, "b()") === 140/2); - -testWhile(140); -assert(basicBlockExecutionCount(testWhile, "noop()") === 140); -assert(basicBlockExecutionCount(testWhile, "a()") === 140/2); -assert(basicBlockExecutionCount(testWhile, "b()") === 140/2); - -if (is32BitPlatform()) { - function testMax() { - let j = 0; - let numIters = Math.pow(2, 32) + 10; - for (let i = 0; i < numIters; i++) { - j++; - } - } - - testMax(); - assert(basicBlockExecutionCount(testMax, "j++") === Math.pow(2, 32) - 1); -} diff --git a/implementation-contributed/javascriptcore/controlFlowProfiler/if-statement.js b/implementation-contributed/javascriptcore/controlFlowProfiler/if-statement.js deleted file mode 100644 index 2600f6388a..0000000000 --- a/implementation-contributed/javascriptcore/controlFlowProfiler/if-statement.js +++ /dev/null @@ -1,58 +0,0 @@ -var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted; - -load("./driver/driver.js"); - -var a, b, c, d; - -function testIf(x) { - if (x > 10 && x < 20) { - return a; - } else if (x > 20 && x < 30) { - return b; - } else if (x > 30 && x < 40) { - return c; - } else { - return d; - } - - return null; -} - -function noMatches(x) { - if (x > 10 && x < 20) { - return a; - } else if (x > 20 && x < 30) { - return b; - } else { - return c; - } -} - -assert(!hasBasicBlockExecuted(testIf, "return a"), "should not have executed yet."); -assert(!hasBasicBlockExecuted(testIf, "return b"), "should not have executed yet."); -assert(!hasBasicBlockExecuted(testIf, "return c"), "should not have executed yet."); -assert(!hasBasicBlockExecuted(testIf, "return d"), "should not have executed yet."); - -testIf(11); -assert(hasBasicBlockExecuted(testIf, "return a"), "should have executed."); -assert(hasBasicBlockExecuted(testIf, "x > 10"), "should have executed."); -assert(!hasBasicBlockExecuted(testIf, "return b"), "should not have executed yet."); - -testIf(21); -assert(hasBasicBlockExecuted(testIf, "return b"), "should have executed."); -assert(!hasBasicBlockExecuted(testIf, "return c"), "should not have executed yet."); - -testIf(31); -assert(hasBasicBlockExecuted(testIf, "return c"), "should have executed."); -assert(!hasBasicBlockExecuted(testIf, "return d"), "should not have executed yet."); - -testIf(0); -assert(hasBasicBlockExecuted(testIf, "return d"), "should have executed."); - - -noMatches(0); -assert(!hasBasicBlockExecuted(noMatches, "return a"), "should not have executed yet."); -assert(hasBasicBlockExecuted(noMatches, "x > 10"), "should have executed."); -assert(!hasBasicBlockExecuted(noMatches, "return b"), "should not have executed yet."); -assert(hasBasicBlockExecuted(noMatches, "x > 20"), "should have executed."); -assert(hasBasicBlockExecuted(noMatches, "return c"), "should have executed."); diff --git a/implementation-contributed/javascriptcore/controlFlowProfiler/loop-statements.js b/implementation-contributed/javascriptcore/controlFlowProfiler/loop-statements.js deleted file mode 100644 index 7a6265bdbf..0000000000 --- a/implementation-contributed/javascriptcore/controlFlowProfiler/loop-statements.js +++ /dev/null @@ -1,78 +0,0 @@ -var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted; - -load("./driver/driver.js"); - -function forRegular(limit) { - var sum = 0; - for (var i = 0; i < limit; i++) { - sum += i; - } - - return sum; -} - -function forIn(o) { - var s = ""; - var p; - for (p in o) { - s += p; - } -} - -function forOf(a) { - var s = ""; - var p; - for (p of a) { - s += p; - } -} - -function whileLoop(limit) { - var i = 0; - var sum = 0; - while (i < limit) { - sum += i; - i++; - } - - return sum; -} - -assert(!hasBasicBlockExecuted(forRegular, "var sum"), "should not have executed yet."); - -forRegular(0); -assert(hasBasicBlockExecuted(forRegular, "var sum"), "should have executed."); -assert(!hasBasicBlockExecuted(forRegular, "sum += i"), "should not have executed yet."); - -forRegular(1); -assert(hasBasicBlockExecuted(forRegular, "sum += i"), "should have executed."); - - -assert(!hasBasicBlockExecuted(forIn, "var s"), "should not have executed yet."); - -forIn({}); -assert(hasBasicBlockExecuted(forIn, "var s"), "should have executed."); -assert(!hasBasicBlockExecuted(forIn, "s += p"), "should not have executed yet."); - -forIn({foo: "bar"}); -assert(hasBasicBlockExecuted(forIn, "s += p"), "should have executed."); - - -assert(!hasBasicBlockExecuted(forOf, "var s"), "should not have executed yet."); - -forOf([]); -assert(hasBasicBlockExecuted(forOf, "var s"), "should have executed."); -assert(!hasBasicBlockExecuted(forOf, "s += p"), "should not have executed yet."); - -forOf(["a"]); -assert(hasBasicBlockExecuted(forOf, "s += p"), "should have executed."); - - -assert(!hasBasicBlockExecuted(whileLoop, "var sum"), "should not have executed yet."); - -whileLoop(0); -assert(hasBasicBlockExecuted(whileLoop, "var sum"), "should have executed."); -assert(!hasBasicBlockExecuted(whileLoop, "sum += i"), "should not have executed yet."); - -whileLoop(1); -assert(hasBasicBlockExecuted(whileLoop, "sum += i"), "should have executed."); diff --git a/implementation-contributed/javascriptcore/controlFlowProfiler/switch-statements.js b/implementation-contributed/javascriptcore/controlFlowProfiler/switch-statements.js deleted file mode 100644 index fd8e6bfd52..0000000000 --- a/implementation-contributed/javascriptcore/controlFlowProfiler/switch-statements.js +++ /dev/null @@ -1,30 +0,0 @@ -var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted; - -load("./driver/driver.js"); - -var a, b, c; -function testSwitch(s) { - switch (s) { - case "foo": - return a; - case "bar": - return b; - default: - return c; - } -} - -assert(!hasBasicBlockExecuted(testSwitch, "switch"), "should not have executed yet."); - -testSwitch("foo"); -assert(hasBasicBlockExecuted(testSwitch, "switch"), "should have executed."); -assert(hasBasicBlockExecuted(testSwitch, "return a"), "should have executed."); -assert(!hasBasicBlockExecuted(testSwitch, "return b"), "should not have executed yet."); -assert(!hasBasicBlockExecuted(testSwitch, "return c"), "should not have executed yet."); - -testSwitch("bar"); -assert(hasBasicBlockExecuted(testSwitch, "return b"), "should have executed."); -assert(!hasBasicBlockExecuted(testSwitch, "return c"), "should not have executed yet."); - -testSwitch(""); -assert(hasBasicBlockExecuted(testSwitch, "return c"), "should have executed."); diff --git a/implementation-contributed/javascriptcore/controlFlowProfiler/test-jit.js b/implementation-contributed/javascriptcore/controlFlowProfiler/test-jit.js deleted file mode 100644 index 732caa5cf0..0000000000 --- a/implementation-contributed/javascriptcore/controlFlowProfiler/test-jit.js +++ /dev/null @@ -1,48 +0,0 @@ -var hasBasicBlockExecuted = $vm.hasBasicBlockExecuted; - -load("./driver/driver.js"); - -function tierUpToBaseline(func, arg) -{ - for (var i = 0; i < 50; i++) - func(arg); -} - -function tierUpToDFG(func, arg) -{ - for (var i = 0; i < 50; i++) - func(arg); -} - -function baselineTest(arg) { - if (arg > 20) { - return 20; - } else { - return 30; - } -} - -function dfgTest(arg) { - if (arg > 20) { - return 20; - } else { - return 30; - } -} - -noInline(baselineTest); -noInline(dfgTest); - -tierUpToBaseline(baselineTest, 10); -tierUpToDFG(dfgTest, 10); - -assert(!hasBasicBlockExecuted(baselineTest, "return 20"), "should not have executed yet."); -assert(hasBasicBlockExecuted(baselineTest, "return 30"), "should have executed."); -baselineTest(25); -assert(hasBasicBlockExecuted(baselineTest, "return 20"), "should have executed."); - -assert(!hasBasicBlockExecuted(dfgTest, "return 20"), "should not have executed yet."); -assert(hasBasicBlockExecuted(dfgTest, "return 30"), "should have executed."); -dfgTest(25); -assert(hasBasicBlockExecuted(dfgTest, "return 20"), "should have executed."); - diff --git a/implementation-contributed/javascriptcore/exceptionFuzz/3d-cube.js b/implementation-contributed/javascriptcore/exceptionFuzz/3d-cube.js deleted file mode 100644 index a79a8763cd..0000000000 --- a/implementation-contributed/javascriptcore/exceptionFuzz/3d-cube.js +++ /dev/null @@ -1,365 +0,0 @@ -var enableExceptionFuzz = $vm.enableExceptionFuzz; - -try { - -// 3D Cube Rotation -// http://www.speich.net/computer/moztesting/3d.htm -// Created by Simon Speich - -enableExceptionFuzz(); - - -var Q = new Array(); -var MTrans = new Array(); // transformation matrix -var MQube = new Array(); // position information of qube -var I = new Array(); // entity matrix -var Origin = new Object(); -var Testing = new Object(); -var LoopTimer; - -var validation = { - 20: 2889.0000000000045, - 40: 2889.0000000000055, - 80: 2889.000000000005, - 160: 2889.0000000000055 -}; - -var DisplArea = new Object(); -DisplArea.Width = 300; -DisplArea.Height = 300; - -function DrawLine(From, To) { - var x1 = From.V[0]; - var x2 = To.V[0]; - var y1 = From.V[1]; - var y2 = To.V[1]; - var dx = Math.abs(x2 - x1); - var dy = Math.abs(y2 - y1); - var x = x1; - var y = y1; - var IncX1, IncY1; - var IncX2, IncY2; - var Den; - var Num; - var NumAdd; - var NumPix; - - if (x2 >= x1) { IncX1 = 1; IncX2 = 1; } - else { IncX1 = -1; IncX2 = -1; } - if (y2 >= y1) { IncY1 = 1; IncY2 = 1; } - else { IncY1 = -1; IncY2 = -1; } - if (dx >= dy) { - IncX1 = 0; - IncY2 = 0; - Den = dx; - Num = dx / 2; - NumAdd = dy; - NumPix = dx; - } - else { - IncX2 = 0; - IncY1 = 0; - Den = dy; - Num = dy / 2; - NumAdd = dx; - NumPix = dy; - } - - NumPix = Math.round(Q.LastPx + NumPix); - - var i = Q.LastPx; - for (; i < NumPix; i++) { - Num += NumAdd; - if (Num >= Den) { - Num -= Den; - x += IncX1; - y += IncY1; - } - x += IncX2; - y += IncY2; - } - Q.LastPx = NumPix; -} - -function CalcCross(V0, V1) { - var Cross = new Array(); - Cross[0] = V0[1]*V1[2] - V0[2]*V1[1]; - Cross[1] = V0[2]*V1[0] - V0[0]*V1[2]; - Cross[2] = V0[0]*V1[1] - V0[1]*V1[0]; - return Cross; -} - -function CalcNormal(V0, V1, V2) { - var A = new Array(); var B = new Array(); - for (var i = 0; i < 3; i++) { - A[i] = V0[i] - V1[i]; - B[i] = V2[i] - V1[i]; - } - A = CalcCross(A, B); - var Length = Math.sqrt(A[0]*A[0] + A[1]*A[1] + A[2]*A[2]); - for (var i = 0; i < 3; i++) A[i] = A[i] / Length; - A[3] = 1; - return A; -} - -function CreateP(X,Y,Z) { - this.V = [X,Y,Z,1]; -} - -// multiplies two matrices -function MMulti(M1, M2) { - var M = [[],[],[],[]]; - var i = 0; - var j = 0; - for (; i < 4; i++) { - j = 0; - for (; j < 4; j++) M[i][j] = M1[i][0] * M2[0][j] + M1[i][1] * M2[1][j] + M1[i][2] * M2[2][j] + M1[i][3] * M2[3][j]; - } - return M; -} - -//multiplies matrix with vector -function VMulti(M, V) { - var Vect = new Array(); - var i = 0; - for (;i < 4; i++) Vect[i] = M[i][0] * V[0] + M[i][1] * V[1] + M[i][2] * V[2] + M[i][3] * V[3]; - return Vect; -} - -function VMulti2(M, V) { - var Vect = new Array(); - var i = 0; - for (;i < 3; i++) Vect[i] = M[i][0] * V[0] + M[i][1] * V[1] + M[i][2] * V[2]; - return Vect; -} - -// add to matrices -function MAdd(M1, M2) { - var M = [[],[],[],[]]; - var i = 0; - var j = 0; - for (; i < 4; i++) { - j = 0; - for (; j < 4; j++) M[i][j] = M1[i][j] + M2[i][j]; - } - return M; -} - -function Translate(M, Dx, Dy, Dz) { - var T = [ - [1,0,0,Dx], - [0,1,0,Dy], - [0,0,1,Dz], - [0,0,0,1] - ]; - return MMulti(T, M); -} - -function RotateX(M, Phi) { - var a = Phi; - a *= Math.PI / 180; - var Cos = Math.cos(a); - var Sin = Math.sin(a); - var R = [ - [1,0,0,0], - [0,Cos,-Sin,0], - [0,Sin,Cos,0], - [0,0,0,1] - ]; - return MMulti(R, M); -} - -function RotateY(M, Phi) { - var a = Phi; - a *= Math.PI / 180; - var Cos = Math.cos(a); - var Sin = Math.sin(a); - var R = [ - [Cos,0,Sin,0], - [0,1,0,0], - [-Sin,0,Cos,0], - [0,0,0,1] - ]; - return MMulti(R, M); -} - -function RotateZ(M, Phi) { - var a = Phi; - a *= Math.PI / 180; - var Cos = Math.cos(a); - var Sin = Math.sin(a); - var R = [ - [Cos,-Sin,0,0], - [Sin,Cos,0,0], - [0,0,1,0], - [0,0,0,1] - ]; - return MMulti(R, M); -} - -function DrawQube() { - // calc current normals - var CurN = new Array(); - var i = 5; - Q.LastPx = 0; - for (; i > -1; i--) CurN[i] = VMulti2(MQube, Q.Normal[i]); - if (CurN[0][2] < 0) { - if (!Q.Line[0]) { DrawLine(Q[0], Q[1]); Q.Line[0] = true; }; - if (!Q.Line[1]) { DrawLine(Q[1], Q[2]); Q.Line[1] = true; }; - if (!Q.Line[2]) { DrawLine(Q[2], Q[3]); Q.Line[2] = true; }; - if (!Q.Line[3]) { DrawLine(Q[3], Q[0]); Q.Line[3] = true; }; - } - if (CurN[1][2] < 0) { - if (!Q.Line[2]) { DrawLine(Q[3], Q[2]); Q.Line[2] = true; }; - if (!Q.Line[9]) { DrawLine(Q[2], Q[6]); Q.Line[9] = true; }; - if (!Q.Line[6]) { DrawLine(Q[6], Q[7]); Q.Line[6] = true; }; - if (!Q.Line[10]) { DrawLine(Q[7], Q[3]); Q.Line[10] = true; }; - } - if (CurN[2][2] < 0) { - if (!Q.Line[4]) { DrawLine(Q[4], Q[5]); Q.Line[4] = true; }; - if (!Q.Line[5]) { DrawLine(Q[5], Q[6]); Q.Line[5] = true; }; - if (!Q.Line[6]) { DrawLine(Q[6], Q[7]); Q.Line[6] = true; }; - if (!Q.Line[7]) { DrawLine(Q[7], Q[4]); Q.Line[7] = true; }; - } - if (CurN[3][2] < 0) { - if (!Q.Line[4]) { DrawLine(Q[4], Q[5]); Q.Line[4] = true; }; - if (!Q.Line[8]) { DrawLine(Q[5], Q[1]); Q.Line[8] = true; }; - if (!Q.Line[0]) { DrawLine(Q[1], Q[0]); Q.Line[0] = true; }; - if (!Q.Line[11]) { DrawLine(Q[0], Q[4]); Q.Line[11] = true; }; - } - if (CurN[4][2] < 0) { - if (!Q.Line[11]) { DrawLine(Q[4], Q[0]); Q.Line[11] = true; }; - if (!Q.Line[3]) { DrawLine(Q[0], Q[3]); Q.Line[3] = true; }; - if (!Q.Line[10]) { DrawLine(Q[3], Q[7]); Q.Line[10] = true; }; - if (!Q.Line[7]) { DrawLine(Q[7], Q[4]); Q.Line[7] = true; }; - } - if (CurN[5][2] < 0) { - if (!Q.Line[8]) { DrawLine(Q[1], Q[5]); Q.Line[8] = true; }; - if (!Q.Line[5]) { DrawLine(Q[5], Q[6]); Q.Line[5] = true; }; - if (!Q.Line[9]) { DrawLine(Q[6], Q[2]); Q.Line[9] = true; }; - if (!Q.Line[1]) { DrawLine(Q[2], Q[1]); Q.Line[1] = true; }; - } - Q.Line = [false,false,false,false,false,false,false,false,false,false,false,false]; - Q.LastPx = 0; -} - -function Loop() { - if (Testing.LoopCount > Testing.LoopMax) return; - var TestingStr = String(Testing.LoopCount); - while (TestingStr.length < 3) TestingStr = "0" + TestingStr; - MTrans = Translate(I, -Q[8].V[0], -Q[8].V[1], -Q[8].V[2]); - MTrans = RotateX(MTrans, 1); - MTrans = RotateY(MTrans, 3); - MTrans = RotateZ(MTrans, 5); - MTrans = Translate(MTrans, Q[8].V[0], Q[8].V[1], Q[8].V[2]); - MQube = MMulti(MTrans, MQube); - var i = 8; - for (; i > -1; i--) { - Q[i].V = VMulti(MTrans, Q[i].V); - } - DrawQube(); - Testing.LoopCount++; - Loop(); -} - -function Init(CubeSize) { - // init/reset vars - Origin.V = [150,150,20,1]; - Testing.LoopCount = 0; - Testing.LoopMax = 50; - Testing.TimeMax = 0; - Testing.TimeAvg = 0; - Testing.TimeMin = 0; - Testing.TimeTemp = 0; - Testing.TimeTotal = 0; - Testing.Init = false; - - // transformation matrix - MTrans = [ - [1,0,0,0], - [0,1,0,0], - [0,0,1,0], - [0,0,0,1] - ]; - - // position information of qube - MQube = [ - [1,0,0,0], - [0,1,0,0], - [0,0,1,0], - [0,0,0,1] - ]; - - // entity matrix - I = [ - [1,0,0,0], - [0,1,0,0], - [0,0,1,0], - [0,0,0,1] - ]; - - // create qube - Q[0] = new CreateP(-CubeSize,-CubeSize, CubeSize); - Q[1] = new CreateP(-CubeSize, CubeSize, CubeSize); - Q[2] = new CreateP( CubeSize, CubeSize, CubeSize); - Q[3] = new CreateP( CubeSize,-CubeSize, CubeSize); - Q[4] = new CreateP(-CubeSize,-CubeSize,-CubeSize); - Q[5] = new CreateP(-CubeSize, CubeSize,-CubeSize); - Q[6] = new CreateP( CubeSize, CubeSize,-CubeSize); - Q[7] = new CreateP( CubeSize,-CubeSize,-CubeSize); - - // center of gravity - Q[8] = new CreateP(0, 0, 0); - - // anti-clockwise edge check - Q.Edge = [[0,1,2],[3,2,6],[7,6,5],[4,5,1],[4,0,3],[1,5,6]]; - - // calculate squad normals - Q.Normal = new Array(); - for (var i = 0; i < Q.Edge.length; i++) Q.Normal[i] = CalcNormal(Q[Q.Edge[i][0]].V, Q[Q.Edge[i][1]].V, Q[Q.Edge[i][2]].V); - - // line drawn ? - Q.Line = [false,false,false,false,false,false,false,false,false,false,false,false]; - - // create line pixels - Q.NumPx = 9 * 2 * CubeSize; - for (var i = 0; i < Q.NumPx; i++) CreateP(0,0,0); - - MTrans = Translate(MTrans, Origin.V[0], Origin.V[1], Origin.V[2]); - MQube = MMulti(MTrans, MQube); - - var i = 0; - for (; i < 9; i++) { - Q[i].V = VMulti(MTrans, Q[i].V); - } - DrawQube(); - Testing.Init = true; - Loop(); - - // Perform a simple sum-based verification. - var sum = 0; - for (var i = 0; i < Q.length; ++i) { - var vector = Q[i].V; - for (var j = 0; j < vector.length; ++j) - sum += vector[j]; - } - if (sum != validation[CubeSize]) - throw "Error: bad vector sum for CubeSize = " + CubeSize + "; expected " + validation[CubeSize] + " but got " + sum; -} - -for ( var i = 20; i <= 160; i *= 2 ) { - Init(i); -} - -Q = null; -MTrans = null; -MQube = null; -I = null; -Origin = null; -Testing = null; -LoopTime = null; -DisplArea = null; - -} catch (e) { - print("JSC EXCEPTION FUZZ: Caught exception: " + e); -} diff --git a/implementation-contributed/javascriptcore/exceptionFuzz/date-format-xparb.js b/implementation-contributed/javascriptcore/exceptionFuzz/date-format-xparb.js deleted file mode 100644 index f2d2a17a3b..0000000000 --- a/implementation-contributed/javascriptcore/exceptionFuzz/date-format-xparb.js +++ /dev/null @@ -1,431 +0,0 @@ -var enableExceptionFuzz = $vm.enableExceptionFuzz; - -try { - -/* - * Copyright (C) 2004 Baron Schwartz - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, version 2.1. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. - */ - -enableExceptionFuzz(); - - -Date.parseFunctions = {count:0}; -Date.parseRegexes = []; -Date.formatFunctions = {count:0}; - -Date.prototype.dateFormat = function(format) { - if (Date.formatFunctions[format] == null) { - Date.createNewFormat(format); - } - var func = Date.formatFunctions[format]; - return this[func](); -} - -Date.createNewFormat = function(format) { - var funcName = "format" + Date.formatFunctions.count++; - Date.formatFunctions[format] = funcName; - var code = "Date.prototype." + funcName + " = function(){return "; - var special = false; - var ch = ''; - for (var i = 0; i < format.length; ++i) { - ch = format.charAt(i); - if (!special && ch == "\\") { - special = true; - } - else if (special) { - special = false; - code += "'" + String.escape(ch) + "' + "; - } - else { - code += Date.getFormatCode(ch); - } - } - eval(code.substring(0, code.length - 3) + ";}"); -} - -Date.getFormatCode = function(character) { - switch (character) { - case "d": - return "String.leftPad(this.getDate(), 2, '0') + "; - case "D": - return "Date.dayNames[this.getDay()].substring(0, 3) + "; - case "j": - return "this.getDate() + "; - case "l": - return "Date.dayNames[this.getDay()] + "; - case "S": - return "this.getSuffix() + "; - case "w": - return "this.getDay() + "; - case "z": - return "this.getDayOfYear() + "; - case "W": - return "this.getWeekOfYear() + "; - case "F": - return "Date.monthNames[this.getMonth()] + "; - case "m": - return "String.leftPad(this.getMonth() + 1, 2, '0') + "; - case "M": - return "Date.monthNames[this.getMonth()].substring(0, 3) + "; - case "n": - return "(this.getMonth() + 1) + "; - case "t": - return "this.getDaysInMonth() + "; - case "L": - return "(this.isLeapYear() ? 1 : 0) + "; - case "Y": - return "this.getFullYear() + "; - case "y": - return "('' + this.getFullYear()).substring(2, 4) + "; - case "a": - return "(this.getHours() < 12 ? 'am' : 'pm') + "; - case "A": - return "(this.getHours() < 12 ? 'AM' : 'PM') + "; - case "g": - return "((this.getHours() %12) ? this.getHours() % 12 : 12) + "; - case "G": - return "this.getHours() + "; - case "h": - return "String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + "; - case "H": - return "String.leftPad(this.getHours(), 2, '0') + "; - case "i": - return "String.leftPad(this.getMinutes(), 2, '0') + "; - case "s": - return "String.leftPad(this.getSeconds(), 2, '0') + "; - case "O": - return "this.getGMTOffset() + "; - case "T": - return "this.getTimezone() + "; - case "Z": - return "(this.getTimezoneOffset() * -60) + "; - default: - return "'" + String.escape(character) + "' + "; - } -} - -Date.parseDate = function(input, format) { - if (Date.parseFunctions[format] == null) { - Date.createParser(format); - } - var func = Date.parseFunctions[format]; - return Date[func](input); -} - -Date.createParser = function(format) { - var funcName = "parse" + Date.parseFunctions.count++; - var regexNum = Date.parseRegexes.length; - var currentGroup = 1; - Date.parseFunctions[format] = funcName; - - var code = "Date." + funcName + " = function(input){\n" - + "var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n" - + "var d = new Date();\n" - + "y = d.getFullYear();\n" - + "m = d.getMonth();\n" - + "d = d.getDate();\n" - + "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n" - + "if (results && results.length > 0) {" - var regex = ""; - - var special = false; - var ch = ''; - for (var i = 0; i < format.length; ++i) { - ch = format.charAt(i); - if (!special && ch == "\\") { - special = true; - } - else if (special) { - special = false; - regex += String.escape(ch); - } - else { - obj = Date.formatCodeToRegex(ch, currentGroup); - currentGroup += obj.g; - regex += obj.s; - if (obj.g && obj.c) { - code += obj.c; - } - } - } - - code += "if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n" - + "{return new Date(y, m, d, h, i, s);}\n" - + "else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n" - + "{return new Date(y, m, d, h, i);}\n" - + "else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n" - + "{return new Date(y, m, d, h);}\n" - + "else if (y > 0 && m >= 0 && d > 0)\n" - + "{return new Date(y, m, d);}\n" - + "else if (y > 0 && m >= 0)\n" - + "{return new Date(y, m);}\n" - + "else if (y > 0)\n" - + "{return new Date(y);}\n" - + "}return null;}"; - - Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$"); - eval(code); -} - -Date.formatCodeToRegex = function(character, currentGroup) { - switch (character) { - case "D": - return {g:0, - c:null, - s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"}; - case "j": - case "d": - return {g:1, - c:"d = parseInt(results[" + currentGroup + "], 10);\n", - s:"(\\d{1,2})"}; - case "l": - return {g:0, - c:null, - s:"(?:" + Date.dayNames.join("|") + ")"}; - case "S": - return {g:0, - c:null, - s:"(?:st|nd|rd|th)"}; - case "w": - return {g:0, - c:null, - s:"\\d"}; - case "z": - return {g:0, - c:null, - s:"(?:\\d{1,3})"}; - case "W": - return {g:0, - c:null, - s:"(?:\\d{2})"}; - case "F": - return {g:1, - c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "].substring(0, 3)], 10);\n", - s:"(" + Date.monthNames.join("|") + ")"}; - case "M": - return {g:1, - c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "]], 10);\n", - s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"}; - case "n": - case "m": - return {g:1, - c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n", - s:"(\\d{1,2})"}; - case "t": - return {g:0, - c:null, - s:"\\d{1,2}"}; - case "L": - return {g:0, - c:null, - s:"(?:1|0)"}; - case "Y": - return {g:1, - c:"y = parseInt(results[" + currentGroup + "], 10);\n", - s:"(\\d{4})"}; - case "y": - return {g:1, - c:"var ty = parseInt(results[" + currentGroup + "], 10);\n" - + "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", - s:"(\\d{1,2})"}; - case "a": - return {g:1, - c:"if (results[" + currentGroup + "] == 'am') {\n" - + "if (h == 12) { h = 0; }\n" - + "} else { if (h < 12) { h += 12; }}", - s:"(am|pm)"}; - case "A": - return {g:1, - c:"if (results[" + currentGroup + "] == 'AM') {\n" - + "if (h == 12) { h = 0; }\n" - + "} else { if (h < 12) { h += 12; }}", - s:"(AM|PM)"}; - case "g": - case "G": - case "h": - case "H": - return {g:1, - c:"h = parseInt(results[" + currentGroup + "], 10);\n", - s:"(\\d{1,2})"}; - case "i": - return {g:1, - c:"i = parseInt(results[" + currentGroup + "], 10);\n", - s:"(\\d{2})"}; - case "s": - return {g:1, - c:"s = parseInt(results[" + currentGroup + "], 10);\n", - s:"(\\d{2})"}; - case "O": - return {g:0, - c:null, - s:"[+-]\\d{4}"}; - case "T": - return {g:0, - c:null, - s:"[A-Z]{3}"}; - case "Z": - return {g:0, - c:null, - s:"[+-]\\d{1,5}"}; - default: - return {g:0, - c:null, - s:String.escape(character)}; - } -} - -Date.prototype.getTimezone = function() { - return this.toString().replace( - /^.*? ([A-Z]{3}) [0-9]{4}.*$/, "$1").replace( - /^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3"); -} - -Date.prototype.getGMTOffset = function() { - return (this.getTimezoneOffset() > 0 ? "-" : "+") - + String.leftPad(Math.floor(this.getTimezoneOffset() / 60), 2, "0") - + String.leftPad(this.getTimezoneOffset() % 60, 2, "0"); -} - -Date.prototype.getDayOfYear = function() { - var num = 0; - Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; - for (var i = 0; i < this.getMonth(); ++i) { - num += Date.daysInMonth[i]; - } - return num + this.getDate() - 1; -} - -Date.prototype.getWeekOfYear = function() { - // Skip to Thursday of this week - var now = this.getDayOfYear() + (4 - this.getDay()); - // Find the first Thursday of the year - var jan1 = new Date(this.getFullYear(), 0, 1); - var then = (7 - jan1.getDay() + 4); - document.write(then); - return String.leftPad(((now - then) / 7) + 1, 2, "0"); -} - -Date.prototype.isLeapYear = function() { - var year = this.getFullYear(); - return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year))); -} - -Date.prototype.getFirstDayOfMonth = function() { - var day = (this.getDay() - (this.getDate() - 1)) % 7; - return (day < 0) ? (day + 7) : day; -} - -Date.prototype.getLastDayOfMonth = function() { - var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7; - return (day < 0) ? (day + 7) : day; -} - -Date.prototype.getDaysInMonth = function() { - Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; - return Date.daysInMonth[this.getMonth()]; -} - -Date.prototype.getSuffix = function() { - switch (this.getDate()) { - case 1: - case 21: - case 31: - return "st"; - case 2: - case 22: - return "nd"; - case 3: - case 23: - return "rd"; - default: - return "th"; - } -} - -String.escape = function(string) { - return string.replace(/('|\\)/g, "\\$1"); -} - -String.leftPad = function (val, size, ch) { - var result = new String(val); - if (ch == null) { - ch = " "; - } - while (result.length < size) { - result = ch + result; - } - return result; -} - -Date.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31]; -Date.monthNames = - ["January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December"]; -Date.dayNames = - ["Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday"]; -Date.y2kYear = 50; -Date.monthNumbers = { - Jan:0, - Feb:1, - Mar:2, - Apr:3, - May:4, - Jun:5, - Jul:6, - Aug:7, - Sep:8, - Oct:9, - Nov:10, - Dec:11}; -Date.patterns = { - ISO8601LongPattern:"Y-m-d H:i:s", - ISO8601ShortPattern:"Y-m-d", - ShortDatePattern: "n/j/Y", - LongDatePattern: "l, F d, Y", - FullDateTimePattern: "l, F d, Y g:i:s A", - MonthDayPattern: "F d", - ShortTimePattern: "g:i A", - LongTimePattern: "g:i:s A", - SortableDateTimePattern: "Y-m-d\\TH:i:s", - UniversalSortableDateTimePattern: "Y-m-d H:i:sO", - YearMonthPattern: "F, Y"}; - -var date = new Date("1/1/2007 1:11:11"); - -for (i = 0; i < 4000; ++i) { - var shortFormat = date.dateFormat("Y-m-d"); - var longFormat = date.dateFormat("l, F d, Y g:i:s A"); - date.setTime(date.getTime() + 84266956); -} - -// FIXME: Find a way to validate this test. -// https://bugs.webkit.org/show_bug.cgi?id=114849 - -} catch (e) { - print("JSC EXCEPTION FUZZ: Caught exception: " + e); -} diff --git a/implementation-contributed/javascriptcore/exceptionFuzz/earley-boyer.js b/implementation-contributed/javascriptcore/exceptionFuzz/earley-boyer.js deleted file mode 100644 index 8a117611ab..0000000000 --- a/implementation-contributed/javascriptcore/exceptionFuzz/earley-boyer.js +++ /dev/null @@ -1,4693 +0,0 @@ -var enableExceptionFuzz = $vm.enableExceptionFuzz; - -try { -// This file is automatically generated by scheme2js, except for the -// benchmark harness code at the beginning and end of the file. - -/************* GENERATED FILE - DO NOT EDIT *************/ -/************* GENERATED FILE - DO NOT EDIT *************/ -/************* GENERATED FILE - DO NOT EDIT *************/ -/************* GENERATED FILE - DO NOT EDIT *************/ -/************* GENERATED FILE - DO NOT EDIT *************/ -/************* GENERATED FILE - DO NOT EDIT *************/ -/************* GENERATED FILE - DO NOT EDIT *************/ -/************* GENERATED FILE - DO NOT EDIT *************/ -/* - * To use write/prints/... the default-output port has to be set first. - * Simply setting SC_DEFAULT_OUT and SC_ERROR_OUT to the desired values - * should do the trick. - * In the following example the std-out and error-port are redirected to - * a DIV. -function initRuntime() { - function escapeHTML(s) { - var tmp = s; - tmp = tmp.replace(/&/g, "&"); - tmp = tmp.replace(//g, ">"); - tmp = tmp.replace(/ /g, " "); - tmp = tmp.replace(/\n/g, "
"); - tmp = tmp.replace(/\t/g, "    "); - return tmp; - - } - - document.write("
"); - SC_DEFAULT_OUT = new sc_GenericOutputPort( - function(s) { - var stdout = document.getElementById('stdout'); - stdout.innerHTML = stdout.innerHTML + escapeHTML(s); - }); - SC_ERROR_OUT = SC_DEFAULT_OUT; -} -*/ - -enableExceptionFuzz(); - - -function sc_print_debug() { - sc_print.apply(null, arguments); -} -/*** META ((export *js*)) */ -var sc_JS_GLOBALS = this; - -var __sc_LINE=-1; -var __sc_FILE=""; - -/*** META ((export #t)) */ -function sc_alert() { - var len = arguments.length; - var s = ""; - var i; - - for( i = 0; i < len; i++ ) { - s += sc_toDisplayString(arguments[ i ]); - } - - return alert( s ); -} - -/*** META ((export #t)) */ -function sc_typeof( x ) { - return typeof x; -} - -/*** META ((export #t)) */ -function sc_error() { - var a = [sc_jsstring2symbol("*error*")]; - for (var i = 0; i < arguments.length; i++) { - a[i+1] = arguments[i]; - } - throw a; -} - -/*** META ((export #t) - (peephole (prefix "throw "))) -*/ -function sc_raise(obj) { - throw obj; -} - -/*** META ((export with-handler-lambda)) */ -function sc_withHandlerLambda(handler, body) { - try { - return body(); - } catch(e) { - if (!e._internalException) - return handler(e); - else - throw e; - } -} - -var sc_properties = new Object(); - -/*** META ((export #t)) */ -function sc_putpropBang(sym, key, val) { - var ht = sc_properties[sym]; - if (!ht) { - ht = new Object(); - sc_properties[sym] = ht; - } - ht[key] = val; -} - -/*** META ((export #t)) */ -function sc_getprop(sym, key) { - var ht = sc_properties[sym]; - if (ht) { - if (key in ht) - return ht[key]; - else - return false; - } else - return false; -} - -/*** META ((export #t)) */ -function sc_rempropBang(sym, key) { - var ht = sc_properties[sym]; - if (ht) - delete ht[key]; -} - -/*** META ((export #t)) */ -function sc_any2String(o) { - return jsstring2string(sc_toDisplayString(o)); -} - -/*** META ((export #t) - (peephole (infix 2 2 "===")) - (type bool)) -*/ -function sc_isEqv(o1, o2) { - return (o1 === o2); -} - -/*** META ((export #t) - (peephole (infix 2 2 "===")) - (type bool)) -*/ -function sc_isEq(o1, o2) { - return (o1 === o2); -} - -/*** META ((export #t) - (type bool)) -*/ -function sc_isNumber(n) { - return (typeof n === "number"); -} - -/*** META ((export #t) - (type bool)) -*/ -function sc_isComplex(n) { - return sc_isNumber(n); -} - -/*** META ((export #t) - (type bool)) -*/ -function sc_isReal(n) { - return sc_isNumber(n); -} - -/*** META ((export #t) - (type bool)) -*/ -function sc_isRational(n) { - return sc_isReal(n); -} - -/*** META ((export #t) - (type bool)) -*/ -function sc_isInteger(n) { - return (parseInt(n) === n); -} - -/*** META ((export #t) - (type bool) - (peephole (postfix ", false"))) -*/ -// we don't have exact numbers... -function sc_isExact(n) { - return false; -} - -/*** META ((export #t) - (peephole (postfix ", true")) - (type bool)) -*/ -function sc_isInexact(n) { - return true; -} - -/*** META ((export = =fx =fl) - (type bool) - (peephole (infix 2 2 "==="))) -*/ -function sc_equal(x) { - for (var i = 1; i < arguments.length; i++) - if (x !== arguments[i]) - return false; - return true; -} - -/*** META ((export < = arguments[i]) - return false; - x = arguments[i]; - } - return true; -} - -/*** META ((export > >fx >fl) - (type bool) - (peephole (infix 2 2 ">"))) -*/ -function sc_greater(x, y) { - for (var i = 1; i < arguments.length; i++) { - if (x <= arguments[i]) - return false; - x = arguments[i]; - } - return true; -} - -/*** META ((export <= <=fx <=fl) - (type bool) - (peephole (infix 2 2 "<="))) -*/ -function sc_lessEqual(x, y) { - for (var i = 1; i < arguments.length; i++) { - if (x > arguments[i]) - return false; - x = arguments[i]; - } - return true; -} - -/*** META ((export >= >=fl >=fx) - (type bool) - (peephole (infix 2 2 ">="))) -*/ -function sc_greaterEqual(x, y) { - for (var i = 1; i < arguments.length; i++) { - if (x < arguments[i]) - return false; - x = arguments[i]; - } - return true; -} - -/*** META ((export #t) - (type bool) - (peephole (postfix "=== 0"))) -*/ -function sc_isZero(x) { - return (x === 0); -} - -/*** META ((export #t) - (type bool) - (peephole (postfix "> 0"))) -*/ -function sc_isPositive(x) { - return (x > 0); -} - -/*** META ((export #t) - (type bool) - (peephole (postfix "< 0"))) -*/ -function sc_isNegative(x) { - return (x < 0); -} - -/*** META ((export #t) - (type bool) - (peephole (postfix "%2===1"))) -*/ -function sc_isOdd(x) { - return (x % 2 === 1); -} - -/*** META ((export #t) - (type bool) - (peephole (postfix "%2===0"))) -*/ -function sc_isEven(x) { - return (x % 2 === 0); -} - -/*** META ((export #t)) */ -var sc_max = Math.max; -/*** META ((export #t)) */ -var sc_min = Math.min; - -/*** META ((export + +fx +fl) - (peephole (infix 0 #f "+" "0"))) -*/ -function sc_plus() { - var sum = 0; - for (var i = 0; i < arguments.length; i++) - sum += arguments[i]; - return sum; -} - -/*** META ((export * *fx *fl) - (peephole (infix 0 #f "*" "1"))) -*/ -function sc_multi() { - var product = 1; - for (var i = 0; i < arguments.length; i++) - product *= arguments[i]; - return product; -} - -/*** META ((export - -fx -fl) - (peephole (minus))) -*/ -function sc_minus(x) { - if (arguments.length === 1) - return -x; - else { - var res = x; - for (var i = 1; i < arguments.length; i++) - res -= arguments[i]; - return res; - } -} - -/*** META ((export / /fl) - (peephole (div))) -*/ -function sc_div(x) { - if (arguments.length === 1) - return 1/x; - else { - var res = x; - for (var i = 1; i < arguments.length; i++) - res /= arguments[i]; - return res; - } -} - -/*** META ((export #t)) */ -var sc_abs = Math.abs; - -/*** META ((export quotient /fx) - (peephole (hole 2 "parseInt(" x "/" y ")"))) -*/ -function sc_quotient(x, y) { - return parseInt(x / y); -} - -/*** META ((export #t) - (peephole (infix 2 2 "%"))) -*/ -function sc_remainder(x, y) { - return x % y; -} - -/*** META ((export #t) - (peephole (modulo))) -*/ -function sc_modulo(x, y) { - var remainder = x % y; - // if they don't have the same sign - if ((remainder * y) < 0) - return remainder + y; - else - return remainder; -} - -function sc_euclid_gcd(a, b) { - var temp; - if (a === 0) return b; - if (b === 0) return a; - if (a < 0) {a = -a;}; - if (b < 0) {b = -b;}; - if (b > a) {temp = a; a = b; b = temp;}; - while (true) { - a %= b; - if(a === 0) {return b;}; - b %= a; - if(b === 0) {return a;}; - }; - return b; -} - -/*** META ((export #t)) */ -function sc_gcd() { - var gcd = 0; - for (var i = 0; i < arguments.length; i++) - gcd = sc_euclid_gcd(gcd, arguments[i]); - return gcd; -} - -/*** META ((export #t)) */ -function sc_lcm() { - var lcm = 1; - for (var i = 0; i < arguments.length; i++) { - var f = Math.round(arguments[i] / sc_euclid_gcd(arguments[i], lcm)); - lcm *= Math.abs(f); - } - return lcm; -} - -// LIMITATION: numerator and denominator don't make sense in floating point world. -//var SC_MAX_DECIMALS = 1000000 -// -// function sc_numerator(x) { -// var rounded = Math.round(x * SC_MAX_DECIMALS); -// return Math.round(rounded / sc_euclid_gcd(rounded, SC_MAX_DECIMALS)); -// } - -// function sc_denominator(x) { -// var rounded = Math.round(x * SC_MAX_DECIMALS); -// return Math.round(SC_MAX_DECIMALS / sc_euclid_gcd(rounded, SC_MAX_DECIMALS)); -// } - -/*** META ((export #t)) */ -var sc_floor = Math.floor; -/*** META ((export #t)) */ -var sc_ceiling = Math.ceil; -/*** META ((export #t)) */ -var sc_truncate = parseInt; -/*** META ((export #t)) */ -var sc_round = Math.round; - -// LIMITATION: sc_rationalize doesn't make sense in a floating point world. - -/*** META ((export #t)) */ -var sc_exp = Math.exp; -/*** META ((export #t)) */ -var sc_log = Math.log; -/*** META ((export #t)) */ -var sc_sin = Math.sin; -/*** META ((export #t)) */ -var sc_cos = Math.cos; -/*** META ((export #t)) */ -var sc_tan = Math.tan; -/*** META ((export #t)) */ -var sc_asin = Math.asin; -/*** META ((export #t)) */ -var sc_acos = Math.acos; -/*** META ((export #t)) */ -var sc_atan = Math.atan; - -/*** META ((export #t)) */ -var sc_sqrt = Math.sqrt; -/*** META ((export #t)) */ -var sc_expt = Math.pow; - -// LIMITATION: we don't have complex numbers. -// LIMITATION: the following functions are hence not implemented. -// LIMITATION: make-rectangular, make-polar, real-part, imag-part, magnitude, angle -// LIMITATION: 2 argument atan - -/*** META ((export #t) - (peephole (id))) -*/ -function sc_exact2inexact(x) { - return x; -} - -/*** META ((export #t) - (peephole (id))) -*/ -function sc_inexact2exact(x) { - return x; -} - -function sc_number2jsstring(x, radix) { - if (radix) - return x.toString(radix); - else - return x.toString(); -} - -function sc_jsstring2number(s, radix) { - if (s === "") return false; - - if (radix) { - var t = parseInt(s, radix); - if (!t && t !== 0) return false; - // verify that each char is in range. (parseInt ignores leading - // white and trailing chars) - var allowedChars = "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix+1); - if ((new RegExp("^["+allowedChars+"]*$", "i")).test(s)) - return t; - else return false; - } else { - var t = +s; // does not ignore trailing chars. - if (!t && t !== 0) return false; - // simply verify that first char is not whitespace. - var c = s.charAt(0); - // if +c is 0, but the char is not "0", then we have a whitespace. - if (+c === 0 && c !== "0") return false; - return t; - } -} - -/*** META ((export #t) - (type bool) - (peephole (not))) -*/ -function sc_not(b) { - return b === false; -} - -/*** META ((export #t) - (type bool)) -*/ -function sc_isBoolean(b) { - return (b === true) || (b === false); -} - -function sc_Pair(car, cdr) { - this.car = car; - this.cdr = cdr; -} - -sc_Pair.prototype.toString = function() { - return sc_toDisplayString(this); -}; -sc_Pair.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) { - var current = this; - - var res = "("; - - while(true) { - res += writeOrDisplay(current.car); - if (sc_isPair(current.cdr)) { - res += " "; - current = current.cdr; - } else if (current.cdr !== null) { - res += " . " + writeOrDisplay(current.cdr); - break; - } else // current.cdr == null - break; - } - - res += ")"; - - return res; -}; -sc_Pair.prototype.sc_toDisplayString = function() { - return this.sc_toWriteOrDisplayString(sc_toDisplayString); -}; -sc_Pair.prototype.sc_toWriteString = function() { - return this.sc_toWriteOrDisplayString(sc_toWriteString); -}; -// sc_Pair.prototype.sc_toWriteCircleString in IO.js - -/*** META ((export #t) - (type bool) - (peephole (postfix " instanceof sc_Pair"))) -*/ -function sc_isPair(p) { - return (p instanceof sc_Pair); -} - -function sc_isPairEqual(p1, p2, comp) { - return (comp(p1.car, p2.car) && comp(p1.cdr, p2.cdr)); -} - -/*** META ((export #t) - (peephole (hole 2 "new sc_Pair(" car ", " cdr ")"))) -*/ -function sc_cons(car, cdr) { - return new sc_Pair(car, cdr); -} - -/*** META ((export cons*)) */ -function sc_consStar() { - var res = arguments[arguments.length - 1]; - for (var i = arguments.length-2; i >= 0; i--) - res = new sc_Pair(arguments[i], res); - return res; -} - -/*** META ((export #t) - (peephole (postfix ".car"))) -*/ -function sc_car(p) { - return p.car; -} - -/*** META ((export #t) - (peephole (postfix ".cdr"))) -*/ -function sc_cdr(p) { - return p.cdr; -} - -/*** META ((export #t) - (peephole (hole 2 p ".car = " val))) -*/ -function sc_setCarBang(p, val) { - p.car = val; -} - -/*** META ((export #t) - (peephole (hole 2 p ".cdr = " val))) -*/ -function sc_setCdrBang(p, val) { - p.cdr = val; -} - -/*** META ((export #t) - (peephole (postfix ".car.car"))) -*/ -function sc_caar(p) { return p.car.car; } -/*** META ((export #t) - (peephole (postfix ".cdr.car"))) -*/ -function sc_cadr(p) { return p.cdr.car; } -/*** META ((export #t) - (peephole (postfix ".car.cdr"))) -*/ -function sc_cdar(p) { return p.car.cdr; } -/*** META ((export #t) - (peephole (postfix ".cdr.cdr"))) -*/ -function sc_cddr(p) { return p.cdr.cdr; } -/*** META ((export #t) - (peephole (postfix ".car.car.car"))) -*/ -function sc_caaar(p) { return p.car.car.car; } -/*** META ((export #t) - (peephole (postfix ".car.cdr.car"))) -*/ -function sc_cadar(p) { return p.car.cdr.car; } -/*** META ((export #t) - (peephole (postfix ".cdr.car.car"))) -*/ -function sc_caadr(p) { return p.cdr.car.car; } -/*** META ((export #t) - (peephole (postfix ".cdr.cdr.car"))) -*/ -function sc_caddr(p) { return p.cdr.cdr.car; } -/*** META ((export #t) - (peephole (postfix ".car.car.cdr"))) -*/ -function sc_cdaar(p) { return p.car.car.cdr; } -/*** META ((export #t) - (peephole (postfix ".cdr.car.cdr"))) -*/ -function sc_cdadr(p) { return p.cdr.car.cdr; } -/*** META ((export #t) - (peephole (postfix ".car.cdr.cdr"))) -*/ -function sc_cddar(p) { return p.car.cdr.cdr; } -/*** META ((export #t) - (peephole (postfix ".cdr.cdr.cdr"))) -*/ -function sc_cdddr(p) { return p.cdr.cdr.cdr; } -/*** META ((export #t) - (peephole (postfix ".car.car.car.car"))) -*/ -function sc_caaaar(p) { return p.car.car.car.car; } -/*** META ((export #t) - (peephole (postfix ".car.cdr.car.car"))) -*/ -function sc_caadar(p) { return p.car.cdr.car.car; } -/*** META ((export #t) - (peephole (postfix ".cdr.car.car.car"))) -*/ -function sc_caaadr(p) { return p.cdr.car.car.car; } -/*** META ((export #t) - (peephole (postfix ".cdr.cdr.car.car"))) -*/ -function sc_caaddr(p) { return p.cdr.cdr.car.car; } -/*** META ((export #t) - (peephole (postfix ".car.car.car.cdr"))) -*/ -function sc_cdaaar(p) { return p.car.car.car.cdr; } -/*** META ((export #t) - (peephole (postfix ".car.cdr.car.cdr"))) -*/ -function sc_cdadar(p) { return p.car.cdr.car.cdr; } -/*** META ((export #t) - (peephole (postfix ".cdr.car.car.cdr"))) -*/ -function sc_cdaadr(p) { return p.cdr.car.car.cdr; } -/*** META ((export #t) - (peephole (postfix ".cdr.cdr.car.cdr"))) -*/ -function sc_cdaddr(p) { return p.cdr.cdr.car.cdr; } -/*** META ((export #t) - (peephole (postfix ".car.car.cdr.car"))) -*/ -function sc_cadaar(p) { return p.car.car.cdr.car; } -/*** META ((export #t) - (peephole (postfix ".car.cdr.cdr.car"))) -*/ -function sc_caddar(p) { return p.car.cdr.cdr.car; } -/*** META ((export #t) - (peephole (postfix ".cdr.car.cdr.car"))) -*/ -function sc_cadadr(p) { return p.cdr.car.cdr.car; } -/*** META ((export #t) - (peephole (postfix ".cdr.cdr.cdr.car"))) -*/ -function sc_cadddr(p) { return p.cdr.cdr.cdr.car; } -/*** META ((export #t) - (peephole (postfix ".car.car.cdr.cdr"))) -*/ -function sc_cddaar(p) { return p.car.car.cdr.cdr; } -/*** META ((export #t) - (peephole (postfix ".car.cdr.cdr.cdr"))) -*/ -function sc_cdddar(p) { return p.car.cdr.cdr.cdr; } -/*** META ((export #t) - (peephole (postfix ".cdr.car.cdr.cdr"))) -*/ -function sc_cddadr(p) { return p.cdr.car.cdr.cdr; } -/*** META ((export #t) - (peephole (postfix ".cdr.cdr.cdr.cdr"))) -*/ -function sc_cddddr(p) { return p.cdr.cdr.cdr.cdr; } - -/*** META ((export #t)) */ -function sc_lastPair(l) { - if (!sc_isPair(l)) sc_error("sc_lastPair: pair expected"); - var res = l; - var cdr = l.cdr; - while (sc_isPair(cdr)) { - res = cdr; - cdr = res.cdr; - } - return res; -} - -/*** META ((export #t) - (type bool) - (peephole (postfix " === null"))) -*/ -function sc_isNull(o) { - return (o === null); -} - -/*** META ((export #t) - (type bool)) -*/ -function sc_isList(o) { - var rabbit; - var turtle; - - var rabbit = o; - var turtle = o; - while (true) { - if (rabbit === null || - (rabbit instanceof sc_Pair && rabbit.cdr === null)) - return true; // end of list - else if ((rabbit instanceof sc_Pair) && - (rabbit.cdr instanceof sc_Pair)) { - rabbit = rabbit.cdr.cdr; - turtle = turtle.cdr; - if (rabbit === turtle) return false; // cycle - } else - return false; // not pair - } -} - -/*** META ((export #t)) */ -function sc_list() { - var res = null; - var a = arguments; - for (var i = a.length-1; i >= 0; i--) - res = new sc_Pair(a[i], res); - return res; -} - -/*** META ((export #t)) */ -function sc_iota(num, init) { - var res = null; - if (!init) init = 0; - for (var i = num - 1; i >= 0; i--) - res = new sc_Pair(i + init, res); - return res; -} - -/*** META ((export #t)) */ -function sc_makeList(nbEls, fill) { - var res = null; - for (var i = 0; i < nbEls; i++) - res = new sc_Pair(fill, res); - return res; -} - -/*** META ((export #t)) */ -function sc_length(l) { - var res = 0; - while (l !== null) { - res++; - l = l.cdr; - } - return res; -} - -/*** META ((export #t)) */ -function sc_remq(o, l) { - var dummy = { cdr : null }; - var tail = dummy; - while (l !== null) { - if (l.car !== o) { - tail.cdr = sc_cons(l.car, null); - tail = tail.cdr; - } - l = l.cdr; - } - return dummy.cdr; -} - -/*** META ((export #t)) */ -function sc_remqBang(o, l) { - var dummy = { cdr : null }; - var tail = dummy; - var needsAssig = true; - while (l !== null) { - if (l.car === o) { - needsAssig = true; - } else { - if (needsAssig) { - tail.cdr = l; - needsAssig = false; - } - tail = l; - } - l = l.cdr; - } - tail.cdr = null; - return dummy.cdr; -} - -/*** META ((export #t)) */ -function sc_delete(o, l) { - var dummy = { cdr : null }; - var tail = dummy; - while (l !== null) { - if (!sc_isEqual(l.car, o)) { - tail.cdr = sc_cons(l.car, null); - tail = tail.cdr; - } - l = l.cdr; - } - return dummy.cdr; -} - -/*** META ((export #t)) */ -function sc_deleteBang(o, l) { - var dummy = { cdr : null }; - var tail = dummy; - var needsAssig = true; - while (l !== null) { - if (sc_isEqual(l.car, o)) { - needsAssig = true; - } else { - if (needsAssig) { - tail.cdr = l; - needsAssig = false; - } - tail = l; - } - l = l.cdr; - } - tail.cdr = null; - return dummy.cdr; -} - -function sc_reverseAppendBang(l1, l2) { - var res = l2; - while (l1 !== null) { - var tmp = res; - res = l1; - l1 = l1.cdr; - res.cdr = tmp; - } - return res; -} - -function sc_dualAppend(l1, l2) { - if (l1 === null) return l2; - if (l2 === null) return l1; - var rev = sc_reverse(l1); - return sc_reverseAppendBang(rev, l2); -} - -/*** META ((export #t)) */ -function sc_append() { - if (arguments.length === 0) - return null; - var res = arguments[arguments.length - 1]; - for (var i = arguments.length - 2; i >= 0; i--) - res = sc_dualAppend(arguments[i], res); - return res; -} - -function sc_dualAppendBang(l1, l2) { - if (l1 === null) return l2; - if (l2 === null) return l1; - var tmp = l1; - while (tmp.cdr !== null) tmp=tmp.cdr; - tmp.cdr = l2; - return l1; -} - -/*** META ((export #t)) */ -function sc_appendBang() { - var res = null; - for (var i = 0; i < arguments.length; i++) - res = sc_dualAppendBang(res, arguments[i]); - return res; -} - -/*** META ((export #t)) */ -function sc_reverse(l1) { - var res = null; - while (l1 !== null) { - res = sc_cons(l1.car, res); - l1 = l1.cdr; - } - return res; -} - -/*** META ((export #t)) */ -function sc_reverseBang(l) { - return sc_reverseAppendBang(l, null); -} - -/*** META ((export #t)) */ -function sc_listTail(l, k) { - var res = l; - for (var i = 0; i < k; i++) { - res = res.cdr; - } - return res; -} - -/*** META ((export #t)) */ -function sc_listRef(l, k) { - return sc_listTail(l, k).car; -} - -/* // unoptimized generic versions -function sc_memX(o, l, comp) { - while (l != null) { - if (comp(l.car, o)) - return l; - l = l.cdr; - } - return false; -} -function sc_memq(o, l) { return sc_memX(o, l, sc_isEq); } -function sc_memv(o, l) { return sc_memX(o, l, sc_isEqv); } -function sc_member(o, l) { return sc_memX(o, l, sc_isEqual); } -*/ - -/* optimized versions */ -/*** META ((export #t)) */ -function sc_memq(o, l) { - while (l !== null) { - if (l.car === o) - return l; - l = l.cdr; - } - return false; -} -/*** META ((export #t)) */ -function sc_memv(o, l) { - while (l !== null) { - if (l.car === o) - return l; - l = l.cdr; - } - return false; -} -/*** META ((export #t)) */ -function sc_member(o, l) { - while (l !== null) { - if (sc_isEqual(l.car,o)) - return l; - l = l.cdr; - } - return false; -} - -/* // generic unoptimized versions -function sc_assX(o, al, comp) { - while (al != null) { - if (comp(al.car.car, o)) - return al.car; - al = al.cdr; - } - return false; -} -function sc_assq(o, al) { return sc_assX(o, al, sc_isEq); } -function sc_assv(o, al) { return sc_assX(o, al, sc_isEqv); } -function sc_assoc(o, al) { return sc_assX(o, al, sc_isEqual); } -*/ -// optimized versions -/*** META ((export #t)) */ -function sc_assq(o, al) { - while (al !== null) { - if (al.car.car === o) - return al.car; - al = al.cdr; - } - return false; -} -/*** META ((export #t)) */ -function sc_assv(o, al) { - while (al !== null) { - if (al.car.car === o) - return al.car; - al = al.cdr; - } - return false; -} -/*** META ((export #t)) */ -function sc_assoc(o, al) { - while (al !== null) { - if (sc_isEqual(al.car.car, o)) - return al.car; - al = al.cdr; - } - return false; -} - -/* can be used for mutable strings and characters */ -function sc_isCharStringEqual(cs1, cs2) { return cs1.val === cs2.val; } -function sc_isCharStringLess(cs1, cs2) { return cs1.val < cs2.val; } -function sc_isCharStringGreater(cs1, cs2) { return cs1.val > cs2.val; } -function sc_isCharStringLessEqual(cs1, cs2) { return cs1.val <= cs2.val; } -function sc_isCharStringGreaterEqual(cs1, cs2) { return cs1.val >= cs2.val; } -function sc_isCharStringCIEqual(cs1, cs2) - { return cs1.val.toLowerCase() === cs2.val.toLowerCase(); } -function sc_isCharStringCILess(cs1, cs2) - { return cs1.val.toLowerCase() < cs2.val.toLowerCase(); } -function sc_isCharStringCIGreater(cs1, cs2) - { return cs1.val.toLowerCase() > cs2.val.toLowerCase(); } -function sc_isCharStringCILessEqual(cs1, cs2) - { return cs1.val.toLowerCase() <= cs2.val.toLowerCase(); } -function sc_isCharStringCIGreaterEqual(cs1, cs2) - { return cs1.val.toLowerCase() >= cs2.val.toLowerCase(); } - - - - -function sc_Char(c) { - var cached = sc_Char.lazy[c]; - if (cached) - return cached; - this.val = c; - sc_Char.lazy[c] = this; - // add return, so FF does not complain. - return undefined; -} -sc_Char.lazy = new Object(); -// thanks to Eric -sc_Char.char2readable = { - "\000": "#\\null", - "\007": "#\\bell", - "\010": "#\\backspace", - "\011": "#\\tab", - "\012": "#\\newline", - "\014": "#\\page", - "\015": "#\\return", - "\033": "#\\escape", - "\040": "#\\space", - "\177": "#\\delete", - - /* poeticless names */ - "\001": "#\\soh", - "\002": "#\\stx", - "\003": "#\\etx", - "\004": "#\\eot", - "\005": "#\\enq", - "\006": "#\\ack", - - "\013": "#\\vt", - "\016": "#\\so", - "\017": "#\\si", - - "\020": "#\\dle", - "\021": "#\\dc1", - "\022": "#\\dc2", - "\023": "#\\dc3", - "\024": "#\\dc4", - "\025": "#\\nak", - "\026": "#\\syn", - "\027": "#\\etb", - - "\030": "#\\can", - "\031": "#\\em", - "\032": "#\\sub", - "\033": "#\\esc", - "\034": "#\\fs", - "\035": "#\\gs", - "\036": "#\\rs", - "\037": "#\\us"}; - -sc_Char.readable2char = { - "null": "\000", - "bell": "\007", - "backspace": "\010", - "tab": "\011", - "newline": "\012", - "page": "\014", - "return": "\015", - "escape": "\033", - "space": "\040", - "delete": "\000", - "soh": "\001", - "stx": "\002", - "etx": "\003", - "eot": "\004", - "enq": "\005", - "ack": "\006", - "bel": "\007", - "bs": "\010", - "ht": "\011", - "nl": "\012", - "vt": "\013", - "np": "\014", - "cr": "\015", - "so": "\016", - "si": "\017", - "dle": "\020", - "dc1": "\021", - "dc2": "\022", - "dc3": "\023", - "dc4": "\024", - "nak": "\025", - "syn": "\026", - "etb": "\027", - "can": "\030", - "em": "\031", - "sub": "\032", - "esc": "\033", - "fs": "\034", - "gs": "\035", - "rs": "\036", - "us": "\037", - "sp": "\040", - "del": "\177"}; - -sc_Char.prototype.toString = function() { - return this.val; -}; -// sc_toDisplayString == toString -sc_Char.prototype.sc_toWriteString = function() { - var entry = sc_Char.char2readable[this.val]; - if (entry) - return entry; - else - return "#\\" + this.val; -}; - -/*** META ((export #t) - (type bool) - (peephole (postfix "instanceof sc_Char"))) -*/ -function sc_isChar(c) { - return (c instanceof sc_Char); -} - -/*** META ((export char=?) - (type bool) - (peephole (hole 2 c1 ".val === " c2 ".val"))) -*/ -var sc_isCharEqual = sc_isCharStringEqual; -/*** META ((export char?) - (type bool) - (peephole (hole 2 c1 ".val > " c2 ".val"))) -*/ -var sc_isCharGreater = sc_isCharStringGreater; -/*** META ((export char<=?) - (type bool) - (peephole (hole 2 c1 ".val <= " c2 ".val"))) -*/ -var sc_isCharLessEqual = sc_isCharStringLessEqual; -/*** META ((export char>=?) - (type bool) - (peephole (hole 2 c1 ".val >= " c2 ".val"))) -*/ -var sc_isCharGreaterEqual = sc_isCharStringGreaterEqual; -/*** META ((export char-ci=?) - (type bool) - (peephole (hole 2 c1 ".val.toLowerCase() === " c2 ".val.toLowerCase()"))) -*/ -var sc_isCharCIEqual = sc_isCharStringCIEqual; -/*** META ((export char-ci?) - (type bool) - (peephole (hole 2 c1 ".val.toLowerCase() > " c2 ".val.toLowerCase()"))) -*/ -var sc_isCharCIGreater = sc_isCharStringCIGreater; -/*** META ((export char-ci<=?) - (type bool) - (peephole (hole 2 c1 ".val.toLowerCase() <= " c2 ".val.toLowerCase()"))) -*/ -var sc_isCharCILessEqual = sc_isCharStringCILessEqual; -/*** META ((export char-ci>=?) - (type bool) - (peephole (hole 2 c1 ".val.toLowerCase() >= " c2 ".val.toLowerCase()"))) -*/ -var sc_isCharCIGreaterEqual = sc_isCharStringCIGreaterEqual; - -var SC_NUMBER_CLASS = "0123456789"; -var SC_WHITESPACE_CLASS = ' \r\n\t\f'; -var SC_LOWER_CLASS = 'abcdefghijklmnopqrstuvwxyz'; -var SC_UPPER_CLASS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - -function sc_isCharOfClass(c, cl) { return (cl.indexOf(c) != -1); } -/*** META ((export #t) - (type bool)) -*/ -function sc_isCharAlphabetic(c) - { return sc_isCharOfClass(c.val, SC_LOWER_CLASS) || - sc_isCharOfClass(c.val, SC_UPPER_CLASS); } -/*** META ((export #t) - (type bool) - (peephole (hole 1 "SC_NUMBER_CLASS.indexOf(" c ".val) != -1"))) -*/ -function sc_isCharNumeric(c) - { return sc_isCharOfClass(c.val, SC_NUMBER_CLASS); } -/*** META ((export #t) - (type bool)) -*/ -function sc_isCharWhitespace(c) { - var tmp = c.val; - return tmp === " " || tmp === "\r" || tmp === "\n" || tmp === "\t" || tmp === "\f"; -} -/*** META ((export #t) - (type bool) - (peephole (hole 1 "SC_UPPER_CLASS.indexOf(" c ".val) != -1"))) -*/ -function sc_isCharUpperCase(c) - { return sc_isCharOfClass(c.val, SC_UPPER_CLASS); } -/*** META ((export #t) - (type bool) - (peephole (hole 1 "SC_LOWER_CLASS.indexOf(" c ".val) != -1"))) -*/ -function sc_isCharLowerCase(c) - { return sc_isCharOfClass(c.val, SC_LOWER_CLASS); } - -/*** META ((export #t) - (peephole (postfix ".val.charCodeAt(0)"))) -*/ -function sc_char2integer(c) - { return c.val.charCodeAt(0); } -/*** META ((export #t) - (peephole (hole 1 "new sc_Char(String.fromCharCode(" n "))"))) -*/ -function sc_integer2char(n) - { return new sc_Char(String.fromCharCode(n)); } - -/*** META ((export #t) - (peephole (hole 1 "new sc_Char(" c ".val.toUpperCase())"))) -*/ -function sc_charUpcase(c) - { return new sc_Char(c.val.toUpperCase()); } -/*** META ((export #t) - (peephole (hole 1 "new sc_Char(" c ".val.toLowerCase())"))) -*/ -function sc_charDowncase(c) - { return new sc_Char(c.val.toLowerCase()); } - -function sc_makeJSStringOfLength(k, c) { - var fill; - if (c === undefined) - fill = " "; - else - fill = c; - var res = ""; - var len = 1; - // every round doubles the size of fill. - while (k >= len) { - if (k & len) - res = res.concat(fill); - fill = fill.concat(fill); - len *= 2; - } - return res; -} - -function sc_makejsString(k, c) { - var fill; - if (c) - fill = c.val; - else - fill = " "; - return sc_makeJSStringOfLength(k, fill); -} - -function sc_jsstring2list(s) { - var res = null; - for (var i = s.length - 1; i >= 0; i--) - res = sc_cons(new sc_Char(s.charAt(i)), res); - return res; -} - -function sc_list2jsstring(l) { - var a = new Array(); - while(l !== null) { - a.push(l.car.val); - l = l.cdr; - } - return "".concat.apply("", a); -} - -var sc_Vector = Array; - -sc_Vector.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) { - if (this.length === 0) return "#()"; - - var res = "#(" + writeOrDisplay(this[0]); - for (var i = 1; i < this.length; i++) - res += " " + writeOrDisplay(this[i]); - res += ")"; - return res; -}; -sc_Vector.prototype.sc_toDisplayString = function() { - return this.sc_toWriteOrDisplayString(sc_toDisplayString); -}; -sc_Vector.prototype.sc_toWriteString = function() { - return this.sc_toWriteOrDisplayString(sc_toWriteString); -}; - -/*** META ((export vector? array?) - (type bool) - (peephole (postfix " instanceof sc_Vector"))) -*/ -function sc_isVector(v) { - return (v instanceof sc_Vector); -} - -// only applies to vectors -function sc_isVectorEqual(v1, v2, comp) { - if (v1.length !== v2.length) return false; - for (var i = 0; i < v1.length; i++) - if (!comp(v1[i], v2[i])) return false; - return true; -} - -/*** META ((export make-vector make-array)) */ -function sc_makeVector(size, fill) { - var a = new sc_Vector(size); - if (fill !== undefined) - sc_vectorFillBang(a, fill); - return a; -} - -/*** META ((export vector array) - (peephole (vector))) -*/ -function sc_vector() { - var a = new sc_Vector(); - for (var i = 0; i < arguments.length; i++) - a.push(arguments[i]); - return a; -} - -/*** META ((export vector-length array-length) - (peephole (postfix ".length"))) -*/ -function sc_vectorLength(v) { - return v.length; -} - -/*** META ((export vector-ref array-ref) - (peephole (hole 2 v "[" pos "]"))) -*/ -function sc_vectorRef(v, pos) { - return v[pos]; -} - -/*** META ((export vector-set! array-set!) - (peephole (hole 3 v "[" pos "] = " val))) -*/ -function sc_vectorSetBang(v, pos, val) { - v[pos] = val; -} - -/*** META ((export vector->list array->list)) */ -function sc_vector2list(a) { - var res = null; - for (var i = a.length-1; i >= 0; i--) - res = sc_cons(a[i], res); - return res; -} - -/*** META ((export list->vector list->array)) */ -function sc_list2vector(l) { - var a = new sc_Vector(); - while(l !== null) { - a.push(l.car); - l = l.cdr; - } - return a; -} - -/*** META ((export vector-fill! array-fill!)) */ -function sc_vectorFillBang(a, fill) { - for (var i = 0; i < a.length; i++) - a[i] = fill; -} - - -/*** META ((export #t)) */ -function sc_copyVector(a, len) { - if (len <= a.length) - return a.slice(0, len); - else { - var tmp = a.concat(); - tmp.length = len; - return tmp; - } -} - -/*** META ((export #t) - (peephole (hole 3 a ".slice(" start "," end ")"))) -*/ -function sc_vectorCopy(a, start, end) { - return a.slice(start, end); -} - -/*** META ((export #t)) */ -function sc_vectorCopyBang(target, tstart, source, sstart, send) { - if (!sstart) sstart = 0; - if (!send) send = source.length; - - // if target == source we don't want to overwrite not yet copied elements. - if (tstart <= sstart) { - for (var i = tstart, j = sstart; j < send; i++, j++) { - target[i] = source[j]; - } - } else { - var diff = send - sstart; - for (var i = tstart + diff - 1, j = send - 1; - j >= sstart; - i--, j--) { - target[i] = source[j]; - } - } - return target; -} - -/*** META ((export #t) - (type bool) - (peephole (hole 1 "typeof " o " === 'function'"))) -*/ -function sc_isProcedure(o) { - return (typeof o === "function"); -} - -/*** META ((export #t)) */ -function sc_apply(proc) { - var args = new Array(); - // first part of arguments are not in list-form. - for (var i = 1; i < arguments.length - 1; i++) - args.push(arguments[i]); - var l = arguments[arguments.length - 1]; - while (l !== null) { - args.push(l.car); - l = l.cdr; - } - return proc.apply(null, args); -} - -/*** META ((export #t)) */ -function sc_map(proc, l1) { - if (l1 === undefined) - return null; - // else - var nbApplyArgs = arguments.length - 1; - var applyArgs = new Array(nbApplyArgs); - var revres = null; - while (l1 !== null) { - for (var i = 0; i < nbApplyArgs; i++) { - applyArgs[i] = arguments[i + 1].car; - arguments[i + 1] = arguments[i + 1].cdr; - } - revres = sc_cons(proc.apply(null, applyArgs), revres); - } - return sc_reverseAppendBang(revres, null); -} - -/*** META ((export #t)) */ -function sc_mapBang(proc, l1) { - if (l1 === undefined) - return null; - // else - var l1_orig = l1; - var nbApplyArgs = arguments.length - 1; - var applyArgs = new Array(nbApplyArgs); - while (l1 !== null) { - var tmp = l1; - for (var i = 0; i < nbApplyArgs; i++) { - applyArgs[i] = arguments[i + 1].car; - arguments[i + 1] = arguments[i + 1].cdr; - } - tmp.car = proc.apply(null, applyArgs); - } - return l1_orig; -} - -/*** META ((export #t)) */ -function sc_forEach(proc, l1) { - if (l1 === undefined) - return undefined; - // else - var nbApplyArgs = arguments.length - 1; - var applyArgs = new Array(nbApplyArgs); - while (l1 !== null) { - for (var i = 0; i < nbApplyArgs; i++) { - applyArgs[i] = arguments[i + 1].car; - arguments[i + 1] = arguments[i + 1].cdr; - } - proc.apply(null, applyArgs); - } - // add return so FF does not complain. - return undefined; -} - -/*** META ((export #t)) */ -function sc_filter(proc, l1) { - var dummy = { cdr : null }; - var tail = dummy; - while (l1 !== null) { - if (proc(l1.car) !== false) { - tail.cdr = sc_cons(l1.car, null); - tail = tail.cdr; - } - l1 = l1.cdr; - } - return dummy.cdr; -} - -/*** META ((export #t)) */ -function sc_filterBang(proc, l1) { - var head = sc_cons("dummy", l1); - var it = head; - var next = l1; - while (next !== null) { - if (proc(next.car) !== false) { - it.cdr = next - it = next; - } - next = next.cdr; - } - it.cdr = null; - return head.cdr; -} - -function sc_filterMap1(proc, l1) { - var revres = null; - while (l1 !== null) { - var tmp = proc(l1.car) - if (tmp !== false) revres = sc_cons(tmp, revres); - l1 = l1.cdr; - } - return sc_reverseAppendBang(revres, null); -} -function sc_filterMap2(proc, l1, l2) { - var revres = null; - while (l1 !== null) { - var tmp = proc(l1.car, l2.car); - if(tmp !== false) revres = sc_cons(tmp, revres); - l1 = l1.cdr; - l2 = l2.cdr - } - return sc_reverseAppendBang(revres, null); -} - -/*** META ((export #t)) */ -function sc_filterMap(proc, l1, l2, l3) { - if (l2 === undefined) - return sc_filterMap1(proc, l1); - else if (l3 === undefined) - return sc_filterMap2(proc, l1, l2); - // else - var nbApplyArgs = arguments.length - 1; - var applyArgs = new Array(nbApplyArgs); - var revres = null; - while (l1 !== null) { - for (var i = 0; i < nbApplyArgs; i++) { - applyArgs[i] = arguments[i + 1].car; - arguments[i + 1] = arguments[i + 1].cdr; - } - var tmp = proc.apply(null, applyArgs); - if(tmp !== false) revres = sc_cons(tmp, revres); - } - return sc_reverseAppendBang(revres, null); -} - -/*** META ((export #t)) */ -function sc_any(proc, l) { - var revres = null; - while (l !== null) { - var tmp = proc(l.car); - if(tmp !== false) return tmp; - l = l.cdr; - } - return false; -} - -/*** META ((export any?) - (peephole (hole 2 "sc_any(" proc "," l ") !== false"))) -*/ -function sc_anyPred(proc, l) { - return sc_any(proc, l)!== false; -} - -/*** META ((export #t)) */ -function sc_every(proc, l) { - var revres = null; - var tmp = true; - while (l !== null) { - tmp = proc(l.car); - if (tmp === false) return false; - l = l.cdr; - } - return tmp; -} - -/*** META ((export every?) - (peephole (hole 2 "sc_every(" proc "," l ") !== false"))) -*/ -function sc_everyPred(proc, l) { - var tmp = sc_every(proc, l); - if (tmp !== false) return true; - return false; -} - -/*** META ((export #t) - (peephole (postfix "()"))) -*/ -function sc_force(o) { - return o(); -} - -/*** META ((export #t)) */ -function sc_makePromise(proc) { - var isResultReady = false; - var result = undefined; - return function() { - if (!isResultReady) { - var tmp = proc(); - if (!isResultReady) { - isResultReady = true; - result = tmp; - } - } - return result; - }; -} - -function sc_Values(values) { - this.values = values; -} - -/*** META ((export #t) - (peephole (values))) -*/ -function sc_values() { - if (arguments.length === 1) - return arguments[0]; - else - return new sc_Values(arguments); -} - -/*** META ((export #t)) */ -function sc_callWithValues(producer, consumer) { - var produced = producer(); - if (produced instanceof sc_Values) - return consumer.apply(null, produced.values); - else - return consumer(produced); -} - -/*** META ((export #t)) */ -function sc_dynamicWind(before, thunk, after) { - before(); - try { - var res = thunk(); - return res; - } finally { - after(); - } -} - - -// TODO: eval/scheme-report-environment/null-environment/interaction-environment - -// LIMITATION: 'load' doesn't exist without files. -// LIMITATION: transcript-on/transcript-off doesn't exist without files. - - -function sc_Struct(name) { - this.name = name; -} -sc_Struct.prototype.sc_toDisplayString = function() { - return "#"; -}; -sc_Struct.prototype.sc_toWriteString = sc_Struct.prototype.sc_toDisplayString; - -/*** META ((export #t) - (peephole (hole 1 "new sc_Struct(" name ")"))) -*/ -function sc_makeStruct(name) { - return new sc_Struct(name); -} - -/*** META ((export #t) - (type bool) - (peephole (postfix " instanceof sc_Struct"))) -*/ -function sc_isStruct(o) { - return (o instanceof sc_Struct); -} - -/*** META ((export #t) - (type bool) - (peephole (hole 2 "(" 1 " instanceof sc_Struct) && ( " 1 ".name === " 0 ")"))) -*/ -function sc_isStructNamed(name, s) { - return ((s instanceof sc_Struct) && (s.name === name)); -} - -/*** META ((export struct-field) - (peephole (hole 3 0 "[" 2 "]"))) -*/ -function sc_getStructField(s, name, field) { - return s[field]; -} - -/*** META ((export struct-field-set!) - (peephole (hole 4 0 "[" 2 "] = " 3))) -*/ -function sc_setStructFieldBang(s, name, field, val) { - s[field] = val; -} - -/*** META ((export #t) - (peephole (prefix "~"))) -*/ -function sc_bitNot(x) { - return ~x; -} - -/*** META ((export #t) - (peephole (infix 2 2 "&"))) -*/ -function sc_bitAnd(x, y) { - return x & y; -} - -/*** META ((export #t) - (peephole (infix 2 2 "|"))) -*/ -function sc_bitOr(x, y) { - return x | y; -} - -/*** META ((export #t) - (peephole (infix 2 2 "^"))) -*/ -function sc_bitXor(x, y) { - return x ^ y; -} - -/*** META ((export #t) - (peephole (infix 2 2 "<<"))) -*/ -function sc_bitLsh(x, y) { - return x << y; -} - -/*** META ((export #t) - (peephole (infix 2 2 ">>"))) -*/ -function sc_bitRsh(x, y) { - return x >> y; -} - -/*** META ((export #t) - (peephole (infix 2 2 ">>>"))) -*/ -function sc_bitUrsh(x, y) { - return x >>> y; -} - -/*** META ((export js-field js-property) - (peephole (hole 2 o "[" field "]"))) -*/ -function sc_jsField(o, field) { - return o[field]; -} - -/*** META ((export js-field-set! js-property-set!) - (peephole (hole 3 o "[" field "] = " val))) -*/ -function sc_setJsFieldBang(o, field, val) { - return o[field] = val; -} - -/*** META ((export js-field-delete! js-property-delete!) - (peephole (hole 2 "delete" o "[" field "]"))) -*/ -function sc_deleteJsFieldBang(o, field) { - delete o[field]; -} - -/*** META ((export #t) - (peephole (jsCall))) -*/ -function sc_jsCall(o, fun) { - var args = new Array(); - for (var i = 2; i < arguments.length; i++) - args[i-2] = arguments[i]; - return fun.apply(o, args); -} - -/*** META ((export #t) - (peephole (jsMethodCall))) -*/ -function sc_jsMethodCall(o, field) { - var args = new Array(); - for (var i = 2; i < arguments.length; i++) - args[i-2] = arguments[i]; - return o[field].apply(o, args); -} - -/*** META ((export new js-new) - (peephole (jsNew))) -*/ -function sc_jsNew(c) { - var evalStr = "new c("; - evalStr +=arguments.length > 1? "arguments[1]": ""; - for (var i = 2; i < arguments.length; i++) - evalStr += ", arguments[" + i + "]"; - evalStr +=")"; - return eval(evalStr); -} - -// ======================== RegExp ==================== -/*** META ((export #t)) */ -function sc_pregexp(re) { - return new RegExp(sc_string2jsstring(re)); -} - -/*** META ((export #t)) */ -function sc_pregexpMatch(re, s) { - var reg = (re instanceof RegExp) ? re : sc_pregexp(re); - var tmp = reg.exec(sc_string2jsstring(s)); - - if (tmp == null) return false; - - var res = null; - for (var i = tmp.length-1; i >= 0; i--) { - if (tmp[i] !== null) { - res = sc_cons(sc_jsstring2string(tmp[i]), res); - } else { - res = sc_cons(false, res); - } - } - return res; -} - -/*** META ((export #t)) */ -function sc_pregexpReplace(re, s1, s2) { - var reg; - var jss1 = sc_string2jsstring(s1); - var jss2 = sc_string2jsstring(s2); - - if (re instanceof RegExp) { - if (re.global) - reg = re; - else - reg = new RegExp(re.source); - } else { - reg = new RegExp(sc_string2jsstring(re)); - } - - return jss1.replace(reg, jss2); -} - -/*** META ((export pregexp-replace*)) */ -function sc_pregexpReplaceAll(re, s1, s2) { - var reg; - var jss1 = sc_string2jsstring(s1); - var jss2 = sc_string2jsstring(s2); - - if (re instanceof RegExp) { - if (re.global) - reg = re; - else - reg = new RegExp(re.source, "g"); - } else { - reg = new RegExp(sc_string2jsstring(re), "g"); - } - - return jss1.replace(reg, jss2); -} - -/*** META ((export #t)) */ -function sc_pregexpSplit(re, s) { - var reg = ((re instanceof RegExp) ? - re : - new RegExp(sc_string2jsstring(re))); - var jss = sc_string2jsstring(s); - var tmp = jss.split(reg); - - if (tmp == null) return false; - - return sc_vector2list(tmp); -} - - -/* =========================================================================== */ -/* Other library stuff */ -/* =========================================================================== */ - -/*** META ((export #t) - (peephole (hole 1 "Math.floor(Math.random()*" 'n ")"))) -*/ -function sc_random(n) { - return Math.floor(Math.random()*n); -} - -/*** META ((export current-date) - (peephole (hole 0 "new Date()"))) -*/ -function sc_currentDate() { - return new Date(); -} - -function sc_Hashtable() { -} -sc_Hashtable.prototype.toString = function() { - return "#{%hashtable}"; -}; -// sc_toWriteString == sc_toDisplayString == toString - -function sc_HashtableElement(key, val) { - this.key = key; - this.val = val; -} - -/*** META ((export #t) - (peephole (hole 0 "new sc_Hashtable()"))) -*/ -function sc_makeHashtable() { - return new sc_Hashtable(); -} - -/*** META ((export #t)) */ -function sc_hashtablePutBang(ht, key, val) { - var hash = sc_hash(key); - ht[hash] = new sc_HashtableElement(key, val); -} - -/*** META ((export #t)) */ -function sc_hashtableGet(ht, key) { - var hash = sc_hash(key); - if (hash in ht) - return ht[hash].val; - else - return false; -} - -/*** META ((export #t)) */ -function sc_hashtableForEach(ht, f) { - for (var v in ht) { - if (ht[v] instanceof sc_HashtableElement) - f(ht[v].key, ht[v].val); - } -} - -/*** META ((export hashtable-contains?) - (peephole (hole 2 "sc_hash(" 1 ") in " 0))) -*/ -function sc_hashtableContains(ht, key) { - var hash = sc_hash(key); - if (hash in ht) - return true; - else - return false; -} - -var SC_HASH_COUNTER = 0; - -function sc_hash(o) { - if (o === null) - return "null"; - else if (o === undefined) - return "undefined"; - else if (o === true) - return "true"; - else if (o === false) - return "false"; - else if (typeof o === "number") - return "num-" + o; - else if (typeof o === "string") - return "jsstr-" + o; - else if (o.sc_getHash) - return o.sc_getHash(); - else - return sc_counterHash.call(o); -} -function sc_counterHash() { - if (!this.sc_hash) { - this.sc_hash = "hash-" + SC_HASH_COUNTER; - SC_HASH_COUNTER++; - } - return this.sc_hash; -} - -function sc_Trampoline(args, maxTailCalls) { - this['__trampoline return__'] = true; - this.args = args; - this.MAX_TAIL_CALLs = maxTailCalls; -} -// TODO: call/cc stuff -sc_Trampoline.prototype.restart = function() { - var o = this; - while (true) { - // set both globals. - SC_TAIL_OBJECT.calls = o.MAX_TAIL_CALLs-1; - var fun = o.args.callee; - var res = fun.apply(SC_TAIL_OBJECT, o.args); - if (res instanceof sc_Trampoline) - o = res; - else - return res; - } -} - -/*** META ((export bind-exit-lambda)) */ -function sc_bindExitLambda(proc) { - var escape_obj = new sc_BindExitException(); - var escape = function(res) { - escape_obj.res = res; - throw escape_obj; - }; - try { - return proc(escape); - } catch(e) { - if (e === escape_obj) { - return e.res; - } - throw e; - } -} -function sc_BindExitException() { - this._internalException = true; -} - -var SC_SCM2JS_GLOBALS = new Object(); - -// default tail-call depth. -// normally the program should set it again. but just in case... -var SC_TAIL_OBJECT = new Object(); -SC_SCM2JS_GLOBALS.TAIL_OBJECT = SC_TAIL_OBJECT; -// ======================== I/O ======================= - -/*------------------------------------------------------------------*/ - -function sc_EOF() { -} -var SC_EOF_OBJECT = new sc_EOF(); - -function sc_Port() { -} - -/* --------------- Input ports -------------------------------------*/ - -function sc_InputPort() { -} -sc_InputPort.prototype = new sc_Port(); - -sc_InputPort.prototype.peekChar = function() { - if (!("peeked" in this)) - this.peeked = this.getNextChar(); - return this.peeked; -} -sc_InputPort.prototype.readChar = function() { - var tmp = this.peekChar(); - delete this.peeked; - return tmp; -} -sc_InputPort.prototype.isCharReady = function() { - return true; -} -sc_InputPort.prototype.close = function() { - // do nothing -} - -/* .............. String port ..........................*/ -function sc_ErrorInputPort() { -}; -sc_ErrorInputPort.prototype = new sc_InputPort(); -sc_ErrorInputPort.prototype.getNextChar = function() { - throw "can't read from error-port."; -}; -sc_ErrorInputPort.prototype.isCharReady = function() { - return false; -}; - - -/* .............. String port ..........................*/ - -function sc_StringInputPort(jsStr) { - // we are going to do some charAts on the str. - // instead of recreating all the time a String-object, we - // create one in the beginning. (not sure, if this is really an optim) - this.str = new String(jsStr); - this.pos = 0; -} -sc_StringInputPort.prototype = new sc_InputPort(); -sc_StringInputPort.prototype.getNextChar = function() { - if (this.pos >= this.str.length) - return SC_EOF_OBJECT; - return this.str.charAt(this.pos++); -}; - -/* ------------- Read and other lib-funs -------------------------------*/ -function sc_Token(type, val, pos) { - this.type = type; - this.val = val; - this.pos = pos; -} -sc_Token.EOF = 0/*EOF*/; -sc_Token.OPEN_PAR = 1/*OPEN_PAR*/; -sc_Token.CLOSE_PAR = 2/*CLOSE_PAR*/; -sc_Token.OPEN_BRACE = 3/*OPEN_BRACE*/; -sc_Token.CLOSE_BRACE = 4/*CLOSE_BRACE*/; -sc_Token.OPEN_BRACKET = 5/*OPEN_BRACKET*/; -sc_Token.CLOSE_BRACKET = 6/*CLOSE_BRACKET*/; -sc_Token.WHITESPACE = 7/*WHITESPACE*/; -sc_Token.QUOTE = 8/*QUOTE*/; -sc_Token.ID = 9/*ID*/; -sc_Token.DOT = 10/*DOT*/; -sc_Token.STRING = 11/*STRING*/; -sc_Token.NUMBER = 12/*NUMBER*/; -sc_Token.ERROR = 13/*ERROR*/; -sc_Token.VECTOR_BEGIN = 14/*VECTOR_BEGIN*/; -sc_Token.TRUE = 15/*TRUE*/; -sc_Token.FALSE = 16/*FALSE*/; -sc_Token.UNSPECIFIED = 17/*UNSPECIFIED*/; -sc_Token.REFERENCE = 18/*REFERENCE*/; -sc_Token.STORE = 19/*STORE*/; -sc_Token.CHAR = 20/*CHAR*/; - -var SC_ID_CLASS = SC_LOWER_CLASS + SC_UPPER_CLASS + "!$%*+-./:<=>?@^_~"; -function sc_Tokenizer(port) { - this.port = port; -} -sc_Tokenizer.prototype.peekToken = function() { - if (this.peeked) - return this.peeked; - var newToken = this.nextToken(); - this.peeked = newToken; - return newToken; -}; -sc_Tokenizer.prototype.readToken = function() { - var tmp = this.peekToken(); - delete this.peeked; - return tmp; -}; -sc_Tokenizer.prototype.nextToken = function() { - var port = this.port; - - function isNumberChar(c) { - return (c >= "0" && c <= "9"); - }; - function isIdOrNumberChar(c) { - return SC_ID_CLASS.indexOf(c) != -1 || // ID-char - (c >= "0" && c <= "9"); - } - function isWhitespace(c) { - return c === " " || c === "\r" || c === "\n" || c === "\t" || c === "\f"; - }; - function isWhitespaceOrEOF(c) { - return isWhitespace(c) || c === SC_EOF_OBJECT; - }; - - function readString() { - res = ""; - while (true) { - var c = port.readChar(); - switch (c) { - case '"': - return new sc_Token(11/*STRING*/, res); - case "\\": - var tmp = port.readChar(); - switch (tmp) { - case '0': res += "\0"; break; - case 'a': res += "\a"; break; - case 'b': res += "\b"; break; - case 'f': res += "\f"; break; - case 'n': res += "\n"; break; - case 'r': res += "\r"; break; - case 't': res += "\t"; break; - case 'v': res += "\v"; break; - case '"': res += '"'; break; - case '\\': res += '\\'; break; - case 'x': - /* hexa-number */ - var nb = 0; - while (true) { - var hexC = port.peekChar(); - if (hexC >= '0' && hexC <= '9') { - port.readChar(); - nb = nb * 16 + hexC.charCodeAt(0) - '0'.charCodeAt(0); - } else if (hexC >= 'a' && hexC <= 'f') { - port.readChar(); - nb = nb * 16 + hexC.charCodeAt(0) - 'a'.charCodeAt(0); - } else if (hexC >= 'A' && hexC <= 'F') { - port.readChar(); - nb = nb * 16 + hexC.charCodeAt(0) - 'A'.charCodeAt(0); - } else { - // next char isn't part of hex. - res += String.fromCharCode(nb); - break; - } - } - break; - default: - if (tmp === SC_EOF_OBJECT) { - return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res); - } - res += tmp; - } - break; - default: - if (c === SC_EOF_OBJECT) { - return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res); - } - res += c; - } - } - }; - function readIdOrNumber(firstChar) { - var res = firstChar; - while (isIdOrNumberChar(port.peekChar())) - res += port.readChar(); - if (isNaN(res)) - return new sc_Token(9/*ID*/, res); - else - return new sc_Token(12/*NUMBER*/, res - 0); - }; - - function skipWhitespaceAndComments() { - var done = false; - while (!done) { - done = true; - while (isWhitespace(port.peekChar())) - port.readChar(); - if (port.peekChar() === ';') { - port.readChar(); - done = false; - while (true) { - curChar = port.readChar(); - if (curChar === SC_EOF_OBJECT || - curChar === '\n') - break; - } - } - } - }; - - function readDot() { - if (isWhitespace(port.peekChar())) - return new sc_Token(10/*DOT*/); - else - return readIdOrNumber("."); - }; - - function readSharp() { - var c = port.readChar(); - if (isWhitespace(c)) - return new sc_Token(13/*ERROR*/, "bad #-pattern0."); - - // reference - if (isNumberChar(c)) { - var nb = c - 0; - while (isNumberChar(port.peekChar())) - nb = nb*10 + (port.readChar() - 0); - switch (port.readChar()) { - case '#': - return new sc_Token(18/*REFERENCE*/, nb); - case '=': - return new sc_Token(19/*STORE*/, nb); - default: - return new sc_Token(13/*ERROR*/, "bad #-pattern1." + nb); - } - } - - if (c === "(") - return new sc_Token(14/*VECTOR_BEGIN*/); - - if (c === "\\") { // character - var tmp = "" - while (!isWhitespaceOrEOF(port.peekChar())) - tmp += port.readChar(); - switch (tmp.length) { - case 0: // it's escaping a whitespace char: - if (sc_isEOFObject(port.peekChar)) - return new sc_Token(13/*ERROR*/, "bad #-pattern2."); - else - return new sc_Token(20/*CHAR*/, port.readChar()); - case 1: - return new sc_Token(20/*CHAR*/, tmp); - default: - var entry = sc_Char.readable2char[tmp.toLowerCase()]; - if (entry) - return new sc_Token(20/*CHAR*/, entry); - else - return new sc_Token(13/*ERROR*/, "unknown character description: #\\" + tmp); - } - } - - // some constants (#t, #f, #unspecified) - var res; - var needing; - switch (c) { - case 't': res = new sc_Token(15/*TRUE*/, true); needing = ""; break; - case 'f': res = new sc_Token(16/*FALSE*/, false); needing = ""; break; - case 'u': res = new sc_Token(17/*UNSPECIFIED*/, undefined); needing = "nspecified"; break; - default: - return new sc_Token(13/*ERROR*/, "bad #-pattern3: " + c); - } - while(true) { - c = port.peekChar(); - if ((isWhitespaceOrEOF(c) || c === ')') && - needing == "") - return res; - else if (isWhitespace(c) || needing == "") - return new sc_Token(13/*ERROR*/, "bad #-pattern4 " + c + " " + needing); - else if (needing.charAt(0) == c) { - port.readChar(); // consume - needing = needing.slice(1); - } else - return new sc_Token(13/*ERROR*/, "bad #-pattern5"); - } - - }; - - skipWhitespaceAndComments(); - var curChar = port.readChar(); - if (curChar === SC_EOF_OBJECT) - return new sc_Token(0/*EOF*/, curChar); - switch (curChar) - { - case " ": - case "\n": - case "\t": - return readWhitespace(); - case "(": - return new sc_Token(1/*OPEN_PAR*/); - case ")": - return new sc_Token(2/*CLOSE_PAR*/); - case "{": - return new sc_Token(3/*OPEN_BRACE*/); - case "}": - return new sc_Token(4/*CLOSE_BRACE*/); - case "[": - return new sc_Token(5/*OPEN_BRACKET*/); - case "]": - return new sc_Token(6/*CLOSE_BRACKET*/); - case "'": - return new sc_Token(8/*QUOTE*/); - case "#": - return readSharp(); - case ".": - return readDot(); - case '"': - return readString(); - default: - if (isIdOrNumberChar(curChar)) - return readIdOrNumber(curChar); - throw "unexpected character: " + curChar; - } -}; - -function sc_Reader(tokenizer) { - this.tokenizer = tokenizer; - this.backref = new Array(); -} -sc_Reader.prototype.read = function() { - function readList(listBeginType) { - function matchesPeer(open, close) { - return open === 1/*OPEN_PAR*/ && close === 2/*CLOSE_PAR*/ - || open === 3/*OPEN_BRACE*/ && close === 4/*CLOSE_BRACE*/ - || open === 5/*OPEN_BRACKET*/ && close === 6/*CLOSE_BRACKET*/; - }; - var res = null; - - while (true) { - var token = tokenizer.peekToken(); - - switch (token.type) { - case 2/*CLOSE_PAR*/: - case 4/*CLOSE_BRACE*/: - case 6/*CLOSE_BRACKET*/: - if (matchesPeer(listBeginType, token.type)) { - tokenizer.readToken(); // consume token - return sc_reverseBang(res); - } else - throw "closing par doesn't match: " + listBeginType - + " " + listEndType; - - case 0/*EOF*/: - throw "unexpected end of file"; - - case 10/*DOT*/: - tokenizer.readToken(); // consume token - var cdr = this.read(); - var par = tokenizer.readToken(); - if (!matchesPeer(listBeginType, par.type)) - throw "closing par doesn't match: " + listBeginType - + " " + par.type; - else - return sc_reverseAppendBang(res, cdr); - - - default: - res = sc_cons(this.read(), res); - } - } - }; - function readQuote() { - return sc_cons("quote", sc_cons(this.read(), null)); - }; - function readVector() { - // opening-parenthesis is already consumed - var a = new Array(); - while (true) { - var token = tokenizer.peekToken(); - switch (token.type) { - case 2/*CLOSE_PAR*/: - tokenizer.readToken(); - return a; - - default: - a.push(this.read()); - } - } - }; - - function storeRefence(nb) { - var tmp = this.read(); - this.backref[nb] = tmp; - return tmp; - }; - - function readReference(nb) { - if (nb in this.backref) - return this.backref[nb]; - else - throw "bad reference: " + nb; - }; - - var tokenizer = this.tokenizer; - - var token = tokenizer.readToken(); - - // handle error - if (token.type === 13/*ERROR*/) - throw token.val; - - switch (token.type) { - case 1/*OPEN_PAR*/: - case 3/*OPEN_BRACE*/: - case 5/*OPEN_BRACKET*/: - return readList.call(this, token.type); - case 8/*QUOTE*/: - return readQuote.call(this); - case 11/*STRING*/: - return sc_jsstring2string(token.val); - case 20/*CHAR*/: - return new sc_Char(token.val); - case 14/*VECTOR_BEGIN*/: - return readVector.call(this); - case 18/*REFERENCE*/: - return readReference.call(this, token.val); - case 19/*STORE*/: - return storeRefence.call(this, token.val); - case 9/*ID*/: - return sc_jsstring2symbol(token.val); - case 0/*EOF*/: - case 12/*NUMBER*/: - case 15/*TRUE*/: - case 16/*FALSE*/: - case 17/*UNSPECIFIED*/: - return token.val; - default: - throw "unexpected token " + token.type + " " + token.val; - } -}; - -/*** META ((export #t)) */ -function sc_read(port) { - if (port === undefined) // we assume the port hasn't been given. - port = SC_DEFAULT_IN; // THREAD: shared var... - var reader = new sc_Reader(new sc_Tokenizer(port)); - return reader.read(); -} -/*** META ((export #t)) */ -function sc_readChar(port) { - if (port === undefined) // we assume the port hasn't been given. - port = SC_DEFAULT_IN; // THREAD: shared var... - var t = port.readChar(); - return t === SC_EOF_OBJECT? t: new sc_Char(t); -} -/*** META ((export #t)) */ -function sc_peekChar(port) { - if (port === undefined) // we assume the port hasn't been given. - port = SC_DEFAULT_IN; // THREAD: shared var... - var t = port.peekChar(); - return t === SC_EOF_OBJECT? t: new sc_Char(t); -} -/*** META ((export #t) - (type bool)) -*/ -function sc_isCharReady(port) { - if (port === undefined) // we assume the port hasn't been given. - port = SC_DEFAULT_IN; // THREAD: shared var... - return port.isCharReady(); -} -/*** META ((export #t) - (peephole (postfix ".close()"))) -*/ -function sc_closeInputPort(p) { - return p.close(); -} - -/*** META ((export #t) - (type bool) - (peephole (postfix " instanceof sc_InputPort"))) -*/ -function sc_isInputPort(o) { - return (o instanceof sc_InputPort); -} - -/*** META ((export eof-object?) - (type bool) - (peephole (postfix " === SC_EOF_OBJECT"))) -*/ -function sc_isEOFObject(o) { - return o === SC_EOF_OBJECT; -} - -/*** META ((export #t) - (peephole (hole 0 "SC_DEFAULT_IN"))) -*/ -function sc_currentInputPort() { - return SC_DEFAULT_IN; -} - -/* ------------ file operations are not supported -----------*/ -/*** META ((export #t)) */ -function sc_callWithInputFile(s, proc) { - throw "can't open " + s; -} - -/*** META ((export #t)) */ -function sc_callWithOutputFile(s, proc) { - throw "can't open " + s; -} - -/*** META ((export #t)) */ -function sc_withInputFromFile(s, thunk) { - throw "can't open " + s; -} - -/*** META ((export #t)) */ -function sc_withOutputToFile(s, thunk) { - throw "can't open " + s; -} - -/*** META ((export #t)) */ -function sc_openInputFile(s) { - throw "can't open " + s; -} - -/*** META ((export #t)) */ -function sc_openOutputFile(s) { - throw "can't open " + s; -} - -/* ----------------------------------------------------------------------------*/ -/*** META ((export #t)) */ -function sc_basename(p) { - var i = p.lastIndexOf('/'); - - if(i >= 0) - return p.substring(i + 1, p.length); - else - return ''; -} - -/*** META ((export #t)) */ -function sc_dirname(p) { - var i = p.lastIndexOf('/'); - - if(i >= 0) - return p.substring(0, i); - else - return ''; -} - -/* ----------------------------------------------------------------------------*/ - -/*** META ((export #t)) */ -function sc_withInputFromPort(p, thunk) { - try { - var tmp = SC_DEFAULT_IN; // THREAD: shared var. - SC_DEFAULT_IN = p; - return thunk(); - } finally { - SC_DEFAULT_IN = tmp; - } -} - -/*** META ((export #t)) */ -function sc_withInputFromString(s, thunk) { - return sc_withInputFromPort(new sc_StringInputPort(sc_string2jsstring(s)), thunk); -} - -/*** META ((export #t)) */ -function sc_withOutputToPort(p, thunk) { - try { - var tmp = SC_DEFAULT_OUT; // THREAD: shared var. - SC_DEFAULT_OUT = p; - return thunk(); - } finally { - SC_DEFAULT_OUT = tmp; - } -} - -/*** META ((export #t)) */ -function sc_withOutputToString(thunk) { - var p = new sc_StringOutputPort(); - sc_withOutputToPort(p, thunk); - return p.close(); -} - -/*** META ((export #t)) */ -function sc_withOutputToProcedure(proc, thunk) { - var t = function(s) { proc(sc_jsstring2string(s)); }; - return sc_withOutputToPort(new sc_GenericOutputPort(t), thunk); -} - -/*** META ((export #t) - (peephole (hole 0 "new sc_StringOutputPort()"))) -*/ -function sc_openOutputString() { - return new sc_StringOutputPort(); -} - -/*** META ((export #t)) */ -function sc_openInputString(str) { - return new sc_StringInputPort(sc_string2jsstring(str)); -} - -/* ----------------------------------------------------------------------------*/ - -function sc_OutputPort() { -} -sc_OutputPort.prototype = new sc_Port(); -sc_OutputPort.prototype.appendJSString = function(obj) { - /* do nothing */ -} -sc_OutputPort.prototype.close = function() { - /* do nothing */ -} - -function sc_StringOutputPort() { - this.res = ""; -} -sc_StringOutputPort.prototype = new sc_OutputPort(); -sc_StringOutputPort.prototype.appendJSString = function(s) { - this.res += s; -} -sc_StringOutputPort.prototype.close = function() { - return sc_jsstring2string(this.res); -} - -/*** META ((export #t)) */ -function sc_getOutputString(sp) { - return sc_jsstring2string(sp.res); -} - - -function sc_ErrorOutputPort() { -} -sc_ErrorOutputPort.prototype = new sc_OutputPort(); -sc_ErrorOutputPort.prototype.appendJSString = function(s) { - throw "don't write on ErrorPort!"; -} -sc_ErrorOutputPort.prototype.close = function() { - /* do nothing */ -} - -function sc_GenericOutputPort(appendJSString, close) { - this.appendJSString = appendJSString; - if (close) - this.close = close; -} -sc_GenericOutputPort.prototype = new sc_OutputPort(); - -/*** META ((export #t) - (type bool) - (peephole (postfix " instanceof sc_OutputPort"))) -*/ -function sc_isOutputPort(o) { - return (o instanceof sc_OutputPort); -} - -/*** META ((export #t) - (peephole (postfix ".close()"))) -*/ -function sc_closeOutputPort(p) { - return p.close(); -} - -/* ------------------ write ---------------------------------------------------*/ - -/*** META ((export #t)) */ -function sc_write(o, p) { - if (p === undefined) // we assume not given - p = SC_DEFAULT_OUT; - p.appendJSString(sc_toWriteString(o)); -} - -function sc_toWriteString(o) { - if (o === null) - return "()"; - else if (o === true) - return "#t"; - else if (o === false) - return "#f"; - else if (o === undefined) - return "#unspecified"; - else if (typeof o === 'function') - return "#"; - else if (o.sc_toWriteString) - return o.sc_toWriteString(); - else - return o.toString(); -} - -function sc_escapeWriteString(s) { - var res = ""; - var j = 0; - for (i = 0; i < s.length; i++) { - switch (s.charAt(i)) { - case "\0": res += s.substring(j, i) + "\\0"; j = i + 1; break; - case "\b": res += s.substring(j, i) + "\\b"; j = i + 1; break; - case "\f": res += s.substring(j, i) + "\\f"; j = i + 1; break; - case "\n": res += s.substring(j, i) + "\\n"; j = i + 1; break; - case "\r": res += s.substring(j, i) + "\\r"; j = i + 1; break; - case "\t": res += s.substring(j, i) + "\\t"; j = i + 1; break; - case "\v": res += s.substring(j, i) + "\\v"; j = i + 1; break; - case '"': res += s.substring(j, i) + '\\"'; j = i + 1; break; - case "\\": res += s.substring(j, i) + "\\\\"; j = i + 1; break; - default: - var c = s.charAt(i); - if ("\a" !== "a" && c == "\a") { - res += s.substring(j, i) + "\\a"; j = i + 1; continue; - } - if ("\v" !== "v" && c == "\v") { - res += s.substring(j, i) + "\\v"; j = i + 1; continue; - } - //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) { - // CARE: Manuel is this OK with HOP? - if (s.charAt(i) < ' ') { - /* non printable character and special chars */ - res += s.substring(j, i) + "\\x" + s.charCodeAt(i).toString(16); - j = i + 1; - } - // else just let i increase... - } - } - res += s.substring(j, i); - return res; -} - -/* ------------------ display ---------------------------------------------------*/ - -/*** META ((export #t)) */ -function sc_display(o, p) { - if (p === undefined) // we assume not given - p = SC_DEFAULT_OUT; - p.appendJSString(sc_toDisplayString(o)); -} - -function sc_toDisplayString(o) { - if (o === null) - return "()"; - else if (o === true) - return "#t"; - else if (o === false) - return "#f"; - else if (o === undefined) - return "#unspecified"; - else if (typeof o === 'function') - return "#"; - else if (o.sc_toDisplayString) - return o.sc_toDisplayString(); - else - return o.toString(); -} - -/* ------------------ newline ---------------------------------------------------*/ - -/*** META ((export #t)) */ -function sc_newline(p) { - if (p === undefined) // we assume not given - p = SC_DEFAULT_OUT; - p.appendJSString("\n"); -} - -/* ------------------ write-char ---------------------------------------------------*/ - -/*** META ((export #t)) */ -function sc_writeChar(c, p) { - if (p === undefined) // we assume not given - p = SC_DEFAULT_OUT; - p.appendJSString(c.val); -} - -/* ------------------ write-circle ---------------------------------------------------*/ - -/*** META ((export #t)) */ -function sc_writeCircle(o, p) { - if (p === undefined) // we assume not given - p = SC_DEFAULT_OUT; - p.appendJSString(sc_toWriteCircleString(o)); -} - -function sc_toWriteCircleString(o) { - var symb = sc_gensym("writeCircle"); - var nbPointer = new Object(); - nbPointer.nb = 0; - sc_prepWriteCircle(o, symb, nbPointer); - return sc_genToWriteCircleString(o, symb); -} - -function sc_prepWriteCircle(o, symb, nbPointer) { - // TODO sc_Struct - if (o instanceof sc_Pair || - o instanceof sc_Vector) { - if (o[symb] !== undefined) { - // not the first visit. - o[symb]++; - // unless there is already a number, assign one. - if (!o[symb + "nb"]) o[symb + "nb"] = nbPointer.nb++; - return; - } - o[symb] = 0; - if (o instanceof sc_Pair) { - sc_prepWriteCircle(o.car, symb, nbPointer); - sc_prepWriteCircle(o.cdr, symb, nbPointer); - } else { - for (var i = 0; i < o.length; i++) - sc_prepWriteCircle(o[i], symb, nbPointer); - } - } -} - -function sc_genToWriteCircleString(o, symb) { - if (!(o instanceof sc_Pair || - o instanceof sc_Vector)) - return sc_toWriteString(o); - return o.sc_toWriteCircleString(symb); -} -sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) { - if (this[symb + "use"]) { // use-flag is set. Just use it. - var nb = this[symb + "nb"]; - if (this[symb]-- === 0) { // if we are the last use. remove all fields. - delete this[symb]; - delete this[symb + "nb"]; - delete this[symb + "use"]; - } - if (inList) - return '. #' + nb + '#'; - else - return '#' + nb + '#'; - } - if (this[symb]-- === 0) { // if we are the last use. remove all fields. - delete this[symb]; - delete this[symb + "nb"]; - delete this[symb + "use"]; - } - - var res = ""; - - if (this[symb] !== undefined) { // implies > 0 - this[symb + "use"] = true; - if (inList) - res += '. #' + this[symb + "nb"] + '='; - else - res += '#' + this[symb + "nb"] + '='; - inList = false; - } - - if (!inList) - res += "("; - - // print car - res += sc_genToWriteCircleString(this.car, symb); - - if (sc_isPair(this.cdr)) { - res += " " + this.cdr.sc_toWriteCircleString(symb, true); - } else if (this.cdr !== null) { - res += " . " + sc_genToWriteCircleString(this.cdr, symb); - } - if (!inList) - res += ")"; - return res; -}; -sc_Vector.prototype.sc_toWriteCircleString = function(symb) { - if (this[symb + "use"]) { // use-flag is set. Just use it. - var nb = this[symb + "nb"]; - if (this[symb]-- === 0) { // if we are the last use. remove all fields. - delete this[symb]; - delete this[symb + "nb"]; - delete this[symb + "use"]; - } - return '#' + nb + '#'; - } - if (this[symb]-- === 0) { // if we are the last use. remove all fields. - delete this[symb]; - delete this[symb + "nb"]; - delete this[symb + "use"]; - } - - var res = ""; - if (this[symb] !== undefined) { // implies > 0 - this[symb + "use"] = true; - res += '#' + this[symb + "nb"] + '='; - } - res += "#("; - for (var i = 0; i < this.length; i++) { - res += sc_genToWriteCircleString(this[i], symb); - if (i < this.length - 1) res += " "; - } - res += ")"; - return res; -}; - - -/* ------------------ print ---------------------------------------------------*/ - -/*** META ((export #t)) */ -function sc_print(s) { - if (arguments.length === 1) { - sc_display(s); - sc_newline(); - } - else { - for (var i = 0; i < arguments.length; i++) - sc_display(arguments[i]); - sc_newline(); - } -} - -/* ------------------ format ---------------------------------------------------*/ -/*** META ((export #t)) */ -function sc_format(s, args) { - var len = s.length; - var p = new sc_StringOutputPort(); - var i = 0, j = 1; - - while( i < len ) { - var i2 = s.indexOf("~", i); - - if (i2 == -1) { - p.appendJSString( s.substring( i, len ) ); - return p.close(); - } else { - if (i2 > i) { - if (i2 == (len - 1)) { - p.appendJSString(s.substring(i, len)); - return p.close(); - } else { - p.appendJSString(s.substring(i, i2)); - i = i2; - } - } - - switch(s.charCodeAt(i2 + 1)) { - case 65: - case 97: - // a - sc_display(arguments[j], p); - i += 2; j++; - break; - - case 83: - case 115: - // s - sc_write(arguments[j], p); - i += 2; j++; - break; - - case 86: - case 118: - // v - sc_display(arguments[j], p); - p.appendJSString("\n"); - i += 2; j++; - break; - - case 67: - case 99: - // c - p.appendJSString(String.fromCharCode(arguments[j])); - i += 2; j++; - break; - - case 88: - case 120: - // x - p.appendJSString(arguments[j].toString(6)); - i += 2; j++; - break; - - case 79: - case 111: - // o - p.appendJSString(arguments[j].toString(8)); - i += 2; j++; - break; - - case 66: - case 98: - // b - p.appendJSString(arguments[j].toString(2)); - i += 2; j++; - break; - - case 37: - case 110: - // %, n - p.appendJSString("\n"); - i += 2; break; - - case 114: - // r - p.appendJSString("\r"); - i += 2; break; - - case 126: - // ~ - p.appendJSString("~"); - i += 2; break; - - default: - sc_error( "format: illegal ~" - + String.fromCharCode(s.charCodeAt(i2 + 1)) - + " sequence" ); - return ""; - } - } - } - - return p.close(); -} - -/* ------------------ global ports ---------------------------------------------------*/ - -var SC_DEFAULT_IN = new sc_ErrorInputPort(); -var SC_DEFAULT_OUT = new sc_ErrorOutputPort(); -var SC_ERROR_OUT = new sc_ErrorOutputPort(); - -var sc_SYMBOL_PREFIX = "\u1E9C"; -var sc_KEYWORD_PREFIX = "\u1E9D"; - -/*** META ((export #t) - (peephole (id))) */ -function sc_jsstring2string(s) { - return s; -} - -/*** META ((export #t) - (peephole (prefix "'\\u1E9C' +"))) -*/ -function sc_jsstring2symbol(s) { - return sc_SYMBOL_PREFIX + s; -} - -/*** META ((export #t) - (peephole (id))) -*/ -function sc_string2jsstring(s) { - return s; -} - -/*** META ((export #t) - (peephole (symbol2jsstring_immutable))) -*/ -function sc_symbol2jsstring(s) { - return s.slice(1); -} - -/*** META ((export #t) - (peephole (postfix ".slice(1)"))) -*/ -function sc_keyword2jsstring(k) { - return k.slice(1); -} - -/*** META ((export #t) - (peephole (prefix "'\\u1E9D' +"))) -*/ -function sc_jsstring2keyword(s) { - return sc_KEYWORD_PREFIX + s; -} - -/*** META ((export #t) - (type bool)) -*/ -function sc_isKeyword(s) { - return (typeof s === "string") && - (s.charAt(0) === sc_KEYWORD_PREFIX); -} - - -/*** META ((export #t)) */ -var sc_gensym = function() { - var counter = 1000; - return function(sym) { - counter++; - if (!sym) sym = sc_SYMBOL_PREFIX; - return sym + "s" + counter + "~" + "^sC-GeNsYm "; - }; -}(); - - -/*** META ((export #t) - (type bool)) -*/ -function sc_isEqual(o1, o2) { - return ((o1 === o2) || - (sc_isPair(o1) && sc_isPair(o2) - && sc_isPairEqual(o1, o2, sc_isEqual)) || - (sc_isVector(o1) && sc_isVector(o2) - && sc_isVectorEqual(o1, o2, sc_isEqual))); -} - -/*** META ((export number->symbol integer->symbol)) */ -function sc_number2symbol(x, radix) { - return sc_SYMBOL_PREFIX + sc_number2jsstring(x, radix); -} - -/*** META ((export number->string integer->string)) */ -var sc_number2string = sc_number2jsstring; - -/*** META ((export #t)) */ -function sc_symbol2number(s, radix) { - return sc_jsstring2number(s.slice(1), radix); -} - -/*** META ((export #t)) */ -var sc_string2number = sc_jsstring2number; - -/*** META ((export #t) - (peephole (prefix "+" s))) - ;; peephole will only apply if no radix is given. -*/ -function sc_string2integer(s, radix) { - if (!radix) return +s; - return parseInt(s, radix); -} - -/*** META ((export #t) - (peephole (prefix "+"))) -*/ -function sc_string2real(s) { - return +s; -} - - -/*** META ((export #t) - (type bool)) -*/ -function sc_isSymbol(s) { - return (typeof s === "string") && - (s.charAt(0) === sc_SYMBOL_PREFIX); -} - -/*** META ((export #t) - (peephole (symbol2string_immutable))) -*/ -function sc_symbol2string(s) { - return s.slice(1); -} - -/*** META ((export #t) - (peephole (prefix "'\\u1E9C' +"))) -*/ -function sc_string2symbol(s) { - return sc_SYMBOL_PREFIX + s; -} - -/*** META ((export symbol-append) - (peephole (symbolAppend_immutable))) -*/ -function sc_symbolAppend() { - var res = sc_SYMBOL_PREFIX; - for (var i = 0; i < arguments.length; i++) - res += arguments[i].slice(1); - return res; -} - -/*** META ((export #t) - (peephole (postfix ".val"))) -*/ -function sc_char2string(c) { return c.val; } - -/*** META ((export #t) - (peephole (hole 1 "'\\u1E9C' + " c ".val"))) -*/ -function sc_char2symbol(c) { return sc_SYMBOL_PREFIX + c.val; } - -/*** META ((export #t) - (type bool)) -*/ -function sc_isString(s) { - return (typeof s === "string") && - (s.charAt(0) !== sc_SYMBOL_PREFIX); -} - -/*** META ((export #t)) */ -var sc_makeString = sc_makejsString; - - -/*** META ((export #t)) */ -function sc_string() { - for (var i = 0; i < arguments.length; i++) - arguments[i] = arguments[i].val; - return "".concat.apply("", arguments); -} - -/*** META ((export #t) - (peephole (postfix ".length"))) -*/ -function sc_stringLength(s) { return s.length; } - -/*** META ((export #t)) */ -function sc_stringRef(s, k) { - return new sc_Char(s.charAt(k)); -} - -/* there's no stringSet in the immutable version -function sc_stringSet(s, k, c) -*/ - - -/*** META ((export string=?) - (type bool) - (peephole (hole 2 str1 " === " str2))) -*/ -function sc_isStringEqual(s1, s2) { - return s1 === s2; -} -/*** META ((export string?) - (type bool) - (peephole (hole 2 str1 " > " str2))) -*/ -function sc_isStringGreater(s1, s2) { - return s1 > s2; -} -/*** META ((export string<=?) - (type bool) - (peephole (hole 2 str1 " <= " str2))) -*/ -function sc_isStringLessEqual(s1, s2) { - return s1 <= s2; -} -/*** META ((export string>=?) - (type bool) - (peephole (hole 2 str1 " >= " str2))) -*/ -function sc_isStringGreaterEqual(s1, s2) { - return s1 >= s2; -} -/*** META ((export string-ci=?) - (type bool) - (peephole (hole 2 str1 ".toLowerCase() === " str2 ".toLowerCase()"))) -*/ -function sc_isStringCIEqual(s1, s2) { - return s1.toLowerCase() === s2.toLowerCase(); -} -/*** META ((export string-ci?) - (type bool) - (peephole (hole 2 str1 ".toLowerCase() > " str2 ".toLowerCase()"))) -*/ -function sc_isStringCIGreater(s1, s2) { - return s1.toLowerCase() > s2.toLowerCase(); -} -/*** META ((export string-ci<=?) - (type bool) - (peephole (hole 2 str1 ".toLowerCase() <= " str2 ".toLowerCase()"))) -*/ -function sc_isStringCILessEqual(s1, s2) { - return s1.toLowerCase() <= s2.toLowerCase(); -} -/*** META ((export string-ci>=?) - (type bool) - (peephole (hole 2 str1 ".toLowerCase() >= " str2 ".toLowerCase()"))) -*/ -function sc_isStringCIGreaterEqual(s1, s2) { - return s1.toLowerCase() >= s2.toLowerCase(); -} - -/*** META ((export #t) - (peephole (hole 3 s ".substring(" start ", " end ")"))) -*/ -function sc_substring(s, start, end) { - return s.substring(start, end); -} - -/*** META ((export #t)) -*/ -function sc_isSubstring_at(s1, s2, i) { - return s2 == s1.substring(i, i+ s2.length); -} - -/*** META ((export #t) - (peephole (infix 0 #f "+" "''"))) -*/ -function sc_stringAppend() { - return "".concat.apply("", arguments); -} - -/*** META ((export #t)) */ -var sc_string2list = sc_jsstring2list; - -/*** META ((export #t)) */ -var sc_list2string = sc_list2jsstring; - -/*** META ((export #t) - (peephole (id))) -*/ -function sc_stringCopy(s) { - return s; -} - -/* there's no string-fill in the immutable version -function sc_stringFill(s, c) -*/ - -/*** META ((export #t) - (peephole (postfix ".slice(1)"))) -*/ -function sc_keyword2string(o) { - return o.slice(1); -} - -/*** META ((export #t) - (peephole (prefix "'\\u1E9D' +"))) -*/ -function sc_string2keyword(o) { - return sc_KEYWORD_PREFIX + o; -} - -String.prototype.sc_toDisplayString = function() { - if (this.charAt(0) === sc_SYMBOL_PREFIX) - // TODO: care for symbols with spaces (escape-chars symbols). - return this.slice(1); - else if (this.charAt(0) === sc_KEYWORD_PREFIX) - return ":" + this.slice(1); - else - return this.toString(); -}; - -String.prototype.sc_toWriteString = function() { - if (this.charAt(0) === sc_SYMBOL_PREFIX) - // TODO: care for symbols with spaces (escape-chars symbols). - return this.slice(1); - else if (this.charAt(0) === sc_KEYWORD_PREFIX) - return ":" + this.slice(1); - else - return '"' + sc_escapeWriteString(this) + '"'; -}; -/* Exported Variables */ -var BgL_testzd2boyerzd2; -var BgL_nboyerzd2benchmarkzd2; -var BgL_setupzd2boyerzd2; -/* End Exports */ - -var translate_term_nboyer; -var translate_args_nboyer; -var untranslate_term_nboyer; -var BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer; -var BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer; -var translate_alist_nboyer; -var apply_subst_nboyer; -var apply_subst_lst_nboyer; -var tautologyp_nboyer; -var if_constructor_nboyer; -var rewrite_count_nboyer; -var rewrite_nboyer; -var rewrite_args_nboyer; -var unify_subst_nboyer; -var one_way_unify1_nboyer; -var false_term_nboyer; -var true_term_nboyer; -var trans_of_implies1_nboyer; -var is_term_equal_nboyer; -var is_term_member_nboyer; -var const_nboyer; -var sc_const_3_nboyer; -var sc_const_4_nboyer; -{ - (sc_const_4_nboyer = (new sc_Pair("\u1E9Cimplies",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cu",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cw",null)))))),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cw",null)))))),null))))))); - (sc_const_3_nboyer = sc_list((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccompile",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Ccodegen",(new sc_Pair((new sc_Pair("\u1E9Coptimize",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreaterp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clesseqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cboolean",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ciff",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceven1",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Codd",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccountps-",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccountps-loop",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfact-",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfact-loop",(new sc_Pair("\u1E9Ci",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdivides",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-true",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-false",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctautology-checker",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctautologyp",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfalsify",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfalsify1",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime1",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair("\u1E9Cp",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))))),(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cc",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cplus-fringe",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair("\u1E9Cenvrn",null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmc-flatten",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cintersect",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Ck",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ck",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Csort-lp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus1",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Ci",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cbase",null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cj",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cj",(new sc_Pair((1),null)))))),null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Ci",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cw",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cz",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnlistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csamefringe",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cz",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cw",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair(sc_list("\u1E9Cand", (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Ca",null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cb",null)))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cl",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cl",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdsort",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx1",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx2",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx3",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx4",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx5",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx6",(new sc_Pair("\u1E9Cx7",null)))))),null)))))),null)))))),null)))))),null)))))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((6),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx7",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cy",(new sc_Pair((2),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csigma",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Ci",null)))),null)))))),(new sc_Pair((2),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cz",null)))),null)))))),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Ca",null)))),null)))),(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Cb",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair("\u1E9Cz",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cassignedp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair((new sc_Pair("\u1E9Cset",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cval",(new sc_Pair("\u1E9Cmem",null)))))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair("\u1E9Cval",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cmem",null)))))),null)))))))),null)))))))); - (const_nboyer = (new sc_Pair((new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))))),null))))))))))); - BgL_nboyerzd2benchmarkzd2 = function() { - var args = null; - for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { - args = sc_cons(arguments[sc_tmp], args); - } - var n; - return ((n = ((args === null)?(0):(args.car))), (BgL_setupzd2boyerzd2()), (BgL_runzd2benchmarkzd2(("nboyer"+(sc_number2string(n))), (1), function() { - return (BgL_testzd2boyerzd2(n)); - }, function(rewrites) { - if ((sc_isNumber(rewrites))) - switch (n) { - case (0): - return (rewrites===(95024)); - break; - case (1): - return (rewrites===(591777)); - break; - case (2): - return (rewrites===(1813975)); - break; - case (3): - return (rewrites===(5375678)); - break; - case (4): - return (rewrites===(16445406)); - break; - case (5): - return (rewrites===(51507739)); - break; - default: - return true; - break; - } - else - return false; - }))); - }; - BgL_setupzd2boyerzd2 = function() { - return true; - }; - BgL_testzd2boyerzd2 = function() { - return true; - }; - translate_term_nboyer = function(term) { - var lst; - return (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((translate_term_nboyer((lst.car))), (translate_args_nboyer((lst.cdr)))))))))); - }; - translate_args_nboyer = function(lst) { - var sc_lst_5; - var term; - return ((lst === null)?null:(new sc_Pair(((term = (lst.car)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))), ((sc_lst_5 = (lst.cdr)), ((sc_lst_5 === null)?null:(new sc_Pair((translate_term_nboyer((sc_lst_5.car))), (translate_args_nboyer((sc_lst_5.cdr)))))))))); - }; - untranslate_term_nboyer = function(term) { - var optrOpnd; - var tail1131; - var L1127; - var falseHead1130; - var symbol_record; - if (!(term instanceof sc_Pair)) - return term; - else - { - (falseHead1130 = (new sc_Pair(null, null))); - (L1127 = (term.cdr)); - (tail1131 = falseHead1130); - while (!(L1127 === null)) { - { - (tail1131.cdr = (new sc_Pair((untranslate_term_nboyer((L1127.car))), null))); - (tail1131 = (tail1131.cdr)); - (L1127 = (L1127.cdr)); - } - } - (optrOpnd = (falseHead1130.cdr)); - return (new sc_Pair(((symbol_record = (term.car)), (symbol_record[(0)])), optrOpnd)); - } - }; - BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function(sym) { - var r; - var x; - return ((x = (sc_assq(sym, BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), ((x!== false)?(x.cdr):((r = [sym, null]), (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = (new sc_Pair((new sc_Pair(sym, r)), BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), r))); - }; - (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null); - translate_alist_nboyer = function(alist) { - var sc_alist_6; - var term; - return ((alist === null)?null:(new sc_Pair((new sc_Pair((alist.car.car), ((term = (alist.car.cdr)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))))), ((sc_alist_6 = (alist.cdr)), ((sc_alist_6 === null)?null:(new sc_Pair((new sc_Pair((sc_alist_6.car.car), (translate_term_nboyer((sc_alist_6.car.cdr))))), (translate_alist_nboyer((sc_alist_6.cdr)))))))))); - }; - apply_subst_nboyer = function(alist, term) { - var lst; - var temp_temp; - return (!(term instanceof sc_Pair)?((temp_temp = (sc_assq(term, alist))), ((temp_temp!== false)?(temp_temp.cdr):term)):(new sc_Pair((term.car), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), (apply_subst_lst_nboyer(alist, (lst.cdr)))))))))); - }; - apply_subst_lst_nboyer = function(alist, lst) { - var sc_lst_7; - return ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), ((sc_lst_7 = (lst.cdr)), ((sc_lst_7 === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (sc_lst_7.car))), (apply_subst_lst_nboyer(alist, (sc_lst_7.cdr)))))))))); - }; - tautologyp_nboyer = function(sc_x_11, true_lst, false_lst) { - var tmp1125; - var x; - var tmp1126; - var sc_x_8; - var sc_tmp1125_9; - var sc_tmp1126_10; - var sc_x_11; - var true_lst; - var false_lst; - while (true) { - if ((((sc_tmp1126_10 = (is_term_equal_nboyer(sc_x_11, true_term_nboyer))), ((sc_tmp1126_10!== false)?sc_tmp1126_10:(is_term_member_nboyer(sc_x_11, true_lst))))!== false)) - return true; - else - if ((((sc_tmp1125_9 = (is_term_equal_nboyer(sc_x_11, false_term_nboyer))), ((sc_tmp1125_9!== false)?sc_tmp1125_9:(is_term_member_nboyer(sc_x_11, false_lst))))!== false)) - return false; - else - if (!(sc_x_11 instanceof sc_Pair)) - return false; - else - if (((sc_x_11.car)===if_constructor_nboyer)) - if ((((sc_x_8 = (sc_x_11.cdr.car)), (tmp1126 = (is_term_equal_nboyer(sc_x_8, true_term_nboyer))), ((tmp1126!== false)?tmp1126:(is_term_member_nboyer(sc_x_8, true_lst))))!== false)) - (sc_x_11 = (sc_x_11.cdr.cdr.car)); - else - if ((((x = (sc_x_11.cdr.car)), (tmp1125 = (is_term_equal_nboyer(x, false_term_nboyer))), ((tmp1125!== false)?tmp1125:(is_term_member_nboyer(x, false_lst))))!== false)) - (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car)); - else - if (((tautologyp_nboyer((sc_x_11.cdr.cdr.car), (new sc_Pair((sc_x_11.cdr.car), true_lst)), false_lst))!== false)) - { - (false_lst = (new sc_Pair((sc_x_11.cdr.car), false_lst))); - (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car)); - } - else - return false; - else - return false; - } - }; - (if_constructor_nboyer = "\u1E9C*"); - (rewrite_count_nboyer = (0)); - rewrite_nboyer = function(term) { - var term2; - var sc_term_12; - var lst; - var symbol_record; - var sc_lst_13; - { - (++rewrite_count_nboyer); - if (!(term instanceof sc_Pair)) - return term; - else - { - (sc_term_12 = (new sc_Pair((term.car), ((sc_lst_13 = (term.cdr)), ((sc_lst_13 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_13.car))), (rewrite_args_nboyer((sc_lst_13.cdr)))))))))); - (lst = ((symbol_record = (term.car)), (symbol_record[(1)]))); - while (true) { - if ((lst === null)) - return sc_term_12; - else - if ((((term2 = ((lst.car).cdr.car)), (unify_subst_nboyer = null), (one_way_unify1_nboyer(sc_term_12, term2)))!== false)) - return (rewrite_nboyer((apply_subst_nboyer(unify_subst_nboyer, ((lst.car).cdr.cdr.car))))); - else - (lst = (lst.cdr)); - } - } - } - }; - rewrite_args_nboyer = function(lst) { - var sc_lst_14; - return ((lst === null)?null:(new sc_Pair((rewrite_nboyer((lst.car))), ((sc_lst_14 = (lst.cdr)), ((sc_lst_14 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_14.car))), (rewrite_args_nboyer((sc_lst_14.cdr)))))))))); - }; - (unify_subst_nboyer = "\u1E9C*"); - one_way_unify1_nboyer = function(term1, term2) { - var lst1; - var lst2; - var temp_temp; - if (!(term2 instanceof sc_Pair)) - { - (temp_temp = (sc_assq(term2, unify_subst_nboyer))); - if ((temp_temp!== false)) - return (is_term_equal_nboyer(term1, (temp_temp.cdr))); - else - if ((sc_isNumber(term2))) - return (sc_isEqual(term1, term2)); - else - { - (unify_subst_nboyer = (new sc_Pair((new sc_Pair(term2, term1)), unify_subst_nboyer))); - return true; - } - } - else - if (!(term1 instanceof sc_Pair)) - return false; - else - if (((term1.car)===(term2.car))) - { - (lst1 = (term1.cdr)); - (lst2 = (term2.cdr)); - while (true) { - if ((lst1 === null)) - return (lst2 === null); - else - if ((lst2 === null)) - return false; - else - if (((one_way_unify1_nboyer((lst1.car), (lst2.car)))!== false)) - { - (lst1 = (lst1.cdr)); - (lst2 = (lst2.cdr)); - } - else - return false; - } - } - else - return false; - }; - (false_term_nboyer = "\u1E9C*"); - (true_term_nboyer = "\u1E9C*"); - trans_of_implies1_nboyer = function(n) { - var sc_n_15; - return ((sc_isEqual(n, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (n-(1)), n)), ((sc_n_15 = (n-(1))), ((sc_isEqual(sc_n_15, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (sc_n_15-(1)), sc_n_15)), (trans_of_implies1_nboyer((sc_n_15-(1))))))))))); - }; - is_term_equal_nboyer = function(x, y) { - var lst1; - var lst2; - var r2; - var r1; - if ((x instanceof sc_Pair)) - if ((y instanceof sc_Pair)) - if ((((r1 = (x.car)), (r2 = (y.car)), (r1===r2))!== false)) - { - (lst1 = (x.cdr)); - (lst2 = (y.cdr)); - while (true) { - if ((lst1 === null)) - return (lst2 === null); - else - if ((lst2 === null)) - return false; - else - if (((is_term_equal_nboyer((lst1.car), (lst2.car)))!== false)) - { - (lst1 = (lst1.cdr)); - (lst2 = (lst2.cdr)); - } - else - return false; - } - } - else - return false; - else - return false; - else - return (sc_isEqual(x, y)); - }; - is_term_member_nboyer = function(x, lst) { - var x; - var lst; - while (true) { - if ((lst === null)) - return false; - else - if (((is_term_equal_nboyer(x, (lst.car)))!== false)) - return true; - else - (lst = (lst.cdr)); - } - }; - BgL_setupzd2boyerzd2 = function() { - var symbol_record; - var value; - var BgL_sc_symbolzd2record_16zd2; - var sym; - var sc_sym_17; - var term; - var lst; - var sc_term_18; - var sc_term_19; - { - (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null); - (if_constructor_nboyer = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif"))); - (false_term_nboyer = ((sc_term_19 = (new sc_Pair("\u1E9Cf",null))), (!(sc_term_19 instanceof sc_Pair)?sc_term_19:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_19.car))), (translate_args_nboyer((sc_term_19.cdr)))))))); - (true_term_nboyer = ((sc_term_18 = (new sc_Pair("\u1E9Ct",null))), (!(sc_term_18 instanceof sc_Pair)?sc_term_18:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_18.car))), (translate_args_nboyer((sc_term_18.cdr)))))))); - (lst = sc_const_3_nboyer); - while (!(lst === null)) { - { - (term = (lst.car)); - if (((term instanceof sc_Pair)&&(((term.car)==="\u1E9Cequal")&&((term.cdr.car) instanceof sc_Pair)))) - { - (sc_sym_17 = ((term.cdr.car).car)); - (value = (new sc_Pair((!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr)))))), ((sym = ((term.cdr.car).car)), (BgL_sc_symbolzd2record_16zd2 = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sym))), (BgL_sc_symbolzd2record_16zd2[(1)]))))); - (symbol_record = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17))); - (symbol_record[(1)] = value); - } - else - (sc_error("ADD-LEMMA did not like term: ", term)); - (lst = (lst.cdr)); - } - } - return true; - } - }; - BgL_testzd2boyerzd2 = function(n) { - var optrOpnd; - var term; - var sc_n_20; - var answer; - var sc_term_21; - var sc_term_22; - { - (rewrite_count_nboyer = (0)); - (term = sc_const_4_nboyer); - (sc_n_20 = n); - while (!(sc_n_20=== 0)) { - { - (term = (sc_list("\u1E9Cor", term, (new sc_Pair("\u1E9Cf",null))))); - (--sc_n_20); - } - } - (sc_term_22 = term); - if (!(sc_term_22 instanceof sc_Pair)) - (optrOpnd = sc_term_22); - else - (optrOpnd = (new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_22.car))), (translate_args_nboyer((sc_term_22.cdr)))))); - (sc_term_21 = (apply_subst_nboyer(((const_nboyer === null)?null:(new sc_Pair((new sc_Pair((const_nboyer.car.car), (translate_term_nboyer((const_nboyer.car.cdr))))), (translate_alist_nboyer((const_nboyer.cdr)))))), optrOpnd))); - (answer = (tautologyp_nboyer((rewrite_nboyer(sc_term_21)), null, null))); - (sc_write(rewrite_count_nboyer)); - (sc_display(" rewrites")); - (sc_newline()); - if ((answer!== false)) - return rewrite_count_nboyer; - else - return false; - } - }; -} -/* Exported Variables */ -var BgL_parsezd2ze3nbzd2treesze3; -var BgL_earleyzd2benchmarkzd2; -var BgL_parsezd2ze3parsedzf3zc2; -var test; -var BgL_parsezd2ze3treesz31; -var BgL_makezd2parserzd2; -/* End Exports */ - -var const_earley; -{ - (const_earley = (new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair((new sc_Pair("\u1E9Ca",null)),(new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair("\u1E9Cs",null)))),null)))))),null))); - BgL_makezd2parserzd2 = function(grammar, lexer) { - var i; - var parser_descr; - var def_loop; - var nb_nts; - var names; - var steps; - var predictors; - var enders; - var starters; - var nts; - var sc_names_1; - var sc_steps_2; - var sc_predictors_3; - var sc_enders_4; - var sc_starters_5; - var nb_confs; - var BgL_sc_defzd2loop_6zd2; - var BgL_sc_nbzd2nts_7zd2; - var sc_nts_8; - var BgL_sc_defzd2loop_9zd2; - var ind; - { - ind = function(nt, sc_nts_10) { - var i; - { - (i = ((sc_nts_10.length)-(1))); - while (true) { - if ((i>=(0))) - if ((sc_isEqual((sc_nts_10[i]), nt))) - return i; - else - (--i); - else - return false; - } - } - }; - (sc_nts_8 = ((BgL_sc_defzd2loop_9zd2 = function(defs, sc_nts_11) { - var rule_loop; - var head; - var def; - return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, sc_nts_12) { - var nt; - var l; - var sc_nts_13; - var rule; - if ((rules instanceof sc_Pair)) - { - (rule = (rules.car)); - (l = rule); - (sc_nts_13 = sc_nts_12); - while ((l instanceof sc_Pair)) { - { - (nt = (l.car)); - (l = (l.cdr)); - (sc_nts_13 = (((sc_member(nt, sc_nts_13))!== false)?sc_nts_13:(new sc_Pair(nt, sc_nts_13)))); - } - } - return (rule_loop((rules.cdr), sc_nts_13)); - } - else - return (BgL_sc_defzd2loop_9zd2((defs.cdr), sc_nts_12)); - }), (rule_loop((def.cdr), (((sc_member(head, sc_nts_11))!== false)?sc_nts_11:(new sc_Pair(head, sc_nts_11)))))):(sc_list2vector((sc_reverse(sc_nts_11))))); - }), (BgL_sc_defzd2loop_9zd2(grammar, null)))); - (BgL_sc_nbzd2nts_7zd2 = (sc_nts_8.length)); - (nb_confs = (((BgL_sc_defzd2loop_6zd2 = function(defs, BgL_sc_nbzd2confs_14zd2) { - var rule_loop; - var def; - return ((defs instanceof sc_Pair)?((def = (defs.car)), (rule_loop = function(rules, BgL_sc_nbzd2confs_15zd2) { - var l; - var BgL_sc_nbzd2confs_16zd2; - var rule; - if ((rules instanceof sc_Pair)) - { - (rule = (rules.car)); - (l = rule); - (BgL_sc_nbzd2confs_16zd2 = BgL_sc_nbzd2confs_15zd2); - while ((l instanceof sc_Pair)) { - { - (l = (l.cdr)); - (++BgL_sc_nbzd2confs_16zd2); - } - } - return (rule_loop((rules.cdr), (BgL_sc_nbzd2confs_16zd2+(1)))); - } - else - return (BgL_sc_defzd2loop_6zd2((defs.cdr), BgL_sc_nbzd2confs_15zd2)); - }), (rule_loop((def.cdr), BgL_sc_nbzd2confs_14zd2))):BgL_sc_nbzd2confs_14zd2); - }), (BgL_sc_defzd2loop_6zd2(grammar, (0))))+BgL_sc_nbzd2nts_7zd2)); - (sc_starters_5 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); - (sc_enders_4 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); - (sc_predictors_3 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); - (sc_steps_2 = (sc_makeVector(nb_confs, false))); - (sc_names_1 = (sc_makeVector(nb_confs, false))); - (nts = sc_nts_8); - (starters = sc_starters_5); - (enders = sc_enders_4); - (predictors = sc_predictors_3); - (steps = sc_steps_2); - (names = sc_names_1); - (nb_nts = (sc_nts_8.length)); - (i = (nb_nts-(1))); - while ((i>=(0))) { - { - (sc_steps_2[i] = (i-nb_nts)); - (sc_names_1[i] = (sc_list((sc_nts_8[i]), (0)))); - (sc_enders_4[i] = (sc_list(i))); - (--i); - } - } - def_loop = function(defs, conf) { - var rule_loop; - var head; - var def; - return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, conf, rule_num) { - var i; - var sc_i_17; - var nt; - var l; - var sc_conf_18; - var sc_i_19; - var rule; - if ((rules instanceof sc_Pair)) - { - (rule = (rules.car)); - (names[conf] = (sc_list(head, rule_num))); - (sc_i_19 = (ind(head, nts))); - (starters[sc_i_19] = (new sc_Pair(conf, (starters[sc_i_19])))); - (l = rule); - (sc_conf_18 = conf); - while ((l instanceof sc_Pair)) { - { - (nt = (l.car)); - (steps[sc_conf_18] = (ind(nt, nts))); - (sc_i_17 = (ind(nt, nts))); - (predictors[sc_i_17] = (new sc_Pair(sc_conf_18, (predictors[sc_i_17])))); - (l = (l.cdr)); - (++sc_conf_18); - } - } - (steps[sc_conf_18] = ((ind(head, nts))-nb_nts)); - (i = (ind(head, nts))); - (enders[i] = (new sc_Pair(sc_conf_18, (enders[i])))); - return (rule_loop((rules.cdr), (sc_conf_18+(1)), (rule_num+(1)))); - } - else - return (def_loop((defs.cdr), conf)); - }), (rule_loop((def.cdr), conf, (1)))):undefined); - }; - (def_loop(grammar, (sc_nts_8.length))); - (parser_descr = [lexer, sc_nts_8, sc_starters_5, sc_enders_4, sc_predictors_3, sc_steps_2, sc_names_1]); - return function(input) { - var optrOpnd; - var sc_optrOpnd_20; - var sc_optrOpnd_21; - var sc_optrOpnd_22; - var loop1; - var BgL_sc_stateza2_23za2; - var toks; - var BgL_sc_nbzd2nts_24zd2; - var sc_steps_25; - var sc_enders_26; - var state_num; - var BgL_sc_statesza2_27za2; - var states; - var i; - var conf; - var l; - var tok_nts; - var sc_i_28; - var sc_i_29; - var l1; - var l2; - var tok; - var tail1129; - var L1125; - var goal_enders; - var BgL_sc_statesza2_30za2; - var BgL_sc_nbzd2nts_31zd2; - var BgL_sc_nbzd2confs_32zd2; - var nb_toks; - var goal_starters; - var sc_states_33; - var BgL_sc_nbzd2confs_34zd2; - var BgL_sc_nbzd2toks_35zd2; - var sc_toks_36; - var falseHead1128; - var sc_names_37; - var sc_steps_38; - var sc_predictors_39; - var sc_enders_40; - var sc_starters_41; - var sc_nts_42; - var lexer; - var sc_ind_43; - var make_states; - var BgL_sc_confzd2setzd2getza2_44za2; - var conf_set_merge_new_bang; - var conf_set_adjoin; - var BgL_sc_confzd2setzd2adjoinza2_45za2; - var BgL_sc_confzd2setzd2adjoinza2za2_46z00; - var conf_set_union; - var forw; - var is_parsed; - var deriv_trees; - var BgL_sc_derivzd2treesza2_47z70; - var nb_deriv_trees; - var BgL_sc_nbzd2derivzd2treesza2_48za2; - { - sc_ind_43 = function(nt, sc_nts_49) { - var i; - { - (i = ((sc_nts_49.length)-(1))); - while (true) { - if ((i>=(0))) - if ((sc_isEqual((sc_nts_49[i]), nt))) - return i; - else - (--i); - else - return false; - } - } - }; - make_states = function(BgL_sc_nbzd2toks_50zd2, BgL_sc_nbzd2confs_51zd2) { - var v; - var i; - var sc_states_52; - { - (sc_states_52 = (sc_makeVector((BgL_sc_nbzd2toks_50zd2+(1)), false))); - (i = BgL_sc_nbzd2toks_50zd2); - while ((i>=(0))) { - { - (v = (sc_makeVector((BgL_sc_nbzd2confs_51zd2+(1)), false))); - (v[(0)] = (-1)); - (sc_states_52[i] = v); - (--i); - } - } - return sc_states_52; - } - }; - BgL_sc_confzd2setzd2getza2_44za2 = function(state, BgL_sc_statezd2num_53zd2, sc_conf_54) { - var conf_set; - var BgL_sc_confzd2set_55zd2; - return ((BgL_sc_confzd2set_55zd2 = (state[(sc_conf_54+(1))])), ((BgL_sc_confzd2set_55zd2!== false)?BgL_sc_confzd2set_55zd2:((conf_set = (sc_makeVector((BgL_sc_statezd2num_53zd2+(6)), false))), (conf_set[(1)] = (-3)), (conf_set[(2)] = (-1)), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1)), (state[(sc_conf_54+(1))] = conf_set), conf_set))); - }; - conf_set_merge_new_bang = function(conf_set) { - return ((conf_set[((conf_set[(1)])+(5))] = (conf_set[(4)])), (conf_set[(1)] = (conf_set[(3)])), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1))); - }; - conf_set_adjoin = function(state, conf_set, sc_conf_56, i) { - var tail; - return ((tail = (conf_set[(3)])), (conf_set[(i+(5))] = (-1)), (conf_set[(tail+(5))] = i), (conf_set[(3)] = i), ((tail<(0))?((conf_set[(0)] = (state[(0)])), (state[(0)] = sc_conf_56)):undefined)); - }; - BgL_sc_confzd2setzd2adjoinza2_45za2 = function(sc_states_57, BgL_sc_statezd2num_58zd2, l, i) { - var conf_set; - var sc_conf_59; - var l1; - var state; - { - (state = (sc_states_57[BgL_sc_statezd2num_58zd2])); - (l1 = l); - while ((l1 instanceof sc_Pair)) { - { - (sc_conf_59 = (l1.car)); - (conf_set = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_58zd2, sc_conf_59))); - if (((conf_set[(i+(5))])=== false)) - { - (conf_set_adjoin(state, conf_set, sc_conf_59, i)); - (l1 = (l1.cdr)); - } - else - (l1 = (l1.cdr)); - } - } - return undefined; - } - }; - BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function(sc_states_60, BgL_sc_statesza2_61za2, BgL_sc_statezd2num_62zd2, sc_conf_63, i) { - var BgL_sc_confzd2setza2_64z70; - var BgL_sc_stateza2_65za2; - var conf_set; - var state; - return ((state = (sc_states_60[BgL_sc_statezd2num_62zd2])), ((((conf_set = (state[(sc_conf_63+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)?((BgL_sc_stateza2_65za2 = (BgL_sc_statesza2_61za2[BgL_sc_statezd2num_62zd2])), (BgL_sc_confzd2setza2_64z70 = (BgL_sc_confzd2setzd2getza2_44za2(BgL_sc_stateza2_65za2, BgL_sc_statezd2num_62zd2, sc_conf_63))), (((BgL_sc_confzd2setza2_64z70[(i+(5))])=== false)?(conf_set_adjoin(BgL_sc_stateza2_65za2, BgL_sc_confzd2setza2_64z70, sc_conf_63, i)):undefined), true):false)); - }; - conf_set_union = function(state, conf_set, sc_conf_66, other_set) { - var i; - { - (i = (other_set[(2)])); - while ((i>=(0))) { - if (((conf_set[(i+(5))])=== false)) - { - (conf_set_adjoin(state, conf_set, sc_conf_66, i)); - (i = (other_set[(i+(5))])); - } - else - (i = (other_set[(i+(5))])); - } - return undefined; - } - }; - forw = function(sc_states_67, BgL_sc_statezd2num_68zd2, sc_starters_69, sc_enders_70, sc_predictors_71, sc_steps_72, sc_nts_73) { - var next_set; - var next; - var conf_set; - var ender; - var l; - var starter_set; - var starter; - var sc_l_74; - var sc_loop1_75; - var head; - var BgL_sc_confzd2set_76zd2; - var BgL_sc_statezd2num_77zd2; - var state; - var sc_states_78; - var preds; - var BgL_sc_confzd2set_79zd2; - var step; - var sc_conf_80; - var BgL_sc_nbzd2nts_81zd2; - var sc_state_82; - { - (sc_state_82 = (sc_states_67[BgL_sc_statezd2num_68zd2])); - (BgL_sc_nbzd2nts_81zd2 = (sc_nts_73.length)); - while (true) { - { - (sc_conf_80 = (sc_state_82[(0)])); - if ((sc_conf_80>=(0))) - { - (step = (sc_steps_72[sc_conf_80])); - (BgL_sc_confzd2set_79zd2 = (sc_state_82[(sc_conf_80+(1))])); - (head = (BgL_sc_confzd2set_79zd2[(4)])); - (sc_state_82[(0)] = (BgL_sc_confzd2set_79zd2[(0)])); - (conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2)); - if ((step>=(0))) - { - (sc_l_74 = (sc_starters_69[step])); - while ((sc_l_74 instanceof sc_Pair)) { - { - (starter = (sc_l_74.car)); - (starter_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, starter))); - if (((starter_set[(BgL_sc_statezd2num_68zd2+(5))])=== false)) - { - (conf_set_adjoin(sc_state_82, starter_set, starter, BgL_sc_statezd2num_68zd2)); - (sc_l_74 = (sc_l_74.cdr)); - } - else - (sc_l_74 = (sc_l_74.cdr)); - } - } - (l = (sc_enders_70[step])); - while ((l instanceof sc_Pair)) { - { - (ender = (l.car)); - if ((((conf_set = (sc_state_82[(ender+(1))])), ((conf_set!== false)?(conf_set[(BgL_sc_statezd2num_68zd2+(5))]):false))!== false)) - { - (next = (sc_conf_80+(1))); - (next_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, next))); - (conf_set_union(sc_state_82, next_set, next, BgL_sc_confzd2set_79zd2)); - (l = (l.cdr)); - } - else - (l = (l.cdr)); - } - } - } - else - { - (preds = (sc_predictors_71[(step+BgL_sc_nbzd2nts_81zd2)])); - (sc_states_78 = sc_states_67); - (state = sc_state_82); - (BgL_sc_statezd2num_77zd2 = BgL_sc_statezd2num_68zd2); - (BgL_sc_confzd2set_76zd2 = BgL_sc_confzd2set_79zd2); - sc_loop1_75 = function(l) { - var sc_state_83; - var BgL_sc_nextzd2set_84zd2; - var sc_next_85; - var pred_set; - var i; - var pred; - if ((l instanceof sc_Pair)) - { - (pred = (l.car)); - (i = head); - while ((i>=(0))) { - { - (pred_set = ((sc_state_83 = (sc_states_78[i])), (sc_state_83[(pred+(1))]))); - if ((pred_set!== false)) - { - (sc_next_85 = (pred+(1))); - (BgL_sc_nextzd2set_84zd2 = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_77zd2, sc_next_85))); - (conf_set_union(state, BgL_sc_nextzd2set_84zd2, sc_next_85, pred_set)); - } - (i = (BgL_sc_confzd2set_76zd2[(i+(5))])); - } - } - return (sc_loop1_75((l.cdr))); - } - else - return undefined; - }; - (sc_loop1_75(preds)); - } - } - else - return undefined; - } - } - } - }; - is_parsed = function(nt, i, j, sc_nts_86, sc_enders_87, sc_states_88) { - var conf_set; - var state; - var sc_conf_89; - var l; - var BgL_sc_ntza2_90za2; - { - (BgL_sc_ntza2_90za2 = (sc_ind_43(nt, sc_nts_86))); - if ((BgL_sc_ntza2_90za2!== false)) - { - (sc_nts_86.length); - (l = (sc_enders_87[BgL_sc_ntza2_90za2])); - while (true) { - if ((l instanceof sc_Pair)) - { - (sc_conf_89 = (l.car)); - if ((((state = (sc_states_88[j])), (conf_set = (state[(sc_conf_89+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) - return true; - else - (l = (l.cdr)); - } - else - return false; - } - } - else - return false; - } - }; - deriv_trees = function(sc_conf_91, i, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2) { - var sc_loop1_98; - var prev; - var name; - return ((name = (sc_names_94[sc_conf_91])), ((name!== false)?((sc_conf_91=(0))) - if (((k>=i)&&(((sc_state_99 = (sc_states_96[k])), (conf_set = (sc_state_99[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))) - { - (prev_trees = (deriv_trees(prev, i, k, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2))); - (ender_trees = (deriv_trees(ender, k, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2))); - loop3 = function(l3, l2) { - var l4; - var sc_l2_100; - var ender_tree; - if ((l3 instanceof sc_Pair)) - { - (ender_tree = (sc_list((l3.car)))); - (l4 = prev_trees); - (sc_l2_100 = l2); - while ((l4 instanceof sc_Pair)) { - { - (sc_l2_100 = (new sc_Pair((sc_append((l4.car), ender_tree)), sc_l2_100))); - (l4 = (l4.cdr)); - } - } - return (loop3((l3.cdr), sc_l2_100)); - } - else - return (loop2((ender_set[(k+(5))]), l2)); - }; - return (loop3(ender_trees, l2)); - } - else - (k = (ender_set[(k+(5))])); - else - return (sc_loop1_98((l1.cdr), l2)); - } - }; - return (loop2((ender_set[(2)]), l2)); - } - else - (l1 = (l1.cdr)); - } - else - return l2; - } - }), (sc_loop1_98((sc_enders_92[(sc_steps_93[prev])]), null))))); - }; - BgL_sc_derivzd2treesza2_47z70 = function(nt, i, j, sc_nts_101, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106) { - var conf_set; - var state; - var sc_conf_107; - var l; - var trees; - var BgL_sc_nbzd2nts_108zd2; - var BgL_sc_ntza2_109za2; - { - (BgL_sc_ntza2_109za2 = (sc_ind_43(nt, sc_nts_101))); - if ((BgL_sc_ntza2_109za2!== false)) - { - (BgL_sc_nbzd2nts_108zd2 = (sc_nts_101.length)); - (l = (sc_enders_102[BgL_sc_ntza2_109za2])); - (trees = null); - while ((l instanceof sc_Pair)) { - { - (sc_conf_107 = (l.car)); - if ((((state = (sc_states_106[j])), (conf_set = (state[(sc_conf_107+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) - { - (l = (l.cdr)); - (trees = (sc_append((deriv_trees(sc_conf_107, i, j, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106, BgL_sc_nbzd2nts_108zd2)), trees))); - } - else - (l = (l.cdr)); - } - } - return trees; - } - else - return false; - } - }; - nb_deriv_trees = function(sc_conf_110, i, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2) { - var sc_loop1_116; - var tmp1124; - var prev; - return ((prev = (sc_conf_110-(1))), ((((tmp1124 = (sc_conf_110=(0))) { - if (((k>=i)&&(((state = (sc_states_114[k])), (conf_set = (state[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))) - { - (nb_prev_trees = (nb_deriv_trees(prev, i, k, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2))); - (nb_ender_trees = (nb_deriv_trees(ender, k, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2))); - (k = (ender_set[(k+(5))])); - (n +=(nb_prev_trees*nb_ender_trees)); - } - else - (k = (ender_set[(k+(5))])); - } - return (sc_loop1_116((l.cdr), n)); - } - else - (l = (l.cdr)); - } - else - return sc_n_118; - } - }), (sc_loop1_116((sc_enders_111[(sc_steps_112[prev])]), (0)))))); - }; - BgL_sc_nbzd2derivzd2treesza2_48za2 = function(nt, i, j, sc_nts_119, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123) { - var conf_set; - var state; - var sc_conf_124; - var l; - var nb_trees; - var BgL_sc_nbzd2nts_125zd2; - var BgL_sc_ntza2_126za2; - { - (BgL_sc_ntza2_126za2 = (sc_ind_43(nt, sc_nts_119))); - if ((BgL_sc_ntza2_126za2!== false)) - { - (BgL_sc_nbzd2nts_125zd2 = (sc_nts_119.length)); - (l = (sc_enders_120[BgL_sc_ntza2_126za2])); - (nb_trees = (0)); - while ((l instanceof sc_Pair)) { - { - (sc_conf_124 = (l.car)); - if ((((state = (sc_states_123[j])), (conf_set = (state[(sc_conf_124+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) - { - (l = (l.cdr)); - (nb_trees = ((nb_deriv_trees(sc_conf_124, i, j, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123, BgL_sc_nbzd2nts_125zd2))+nb_trees)); - } - else - (l = (l.cdr)); - } - } - return nb_trees; - } - else - return false; - } - }; - (lexer = (parser_descr[(0)])); - (sc_nts_42 = (parser_descr[(1)])); - (sc_starters_41 = (parser_descr[(2)])); - (sc_enders_40 = (parser_descr[(3)])); - (sc_predictors_39 = (parser_descr[(4)])); - (sc_steps_38 = (parser_descr[(5)])); - (sc_names_37 = (parser_descr[(6)])); - (falseHead1128 = (new sc_Pair(null, null))); - (L1125 = (lexer(input))); - (tail1129 = falseHead1128); - while (!(L1125 === null)) { - { - (tok = (L1125.car)); - (l1 = (tok.cdr)); - (l2 = null); - while ((l1 instanceof sc_Pair)) { - { - (sc_i_29 = (sc_ind_43((l1.car), sc_nts_42))); - if ((sc_i_29!== false)) - { - (l1 = (l1.cdr)); - (l2 = (new sc_Pair(sc_i_29, l2))); - } - else - (l1 = (l1.cdr)); - } - } - (sc_optrOpnd_22 = (new sc_Pair((tok.car), (sc_reverse(l2))))); - (sc_optrOpnd_21 = (new sc_Pair(sc_optrOpnd_22, null))); - (tail1129.cdr = sc_optrOpnd_21); - (tail1129 = (tail1129.cdr)); - (L1125 = (L1125.cdr)); - } - } - (sc_optrOpnd_20 = (falseHead1128.cdr)); - (sc_toks_36 = (sc_list2vector(sc_optrOpnd_20))); - (BgL_sc_nbzd2toks_35zd2 = (sc_toks_36.length)); - (BgL_sc_nbzd2confs_34zd2 = (sc_steps_38.length)); - (sc_states_33 = (make_states(BgL_sc_nbzd2toks_35zd2, BgL_sc_nbzd2confs_34zd2))); - (goal_starters = (sc_starters_41[(0)])); - (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33, (0), goal_starters, (0))); - (forw(sc_states_33, (0), sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_nts_42)); - (sc_i_28 = (0)); - while ((sc_i_28=(0))) { - { - (states = sc_states_33); - (BgL_sc_statesza2_27za2 = BgL_sc_statesza2_30za2); - (state_num = i); - (sc_enders_26 = sc_enders_40); - (sc_steps_25 = sc_steps_38); - (BgL_sc_nbzd2nts_24zd2 = BgL_sc_nbzd2nts_31zd2); - (toks = sc_toks_36); - (BgL_sc_stateza2_23za2 = (BgL_sc_statesza2_30za2[i])); - loop1 = function() { - var sc_loop1_127; - var prev; - var BgL_sc_statesza2_128za2; - var sc_states_129; - var j; - var i; - var sc_i_130; - var head; - var conf_set; - var sc_conf_131; - { - (sc_conf_131 = (BgL_sc_stateza2_23za2[(0)])); - if ((sc_conf_131>=(0))) - { - (conf_set = (BgL_sc_stateza2_23za2[(sc_conf_131+(1))])); - (head = (conf_set[(4)])); - (BgL_sc_stateza2_23za2[(0)] = (conf_set[(0)])); - (conf_set_merge_new_bang(conf_set)); - (sc_i_130 = head); - while ((sc_i_130>=(0))) { - { - (i = sc_i_130); - (j = state_num); - (sc_states_129 = states); - (BgL_sc_statesza2_128za2 = BgL_sc_statesza2_27za2); - (prev = (sc_conf_131-(1))); - if (((sc_conf_131>=BgL_sc_nbzd2nts_24zd2)&&((sc_steps_25[prev])>=(0)))) - { - sc_loop1_127 = function(l) { - var k; - var ender_set; - var state; - var ender; - var l; - while (true) { - if ((l instanceof sc_Pair)) - { - (ender = (l.car)); - (ender_set = ((state = (sc_states_129[j])), (state[(ender+(1))]))); - if ((ender_set!== false)) - { - (k = (ender_set[(2)])); - while ((k>=(0))) { - { - if ((k>=i)) - if (((BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, k, prev, i))!== false)) - (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, j, ender, k)); - (k = (ender_set[(k+(5))])); - } - } - return (sc_loop1_127((l.cdr))); - } - else - (l = (l.cdr)); - } - else - return undefined; - } - }; - (sc_loop1_127((sc_enders_26[(sc_steps_25[prev])]))); - } - (sc_i_130 = (conf_set[(sc_i_130+(5))])); - } - } - return (loop1()); - } - else - return undefined; - } - }; - (loop1()); - (--i); - } - } - (optrOpnd = BgL_sc_statesza2_30za2); - return [sc_nts_42, sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_names_37, sc_toks_36, optrOpnd, is_parsed, BgL_sc_derivzd2treesza2_47z70, BgL_sc_nbzd2derivzd2treesza2_48za2]; - } - }; - } - }; - BgL_parsezd2ze3parsedzf3zc2 = function(parse, nt, i, j) { - var is_parsed; - var states; - var enders; - var nts; - return ((nts = (parse[(0)])), (enders = (parse[(2)])), (states = (parse[(7)])), (is_parsed = (parse[(8)])), (is_parsed(nt, i, j, nts, enders, states))); - }; - BgL_parsezd2ze3treesz31 = function(parse, nt, i, j) { - var BgL_sc_derivzd2treesza2_132z70; - var states; - var toks; - var names; - var steps; - var enders; - var nts; - return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (names = (parse[(5)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_derivzd2treesza2_132z70 = (parse[(9)])), (BgL_sc_derivzd2treesza2_132z70(nt, i, j, nts, enders, steps, names, toks, states))); - }; - BgL_parsezd2ze3nbzd2treesze3 = function(parse, nt, i, j) { - var BgL_sc_nbzd2derivzd2treesza2_133za2; - var states; - var toks; - var steps; - var enders; - var nts; - return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_nbzd2derivzd2treesza2_133za2 = (parse[(10)])), (BgL_sc_nbzd2derivzd2treesza2_133za2(nt, i, j, nts, enders, steps, toks, states))); - }; - test = function(k) { - var x; - var p; - return ((p = (BgL_makezd2parserzd2(const_earley, function(l) { - var sc_x_134; - var tail1134; - var L1130; - var falseHead1133; - { - (falseHead1133 = (new sc_Pair(null, null))); - (tail1134 = falseHead1133); - (L1130 = l); - while (!(L1130 === null)) { - { - (tail1134.cdr = (new sc_Pair(((sc_x_134 = (L1130.car)), (sc_list(sc_x_134, sc_x_134))), null))); - (tail1134 = (tail1134.cdr)); - (L1130 = (L1130.cdr)); - } - } - return (falseHead1133.cdr); - } - }))), (x = (p((sc_vector2list((sc_makeVector(k, "\u1E9Ca"))))))), (sc_length((BgL_parsezd2ze3treesz31(x, "\u1E9Cs", (0), k))))); - }; - BgL_earleyzd2benchmarkzd2 = function() { - var args = null; - for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { - args = sc_cons(arguments[sc_tmp], args); - } - var k; - return ((k = ((args === null)?(7):(args.car))), (BgL_runzd2benchmarkzd2("earley", (1), function() { - return (test(k)); - }, function(result) { - return ((sc_display(result)), (sc_newline()), result == 132); - }))); - }; -} - - -/************* END OF GENERATED CODE *************/ -// Invoke this function to run a benchmark. -// The first argument is a string identifying the benchmark. -// The second argument is the number of times to run the benchmark. -// The third argument is a function that runs the benchmark. -// The fourth argument is a unary function that warns if the result -// returned by the benchmark is incorrect. -// -// Example: -// RunBenchmark("new Array()", -// 1, -// function () { new Array(1000000); } -// function (v) { -// return (v instanceof Array) && (v.length == 1000000); -// }); - -SC_DEFAULT_OUT = new sc_GenericOutputPort(function(s) {}); -SC_ERROR_OUT = SC_DEFAULT_OUT; - -function RunBenchmark(name, count, run, warn) { - for (var n = 0; n < count; ++n) { - result = run(); - if (!warn(result)) { - throw new Error("Earley or Boyer did incorrect number of rewrites"); - } - } -} - -var BgL_runzd2benchmarkzd2 = RunBenchmark; - -for (var i = 0; i < 4; ++i) { - BgL_earleyzd2benchmarkzd2(); - BgL_nboyerzd2benchmarkzd2(); -} - -} catch (e) { - print("JSC EXCEPTION FUZZ: Caught exception: " + e); -} - diff --git a/implementation-contributed/javascriptcore/heapProfiler/basic-edges.js b/implementation-contributed/javascriptcore/heapProfiler/basic-edges.js deleted file mode 100644 index aacf5bc2d6..0000000000 --- a/implementation-contributed/javascriptcore/heapProfiler/basic-edges.js +++ /dev/null @@ -1,61 +0,0 @@ -var SimpleObject = $vm.SimpleObject; -var setHiddenValue = $vm.setHiddenValue; - -load("./driver/driver.js"); - -function excludeStructure(edges) { - return edges.filter((x) => x.to.className !== "Structure"); -} - -let simpleObject1NodeId; -let simpleObject2NodeId; - -let simpleObject1 = new SimpleObject; -let simpleObject2 = new SimpleObject; - -(function() { - let snapshot = createCheapHeapSnapshot(); - let nodes = snapshot.nodesWithClassName("SimpleObject"); - assert(nodes.length === 2, "Snapshot should contain 2 'SimpleObject' instances"); - let simpleObject1Node = nodes[0].outgoingEdges.length === 2 ? nodes[0] : nodes[1]; - let simpleObject2Node = nodes[0].outgoingEdges.length === 1 ? nodes[0] : nodes[1]; - assert(simpleObject1Node.outgoingEdges.length === 1, "'simpleObject1' should reference only its structure"); - assert(simpleObject2Node.outgoingEdges.length === 1, "'simpleObject2' should reference only its structure"); -})(); - -setHiddenValue(simpleObject1, simpleObject2); - -(function() { - let snapshot = createCheapHeapSnapshot(); - let nodes = snapshot.nodesWithClassName("SimpleObject"); - assert(nodes.length === 2, "Snapshot should contain 2 'SimpleObject' instances"); - let simpleObject1Node = nodes[0].outgoingEdges.length === 2 ? nodes[0] : nodes[1]; - let simpleObject2Node = nodes[0].outgoingEdges.length === 1 ? nodes[0] : nodes[1]; - assert(simpleObject1Node.outgoingEdges.length === 2, "'simpleObject1' should reference its structure and hidden value"); - assert(simpleObject2Node.outgoingEdges.length === 1, "'simpleObject2' should reference only its structure"); - assert(excludeStructure(simpleObject1Node.outgoingEdges)[0].to.id === simpleObject2Node.id, "'simpleObject1' should reference 'simpleObject2'"); - simpleObject1NodeId = simpleObject1Node.id; - simpleObject2NodeId = simpleObject2Node.id; -})(); - -simpleObject2 = null; - -(function() { - let snapshot = createCheapHeapSnapshot(); - let nodes = snapshot.nodesWithClassName("SimpleObject"); - assert(nodes.length === 2, "Snapshot should contain 2 'SimpleObject' instances"); - let simpleObject1Node = nodes[0].id === simpleObject1NodeId ? nodes[0] : nodes[1]; - let simpleObject2Node = nodes[0].id === simpleObject2NodeId ? nodes[0] : nodes[1]; - assert(simpleObject1Node.id === simpleObject1NodeId && simpleObject2Node.id === simpleObject2NodeId, "node identifiers were maintained"); - assert(simpleObject1Node.outgoingEdges.length === 2, "'simpleObject1' should reference its structure and hidden value"); - assert(simpleObject2Node.outgoingEdges.length === 1, "'simpleObject2' should reference only its structure"); - assert(excludeStructure(simpleObject1Node.outgoingEdges)[0].to.id === simpleObject2NodeId, "'simpleObject1' should reference 'simpleObject2'"); -})(); - -simpleObject1 = null; - -(function() { - let snapshot = createCheapHeapSnapshot(); - let nodes = snapshot.nodesWithClassName("SimpleObject"); - assert(nodes.length === 0, "Snapshot should not contain a 'SimpleObject' instance"); -})(); diff --git a/implementation-contributed/javascriptcore/heapProfiler/property-edge-types.js b/implementation-contributed/javascriptcore/heapProfiler/property-edge-types.js deleted file mode 100644 index c40c1701cd..0000000000 --- a/implementation-contributed/javascriptcore/heapProfiler/property-edge-types.js +++ /dev/null @@ -1,101 +0,0 @@ -var SimpleObject = $vm.SimpleObject; -var setHiddenValue = $vm.setHiddenValue; - -load("./driver/driver.js"); - -let simpleObject = new SimpleObject; -setHiddenValue(simpleObject, "hiddenValue"); // Internal -simpleObject.propertyName1 = "propertyValue1"; // Property -simpleObject["propertyName2"] = "propertyValue2"; // Property -simpleObject[100] = "indexedValue"; // Index -simpleObject[0xffffffff + 100] = "largeIndexValueBecomingProperty"; // Property -simpleObject.point = {x:"x1", y:"y1"}; // Property => object with 2 inline properties. - -// ---------- - -function excludeStructure(edges) { - return edges.filter((x) => x.to.className !== "Structure"); -} - -let snapshot = createHeapSnapshot(); - -// Internal, Property, and Index edges on an Object. -let nodes = snapshot.nodesWithClassName("SimpleObject"); -assert(nodes.length === 1, "Snapshot should contain 1 'SimpleObject' instance"); -let simpleObjectNode = nodes[0]; -let edges = excludeStructure(simpleObjectNode.outgoingEdges); -let pointNode = null; - -let seenHiddenValue = false; -let seenPropertyName1 = false; -let seenPropertyName2 = false; -let seenIndex100 = false; -let seenLargeIndex = false; -let seenObjectWithInlineStorage = false; -let largeIndexName = (0xffffffff + 100).toString(); - -for (let edge of edges) { - switch (edge.type) { - case "Internal": - assert(!seenHiddenValue); - seenHiddenValue = true; - break; - case "Property": - if (edge.data === "propertyName1") - seenPropertyName1 = true; - else if (edge.data === "propertyName2") - seenPropertyName2 = true; - else if (edge.data === largeIndexName) - seenLargeIndex = true; - else if (edge.data === "point") { - seenPoint = true; - pointNode = edge.to; - } else - assert(false, "Unexpected property name"); - break; - case "Index": - if (edge.data === 100) - seenIndex100 = true; - break; - case "Variable": - assert(false, "Should not see a variable edge for SimpleObject instance"); - break; - default: - assert(false, "Unexpected edge type"); - break; - } -} - -assert(seenHiddenValue, "Should see Internal edge for hidden value"); -assert(seenPropertyName1, "Should see Property edge for propertyName1"); -assert(seenPropertyName2, "Should see Property edge for propertyName2"); -assert(seenIndex100, "Should see Index edge for index 100"); -assert(seenLargeIndex, "Should see Property edge for index " + largeIndexName); - - -// Property on an Object's inline storage. -let pointEdges = excludeStructure(pointNode.outgoingEdges); - -let seenPropertyX = false; -let seenPropertyY = false; - -for (let edge of pointEdges) { - switch (edge.type) { - case "Property": - if (edge.data === "x") - seenPropertyX = true; - else if (edge.data === "y") - seenPropertyY = true; - else - assert(false, "Unexpected property name"); - break; - case "Index": - case "Variable": - case "Internal": - assert(false, "Unexpected edge type"); - break; - } -} - -assert(seenPropertyX, "Should see Property edge for x"); -assert(seenPropertyY, "Should see Property edge for y"); diff --git a/implementation-contributed/javascriptcore/modules/namespace-object-try-get.js b/implementation-contributed/javascriptcore/modules/namespace-object-try-get.js deleted file mode 100644 index 84fd161104..0000000000 --- a/implementation-contributed/javascriptcore/modules/namespace-object-try-get.js +++ /dev/null @@ -1,25 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -import { shouldBe } from "./resources/assert.js"; -import * as ns from "./namespace-object-try-get.js" - -function tryGetByIdText(propertyName) { return `(function (base) { return @tryGetById(base, '${propertyName}'); })`; } - -function tryGetByIdTextStrict(propertyName) { return `(function (base) { "use strict"; return @tryGetById(base, '${propertyName}'); })`; } - -{ - let get = createBuiltin(tryGetByIdText("empty")); - noInline(get); - - // Do not throw. - shouldBe(get(ns), null); - - let getStrict = createBuiltin(tryGetByIdTextStrict("empty")); - noInline(getStrict); - - // Do not throw. - shouldBe(getStrict(ns), null); - -} - -export let empty; diff --git a/implementation-contributed/javascriptcore/stress/argument-count-bytecode.js b/implementation-contributed/javascriptcore/stress/argument-count-bytecode.js deleted file mode 100644 index 59a1385425..0000000000 --- a/implementation-contributed/javascriptcore/stress/argument-count-bytecode.js +++ /dev/null @@ -1,40 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -count = createBuiltin("(function () { return @argumentCount(); })"); -countNoInline = createBuiltin("(function () { return @argumentCount(); })"); -noInline(countNoInline); - - -function inlineCount() { return count(); } -noInline(inlineCount); - -function inlineCount1() { return count(1); } -noInline(inlineCount1); - -function inlineCount2() { return count(1,2); } -noInline(inlineCount2); - -function inlineCountVarArgs(list) { return count(...list); } -noInline(inlineCountVarArgs); - -function assert(condition, message) { - if (!condition) - throw new Error(message); -} - -for (i = 0; i < 1000000; i++) { - assert(count(1,1,2) === 3, i); - assert(count() === 0, i); - assert(count(1) === 1, i); - assert(count(...[1,2,3,4,5]) === 5, i); - assert(count(...[]) === 0, i); - assert(inlineCount() === 0, i); - assert(inlineCount1() === 1, i); - assert(inlineCount2() === 2, i); - assert(inlineCountVarArgs([1,2,3,4]) === 4, i); - assert(inlineCountVarArgs([]) === 0, i); - // Insert extra junk so that inlineCountVarArgs.arguments.length !== count.arguments.length - assert(inlineCountVarArgs([1], 2, 4) === 1, i); - assert(countNoInline(4) === 1, i) - assert(countNoInline() === 0, i); -} diff --git a/implementation-contributed/javascriptcore/stress/argument-intrinsic-basic.js b/implementation-contributed/javascriptcore/stress/argument-intrinsic-basic.js deleted file mode 100644 index 27e5a78f9c..0000000000 --- a/implementation-contributed/javascriptcore/stress/argument-intrinsic-basic.js +++ /dev/null @@ -1,20 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (a) { - return @argument(1); -})`); -noInline(builtin); - -(function () { - for (var i = 0; i < 1e4; ++i) { - shouldBe(builtin(), undefined); - shouldBe(builtin(1), undefined); - shouldBe(builtin(1, 2), 2); - shouldBe(builtin(1, 2, 3), 2); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-use-caller-arg.js b/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-use-caller-arg.js deleted file mode 100644 index 5e8419a144..0000000000 --- a/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-use-caller-arg.js +++ /dev/null @@ -1,33 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -function test() -{ - return 42; -} -noInline(test); - -var builtin = createBuiltin(`(function (a) { - return @argument(2); -})`); - -function inlining(a, b, c) -{ - return builtin(1, 2, test(), 4, 5, 6, 7); -} -noInline(inlining); - -function escape(value) -{ - return value; -} -noInline(escape); - -(function () { - for (var i = 0; i < 1e4; ++i) - shouldBe(escape(inlining(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), 42); -}()); diff --git a/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-with-result-escape.js b/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-with-result-escape.js deleted file mode 100644 index 21e3a45e26..0000000000 --- a/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-with-result-escape.js +++ /dev/null @@ -1,23 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (a) { - return @argument(0); -})`); - -function escape(value) -{ - return value; -} -noInline(escape); - -(function () { - for (var i = 0; i < 1e4; ++i) { - shouldBe(escape(builtin()), undefined); - shouldBe(escape(builtin(42)), 42); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-with-vararg-with-enough-arguments.js b/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-with-vararg-with-enough-arguments.js deleted file mode 100644 index 7c23c20f83..0000000000 --- a/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-with-vararg-with-enough-arguments.js +++ /dev/null @@ -1,27 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (a) { - return @argument(5); -})`); - -function inlining(a, b, c) -{ - return builtin.call(this, ...[1, 2, 3, 4, 5, 6, 7]); -} -noInline(inlining); - -function escape(value) -{ - return value; -} -noInline(escape); - -(function () { - for (var i = 0; i < 1e4; ++i) - shouldBe(escape(inlining(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), 6); -}()); diff --git a/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-with-vararg.js b/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-with-vararg.js deleted file mode 100644 index f69f4e52a9..0000000000 --- a/implementation-contributed/javascriptcore/stress/argument-intrinsic-inlining-with-vararg.js +++ /dev/null @@ -1,27 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (a) { - return @argument(5); -})`); - -function inlining(a, b, c) -{ - return builtin.call(this, ...[1, 2, 3, 4, 5, 6, 7]); -} -noInline(inlining); - -function escape(value) -{ - return value; -} -noInline(escape); - -(function () { - for (var i = 0; i < 1e4; ++i) - shouldBe(escape(inlining(0)), 6); -}()); diff --git a/implementation-contributed/javascriptcore/stress/argument-intrinsic-nested-inlining.js b/implementation-contributed/javascriptcore/stress/argument-intrinsic-nested-inlining.js deleted file mode 100644 index 071691c9af..0000000000 --- a/implementation-contributed/javascriptcore/stress/argument-intrinsic-nested-inlining.js +++ /dev/null @@ -1,33 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (a) { - return @argument(0); -})`); - -function builtinCaller1() -{ - return builtin(); -} - -function builtinCaller2() -{ - return builtin(42); -} - -function escape(value) -{ - return value; -} -noInline(escape); - -(function () { - for (var i = 0; i < 1e4; ++i) { - shouldBe(escape(builtinCaller1()), undefined); - shouldBe(escape(builtinCaller2()), 42); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/argument-intrinsic-not-convert-to-get-argument.js b/implementation-contributed/javascriptcore/stress/argument-intrinsic-not-convert-to-get-argument.js deleted file mode 100644 index 5cee5e2687..0000000000 --- a/implementation-contributed/javascriptcore/stress/argument-intrinsic-not-convert-to-get-argument.js +++ /dev/null @@ -1,17 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (a) { - return @argument(0); -})`); - -(function () { - for (var i = 0; i < 1e4; ++i) { - shouldBe(builtin(), undefined); - shouldBe(builtin(42), 42); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/argument-intrinsic-with-stack-write.js b/implementation-contributed/javascriptcore/stress/argument-intrinsic-with-stack-write.js deleted file mode 100644 index 688c687dfa..0000000000 --- a/implementation-contributed/javascriptcore/stress/argument-intrinsic-with-stack-write.js +++ /dev/null @@ -1,21 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (a) { - a = 42; - return @argument(0); -})`); -noInline(builtin); - -(function () { - for (var i = 0; i < 1e4; ++i) { - shouldBe(builtin(), undefined); - shouldBe(builtin(1), 42); - shouldBe(builtin(1, 2), 42); - shouldBe(builtin(1, 2, 3), 42); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/arity-mismatch-get-argument.js b/implementation-contributed/javascriptcore/stress/arity-mismatch-get-argument.js deleted file mode 100644 index 3b746e3428..0000000000 --- a/implementation-contributed/javascriptcore/stress/arity-mismatch-get-argument.js +++ /dev/null @@ -1,23 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) -{ - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function () { - return @argument(0); -})`); - -function test() -{ - var result = builtin(); - shouldBe(result, undefined); - var result = builtin(42); - shouldBe(result, 42); -} -noInline(test); - -for (var i = 0; i < 1e4; ++i) - test(); diff --git a/implementation-contributed/javascriptcore/stress/array-message-passing.js b/implementation-contributed/javascriptcore/stress/array-message-passing.js deleted file mode 100644 index 92ae694386..0000000000 --- a/implementation-contributed/javascriptcore/stress/array-message-passing.js +++ /dev/null @@ -1,251 +0,0 @@ -// This test was originally for message passing of typed arrays. But it turns out that it is a good -// stress of JSC inline caches as well. So, this is a DOMless version of the test. - -var abort = $vm.abort; - -var window; - -(function() { - var listeners = []; - var messages = []; - - window = { - addEventListener: function(type, listener) { - listeners.push(listener); - }, - postMessage: function(message) { - messages.push(message); - }, - _handleEvents: function() { - for (var i = 0; i < messages.length; ++i) { - for (var j = 0; j < listeners.length; ++j) - listeners[j]({data: messages[i]}); - } - messages = []; - } - }; -})(); - -window.jsTestIsAsync = true; - -window.testsComplete = 0; - -function testPassed() { } - -function testFailed(string) { - try { - throw new Error("Test failed: " + string); - } catch (e) { - print(e.message); - print(e.stack); - abort(); - } -} - -function classCompare(testName, got, sent) { - var classString = Object.prototype.toString; - var gotClass = classString.call(got); - var sentClass = classString.call(sent); - if (gotClass !== sentClass) { - testFailed(testName + ": class " + sentClass + " became " + gotClass); - return false; - } else { - testPassed(testName + ": classes are " + sentClass); - return true; - } -} - -function bufferCompare(testName, got, sent) { - if (!classCompare(testName, got, sent)) { - return false; - } - if (got.byteLength !== sent.byteLength) { - testFailed(testName + ": expected byteLength " + sent.byteLength + " bytes, got " + got.byteLength); - return false; - } else { - testPassed(testName + ": buffer lengths are " + sent.byteLength); - } - var gotReader = new Uint8Array(got); - var sentReader = new Uint8Array(sent); - for (var i = 0; i < sent.byteLength; ++i) { - if (gotReader[i] !== sentReader[i]) { - testFailed(testName + ": buffers differ starting at byte " + i); - return false; - } - } - testPassed(testName + ": buffers have the same contents"); - return true; -} - -function viewCompare(testName, got, sent) { - if (!classCompare(testName, got, sent)) { - return false; - } - if (!bufferCompare(testName, got.buffer, sent.buffer)) { - return false; - } - if (got.byteOffset !== sent.byteOffset) { - testFailed(testName + ": offset " + sent.byteOffset + " became " + got.byteOffset); - return false; - } else { - testPassed(testName + ": offset is " + sent.byteOffset); - } - if (got.byteLength !== sent.byteLength) { - testFailed(testName + ": length " + sent.byteLength + " became " + got.byteLength); - return false; - } else { - testPassed(testName + ": length is " + sent.byteLength); - } - return true; -} - -function typedArrayCompare(testName, got, sent) { - if (!viewCompare(testName, got, sent)) { - return false; - } - if (got.BYTES_PER_ELEMENT !== sent.BYTES_PER_ELEMENT) { - // Sanity checking. - testFailed(testName + ": expected BYTES_PER_ELEMENT " + sent.BYTES_PER_ELEMENT + ", saw " + got.BYTES_PER_ELEMENT); - return false; - } - return true; -} - -function dataViewCompare(testName, got, sent) { - return viewCompare(testName, got, sent); -} - -function dataViewCompare2(testName, got, sent) { - for (var i = 0; i < 2; ++i) { - if (!dataViewCompare(testName, got[i], sent[i])) { - return false; - } - } - if (got[0].buffer !== got[1].buffer) { - testFailed(testName + ": expected the same ArrayBuffer for both views"); - return false; - } - return true; -} -function dataViewCompare3(testName, got, sent) { - for (var i = 0; i < 3; i += 2) { - if (!dataViewCompare(testName, got[i], sent[i])) { - return false; - } - } - if (got[1].x !== sent[1].x || got[1].y !== sent[1].y) { - testFailed(testName + ": {x:1, y:1} was not transferred properly"); - return false; - } - if (got[0].buffer !== got[2].buffer) { - testFailed(testName + ": expected the same ArrayBuffer for both views"); - return false; - } - return false; -} - - -function createBuffer(length) { - var buffer = new ArrayBuffer(length); - var view = new Uint8Array(buffer); - for (var i = 0; i < length; ++i) { - view[i] = i + 1; - } - return buffer; -} - -function createTypedArray(typedArrayType, length) { - var view = new typedArrayType(length); - for (var i = 0; i < length; ++i) { - view[i] = i + 1; - } - return view; -} - -function createTypedArrayOverBuffer(typedArrayType, typedArrayElementSize, length, subStart, subLength) { - var buffer = new ArrayBuffer(length * typedArrayElementSize); - if (subStart === undefined) { - subStart = 0; - subLength = length; - } - return new typedArrayType(buffer, subStart * typedArrayElementSize, subLength); -} - -var basicBufferTypes = [ - ["Int32", Int32Array, 4], - ["Uint32", Uint32Array, 4], - ["Int8", Int8Array, 1], - ["Uint8", Uint8Array, 1], - ["Uint8Clamped", Uint8ClampedArray, 1], - ["Int16", Int16Array, 2], - ["Uint16", Uint16Array, 2], - ["Float32", Float32Array, 4], - ["Float64", Float64Array, 8] -]; - -var arrayBuffer1 = createBuffer(1); - -var testList = [ - ['ArrayBuffer0', new ArrayBuffer(0), bufferCompare], - ['ArrayBuffer1', createBuffer(1), bufferCompare], - ['ArrayBuffer128', createBuffer(128), bufferCompare], - ['DataView0', new DataView(new ArrayBuffer(0)), dataViewCompare], - ['DataView1', new DataView(createBuffer(1)), dataViewCompare], - ['DataView1-dup', [new DataView(arrayBuffer1), new DataView(arrayBuffer1)], dataViewCompare2], - ['DataView1-dup2', [new DataView(arrayBuffer1), {x:1, y:1}, new DataView(arrayBuffer1)], dataViewCompare3], - ['DataView128', new DataView(createBuffer(128)), dataViewCompare], - ['DataView1_offset_at_end', new DataView(createBuffer(1), 1, 0), dataViewCompare], - ['DataView128_offset_at_end', new DataView(createBuffer(128), 128, 0), dataViewCompare], - ['DataView128_offset_slice_length_0', new DataView(createBuffer(128), 64, 0), dataViewCompare], - ['DataView128_offset_slice_length_1', new DataView(createBuffer(128), 64, 1), dataViewCompare], - ['DataView128_offset_slice_length_16', new DataView(createBuffer(128), 64, 16), dataViewCompare], - ['DataView128_offset_slice_unaligned', new DataView(createBuffer(128), 63, 15), dataViewCompare] -]; - -testList = testList.concat(basicBufferTypes.map(function(t) - {return [t[0] + "_0", createTypedArray(t[1], 0), typedArrayCompare];})); -testList = testList.concat(basicBufferTypes.map(function(t) - {return [t[0] + "_1", createTypedArray(t[1], 1), typedArrayCompare];})); -testList = testList.concat(basicBufferTypes.map(function(t) - {return [t[0] + "_128", createTypedArray(t[1], 128), typedArrayCompare];})); -testList = testList.concat(basicBufferTypes.map(function(t) - {return [t[0] + "_0_buffer", createTypedArrayOverBuffer(t[1], t[2], 0), typedArrayCompare];})); -testList = testList.concat(basicBufferTypes.map(function(t) - {return [t[0] + "_1_buffer", createTypedArrayOverBuffer(t[1], t[2], 1), typedArrayCompare];})); -testList = testList.concat(basicBufferTypes.map(function(t) - {return [t[0] + "_128_buffer", createTypedArrayOverBuffer(t[1], t[2], 128), typedArrayCompare];})); -testList = testList.concat(basicBufferTypes.map(function(t) - {return [t[0] + "_1_buffer_offset_at_end", createTypedArrayOverBuffer(t[1], t[2], 1, 1, 0), typedArrayCompare];})); -testList = testList.concat(basicBufferTypes.map(function(t) - {return [t[0] + "_128_buffer_offset_at_end", createTypedArrayOverBuffer(t[1], t[2], 128, 128, 0), typedArrayCompare];})); -testList = testList.concat(basicBufferTypes.map(function(t) - {return [t[0] + "_128_buffer_offset_slice_length_0", createTypedArrayOverBuffer(t[1], t[2], 128, 64, 0), typedArrayCompare];})); -testList = testList.concat(basicBufferTypes.map(function(t) - {return [t[0] + "_128_buffer_offset_slice_length_1", createTypedArrayOverBuffer(t[1], t[2], 128, 64, 1), typedArrayCompare];})); -testList = testList.concat(basicBufferTypes.map(function(t) - {return [t[0] + "_128_buffer_offset_slice_length_16", createTypedArrayOverBuffer(t[1], t[2], 128, 64, 16), typedArrayCompare];})); - -function doneTest() { - if (++window.testsComplete == testList.length) { - } -} - -function windowHandleMessage(e) { - var currentTest = testList[e.data.testNum]; - var expectedResult = currentTest[1]; - try { - currentTest[2](currentTest[0], e.data.testData, expectedResult); - } catch(e) { - testFailed(currentTest[0] + ": unexpected exception " + e); - } - doneTest(); -} -window.addEventListener('message', windowHandleMessage); - -for (var t = 0; t < testList.length; ++t) { - var currentTest = testList[t]; - var message = {testNum: t, testData: currentTest[1]}; - window.postMessage(message, '*'); -} - -window._handleEvents(); diff --git a/implementation-contributed/javascriptcore/stress/array-push-with-force-exit.js b/implementation-contributed/javascriptcore/stress/array-push-with-force-exit.js deleted file mode 100644 index 3cec3fc7c5..0000000000 --- a/implementation-contributed/javascriptcore/stress/array-push-with-force-exit.js +++ /dev/null @@ -1,12 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -var target = createBuiltin(`(function (array) -{ - if (array) { - @idWithProfile(array, "SpecOther").push(42); - } - return array; -})`); -noInline(target); -for (var i = 0; i < 1e5; ++i) - target([42]); diff --git a/implementation-contributed/javascriptcore/stress/arrayprofile-should-not-convert-get-by-val-cow.js b/implementation-contributed/javascriptcore/stress/arrayprofile-should-not-convert-get-by-val-cow.js deleted file mode 100644 index bc59059f35..0000000000 --- a/implementation-contributed/javascriptcore/stress/arrayprofile-should-not-convert-get-by-val-cow.js +++ /dev/null @@ -1,57 +0,0 @@ -function assertEq(a, b) { - if (a !== b) - throw new Error("values not the same: " + a + " and " + b); -} - -function withArrayArgInt32(i, array) { - let result = array[i]; - assertEq($vm.indexingMode(array), "CopyOnWriteArrayWithInt32"); -} -noInline(withArrayArgInt32); - -function withArrayLiteralInt32(i) { - let array = [0,1,2]; - let result = array[i]; - assertEq($vm.indexingMode(array), "CopyOnWriteArrayWithInt32"); -} -noInline(withArrayLiteralInt32); - - -function withArrayArgDouble(i, array) { - let result = array[i]; - assertEq($vm.indexingMode(array), "CopyOnWriteArrayWithDouble"); -} -noInline(withArrayArgDouble); - -function withArrayLiteralDouble(i) { - let array = [0,1.3145,2]; - let result = array[i]; - assertEq($vm.indexingMode(array), "CopyOnWriteArrayWithDouble"); -} -noInline(withArrayLiteralDouble); - -function withArrayArgContiguous(i, array) { - let result = array[i]; - assertEq($vm.indexingMode(array), "CopyOnWriteArrayWithContiguous"); -} -noInline(withArrayArgContiguous); - -function withArrayLiteralContiguous(i) { - let array = [0,"string",2]; - let result = array[i]; - assertEq($vm.indexingMode(array), "CopyOnWriteArrayWithContiguous"); -} -noInline(withArrayLiteralContiguous); - -function test() { - withArrayArgInt32(0, [0,1,2]); - withArrayArgDouble(0, [0,1.3145,2]); - withArrayArgContiguous(0, [0,"string",2]); - - withArrayLiteralInt32(0); - withArrayLiteralDouble(0); - withArrayLiteralContiguous(0); -} - -for (let i = 0; i < 10000; i++) - test(); diff --git a/implementation-contributed/javascriptcore/stress/check-dom-with-signature.js b/implementation-contributed/javascriptcore/stress/check-dom-with-signature.js deleted file mode 100644 index 26dac7a3ba..0000000000 --- a/implementation-contributed/javascriptcore/stress/check-dom-with-signature.js +++ /dev/null @@ -1,22 +0,0 @@ -var createDOMJITFunctionObject = $vm.createDOMJITFunctionObject; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var array = []; -for (var i = 0; i < 100; ++i) - array.push(createDOMJITFunctionObject()); - -function calling(dom) -{ - return dom.func(); -} -noInline(calling); - -for (var i = 0; i < 1e3; ++i) { - array.forEach((obj) => { - shouldBe(calling(obj), 42); - }); -} diff --git a/implementation-contributed/javascriptcore/stress/check-sub-class.js b/implementation-contributed/javascriptcore/stress/check-sub-class.js deleted file mode 100644 index 4b4b1d466c..0000000000 --- a/implementation-contributed/javascriptcore/stress/check-sub-class.js +++ /dev/null @@ -1,54 +0,0 @@ -var createDOMJITNodeObject = $vm.createDOMJITNodeObject; -var createDOMJITCheckSubClassObject = $vm.createDOMJITCheckSubClassObject; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -function shouldThrow(func, errorMessage) { - var errorThrown = false; - var error = null; - try { - func(); - } catch (e) { - errorThrown = true; - error = e; - } - if (!errorThrown) - throw new Error('not thrown'); - if (String(error) !== errorMessage) - throw new Error(`bad error: ${String(error)}`); -} - -var array = []; -for (var i = 0; i < 100; ++i) - array.push(createDOMJITCheckSubClassObject()); - -// DOMJITNode is an instance of a super class (DOMJITNode) of DOMJITCheckSubClassObject. -var node = createDOMJITNodeObject(); -node.func = createDOMJITCheckSubClassObject().func; - -function calling(dom) -{ - return dom.func(); -} -noInline(calling); - -array.forEach((obj) => { - shouldBe(calling(obj), 42); -}); - -shouldThrow(() => { - calling(node); -}, `TypeError: Type error`); - -for (var i = 0; i < 1e3; ++i) { - array.forEach((obj) => { - shouldBe(calling(obj), 42); - }); -} - -shouldThrow(() => { - calling(node); -}, `TypeError: Type error`); diff --git a/implementation-contributed/javascriptcore/stress/compare-eq-incomplete-profile.js b/implementation-contributed/javascriptcore/stress/compare-eq-incomplete-profile.js deleted file mode 100644 index 48442da8ca..0000000000 --- a/implementation-contributed/javascriptcore/stress/compare-eq-incomplete-profile.js +++ /dev/null @@ -1,12 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -const test = createBuiltin(`(function (arg) { - let other = @undefined; - @idWithProfile(other, "SpecObject"); - return arg == other; -})`); - -for (let i = 0; i < 10000; i++) { - test({}); - test(null); -} diff --git a/implementation-contributed/javascriptcore/stress/custom-get-set-inline-caching-one-level-up-proto-chain.js b/implementation-contributed/javascriptcore/stress/custom-get-set-inline-caching-one-level-up-proto-chain.js deleted file mode 100644 index 11283a289a..0000000000 --- a/implementation-contributed/javascriptcore/stress/custom-get-set-inline-caching-one-level-up-proto-chain.js +++ /dev/null @@ -1,69 +0,0 @@ -var createCustomTestGetterSetter = $vm.createCustomTestGetterSetter; - -function assert(b, m) { - if (!b) - throw new Error("Bad:" + m); -} - -class Class { }; - -let items = [ - new Class, - new Class, - new Class, - new Class, -]; - -let customGetterSetter = createCustomTestGetterSetter(); -items.forEach((x) => { - x.__proto__ = customGetterSetter; - assert(x.__proto__ === customGetterSetter); -}); - -function validate(x, valueResult, accessorResult) { - assert(x.customValue === valueResult); - - assert(x.customAccessor === accessorResult); - - let o = {}; - x.customValue = o; - assert(o.result === valueResult); - - o = {}; - x.customAccessor = o; - assert(o.result === accessorResult); - - assert(x.randomProp === 42 || x.randomProp === undefined); -} -noInline(validate); - - -let start = Date.now(); -for (let i = 0; i < 10000; ++i) { - for (let i = 0; i < items.length; ++i) { - validate(items[i], customGetterSetter, items[i]); - } -} - -customGetterSetter.randomProp = 42; - -for (let i = 0; i < 10000; ++i) { - for (let i = 0; i < items.length; ++i) { - validate(items[i], customGetterSetter, items[i]); - } -} - -items.forEach((x) => { - Reflect.setPrototypeOf(x, { - get customValue() { return 42; }, - get customAccessor() { return 22; }, - set customValue(x) { x.result = 42; }, - set customAccessor(x) { x.result = 22; }, - }); -}); - -for (let i = 0; i < 10000; ++i) { - for (let i = 0; i < items.length; ++i) { - validate(items[i], 42, 22); - } -} diff --git a/implementation-contributed/javascriptcore/stress/dead-fiat-value-to-int52-then-exit-not-double.js b/implementation-contributed/javascriptcore/stress/dead-fiat-value-to-int52-then-exit-not-double.js deleted file mode 100644 index c737a43c0a..0000000000 --- a/implementation-contributed/javascriptcore/stress/dead-fiat-value-to-int52-then-exit-not-double.js +++ /dev/null @@ -1,21 +0,0 @@ -function foo() { - var value = bar($vm.dfgTrue()); - fiatInt52(value); - fiatInt52(value); -} - -var thingy = false; -function bar(p) { - if (thingy) - return "hello"; - return p ? 42 : 5.5; -} - -noInline(foo); -noInline(bar); - -for (var i = 0; i < 1000000; ++i) - foo(); - -thingy = true; -foo(); diff --git a/implementation-contributed/javascriptcore/stress/dead-fiat-value-to-int52-then-exit-not-int52.js b/implementation-contributed/javascriptcore/stress/dead-fiat-value-to-int52-then-exit-not-int52.js deleted file mode 100644 index 4d29e7f629..0000000000 --- a/implementation-contributed/javascriptcore/stress/dead-fiat-value-to-int52-then-exit-not-int52.js +++ /dev/null @@ -1,21 +0,0 @@ -function foo() { - var value = bar($vm.dfgTrue()); - fiatInt52(value); - fiatInt52(value); -} - -var thingy = false; -function bar(p) { - if (thingy) - return 5.5; - return p ? 42 : 5.5; -} - -noInline(foo); -noInline(bar); - -for (var i = 0; i < 1000000; ++i) - foo(); - -thingy = true; -foo(); diff --git a/implementation-contributed/javascriptcore/stress/dead-fiat-value-to-int52.js b/implementation-contributed/javascriptcore/stress/dead-fiat-value-to-int52.js deleted file mode 100644 index fbde20195a..0000000000 --- a/implementation-contributed/javascriptcore/stress/dead-fiat-value-to-int52.js +++ /dev/null @@ -1,16 +0,0 @@ -function foo() { - var value = bar($vm.dfgTrue()); - fiatInt52(value); - fiatInt52(value); -} - -function bar(p) { - return p ? 42 : 5.5; -} - -noInline(foo); -noInline(bar); - -for (var i = 0; i < 1000000; ++i) - foo(); - diff --git a/implementation-contributed/javascriptcore/stress/dead-osr-entry-value.js b/implementation-contributed/javascriptcore/stress/dead-osr-entry-value.js deleted file mode 100644 index db6639cb22..0000000000 --- a/implementation-contributed/javascriptcore/stress/dead-osr-entry-value.js +++ /dev/null @@ -1,16 +0,0 @@ -function foo() { - var o = {f:42}; - var result = 0; - OSRExit(); - for (var i = 0; i < 10000; ++i) { - if (!$vm.dfgTrue()) - result += o.f; - } - return result; -} - -for (var i = 0; i < 1000; ++i) { - foo(); - fullGC(); -} - diff --git a/implementation-contributed/javascriptcore/stress/do-eval-virtual-call-correctly.js b/implementation-contributed/javascriptcore/stress/do-eval-virtual-call-correctly.js deleted file mode 100644 index ecc12fb42c..0000000000 --- a/implementation-contributed/javascriptcore/stress/do-eval-virtual-call-correctly.js +++ /dev/null @@ -1,29 +0,0 @@ -var abort = $vm.abort; - -function assert(b) { - if (!b) { - abort(); - } -} -noInline(assert); - -let test; - -function f(eval) { - assert(eval === test); - eval(0x0); - f(test); -} - -for (let i = 0; i < 20; ++i) { - test = function test() { return i; } -} - -let error; -try { - f(test); -} catch(e) { - error = e; -} -assert(!!error); -assert(error instanceof RangeError); diff --git a/implementation-contributed/javascriptcore/stress/dom-jit-with-poly-proto.js b/implementation-contributed/javascriptcore/stress/dom-jit-with-poly-proto.js deleted file mode 100644 index b8ee62f0c6..0000000000 --- a/implementation-contributed/javascriptcore/stress/dom-jit-with-poly-proto.js +++ /dev/null @@ -1,41 +0,0 @@ -var createDOMJITGetterBaseJSObject = $vm.createDOMJITGetterBaseJSObject; - -function assert(b, m) { - if (!b) - throw new Error("Bad:" + m); -} - -function makePolyProtoObject() { - function foo() { - class C { - constructor() { - this._field = 25; - } - }; - return new C; - } - for (let i = 0; i < 15; ++i) - foo(); - return foo(); -} - -let proto = createDOMJITGetterBaseJSObject(); -let obj = makePolyProtoObject(); -obj.__proto__ = proto; - -function validate(x, v) { - assert(x.customGetter === v, x.customGetter); -} -noInline(validate); - -for (let i = 0; i < 1000; ++i) - validate(obj, proto); - -proto.foo = 25; -for (let i = 0; i < 1000; ++i) - validate(obj, proto); - -Reflect.setPrototypeOf(obj, {}); -for (let i = 0; i < 1000; ++i) { - validate(obj, undefined); -} diff --git a/implementation-contributed/javascriptcore/stress/domjit-exception-ic.js b/implementation-contributed/javascriptcore/stress/domjit-exception-ic.js deleted file mode 100644 index 9022bd36b0..0000000000 --- a/implementation-contributed/javascriptcore/stress/domjit-exception-ic.js +++ /dev/null @@ -1,39 +0,0 @@ -var createDOMJITGetterComplexObject = $vm.createDOMJITGetterComplexObject; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error(`bad value: ${String(actual)}`); -} - -function shouldThrow(func, errorMessage) { - var errorThrown = false; - var error = null; - try { - func(); - } catch (e) { - errorThrown = true; - error = e; - } - if (!errorThrown) - throw new Error('not thrown'); - if (String(error) !== errorMessage) - throw new Error(`bad error: ${String(error)}`); -} - -(function () { - let domjit = createDOMJITGetterComplexObject(); - function access(object) - { - return object.customGetter; - } - noInline(access); - let normal = { - customGetter: 42 - }; - for (let i = 0; i < 1e4; ++i) { - shouldBe(access(domjit), 42); - shouldBe(access(normal), 42); - } - domjit.enableException(); - shouldThrow(() => access(domjit), `Error: DOMJITGetterComplex slow call exception`); -}()); diff --git a/implementation-contributed/javascriptcore/stress/domjit-exception.js b/implementation-contributed/javascriptcore/stress/domjit-exception.js deleted file mode 100644 index 93f61c832c..0000000000 --- a/implementation-contributed/javascriptcore/stress/domjit-exception.js +++ /dev/null @@ -1,69 +0,0 @@ -var createDOMJITGetterComplexObject = $vm.createDOMJITGetterComplexObject; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error(`bad value: ${String(actual)}`); -} - -function shouldThrow(func, errorMessage) { - var errorThrown = false; - var error = null; - try { - func(); - } catch (e) { - errorThrown = true; - error = e; - } - if (!errorThrown) - throw new Error('not thrown'); - if (String(error) !== errorMessage) - throw new Error(`bad error: ${String(error)}`); -} -(function () { - let domjit = createDOMJITGetterComplexObject(); - function access(object) - { - return object.customGetter; - } - noInline(access); - for (var i = 0; i < 1e4; ++i) - shouldBe(access(domjit), 42); - domjit.enableException(); - shouldThrow(() => access(domjit), `Error: DOMJITGetterComplex slow call exception`); -}()); -(function () { - let domjit = createDOMJITGetterComplexObject(); - function access(object) - { - return object.customGetter; - } - noInline(access); - for (let i = 0; i < 1e2; ++i) - shouldBe(access(domjit), 42); - domjit.enableException(); - shouldThrow(() => access(domjit), `Error: DOMJITGetterComplex slow call exception`); -}()); -(function () { - let domjit = createDOMJITGetterComplexObject(); - function access(object) - { - return object.customGetter; - } - noInline(access); - for (let i = 0; i < 50; ++i) - shouldBe(access(domjit), 42); - domjit.enableException(); - shouldThrow(() => access(domjit), `Error: DOMJITGetterComplex slow call exception`); -}()); -(function () { - let domjit = createDOMJITGetterComplexObject(); - function access(object) - { - return object.customGetter; - } - noInline(access); - for (let i = 0; i < 10; ++i) - shouldBe(access(domjit), 42); - domjit.enableException(); - shouldThrow(() => access(domjit), `Error: DOMJITGetterComplex slow call exception`); -}()); diff --git a/implementation-contributed/javascriptcore/stress/domjit-getter-complex-with-incorrect-object.js b/implementation-contributed/javascriptcore/stress/domjit-getter-complex-with-incorrect-object.js deleted file mode 100644 index 17789356a1..0000000000 --- a/implementation-contributed/javascriptcore/stress/domjit-getter-complex-with-incorrect-object.js +++ /dev/null @@ -1,30 +0,0 @@ -var createDOMJITGetterComplexObject = $vm.createDOMJITGetterComplexObject; - -function shouldThrow(func, errorMessage) { - var errorThrown = false; - var error = null; - try { - func(); - } catch (e) { - errorThrown = true; - error = e; - } - if (!errorThrown) - throw new Error('not thrown'); - if (String(error) !== errorMessage) - throw new Error(`bad error: ${String(error)}`); -} - -var complex = createDOMJITGetterComplexObject(); -var object = {}; -object.__proto__ = complex; -function access(object) -{ - return object.customGetter; -} -noInline(access); -for (var i = 0; i < 1e4; ++i) { - shouldThrow(() => { - access(object); - }, `TypeError: The DOMJITGetterComplex.customGetter getter can only be used on instances of DOMJITGetterComplex`); -} diff --git a/implementation-contributed/javascriptcore/stress/domjit-getter-complex.js b/implementation-contributed/javascriptcore/stress/domjit-getter-complex.js deleted file mode 100644 index 7e28aa2a32..0000000000 --- a/implementation-contributed/javascriptcore/stress/domjit-getter-complex.js +++ /dev/null @@ -1,16 +0,0 @@ -var createDOMJITGetterComplexObject = $vm.createDOMJITGetterComplexObject; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error(`bad value: ${String(actual)}`); -} - -var complex = createDOMJITGetterComplexObject(); -function access(complex) -{ - return complex.customGetter; -} -noInline(access); -for (var i = 0; i < 1e4; ++i) { - shouldBe(access(complex), 42); -} diff --git a/implementation-contributed/javascriptcore/stress/domjit-getter-poly.js b/implementation-contributed/javascriptcore/stress/domjit-getter-poly.js deleted file mode 100644 index f7d4785e46..0000000000 --- a/implementation-contributed/javascriptcore/stress/domjit-getter-poly.js +++ /dev/null @@ -1,21 +0,0 @@ -var createDOMJITGetterObject = $vm.createDOMJITGetterObject; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error(`bad value: ${String(actual)}`); -} - -var domjit1 = createDOMJITGetterObject(); -var domjit2 = createDOMJITGetterObject(); - -function access(domjit) -{ - return domjit.customGetter + domjit.customGetter; -} - -for (var i = 0; i < 1e4; ++i) - shouldBe(access((i & 0x1) ? domjit1 : domjit2), 84); - -shouldBe(access({ customGetter: 42 }), 84); -domjit1.test = 44; -shouldBe(access(domjit1), 84); diff --git a/implementation-contributed/javascriptcore/stress/domjit-getter-proto.js b/implementation-contributed/javascriptcore/stress/domjit-getter-proto.js deleted file mode 100644 index cda0cc100f..0000000000 --- a/implementation-contributed/javascriptcore/stress/domjit-getter-proto.js +++ /dev/null @@ -1,19 +0,0 @@ -var createDOMJITNodeObject = $vm.createDOMJITNodeObject; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error(`bad value: ${String(actual)}`); -} - -var domjit = createDOMJITNodeObject(); -function access(domjit) -{ - return domjit.customGetter + domjit.customGetter; -} - -for (var i = 0; i < 1e4; ++i) - shouldBe(access(domjit), 84); - -shouldBe(access({ customGetter: 42 }), 84); -domjit.test = 44; -shouldBe(access(domjit), 84); diff --git a/implementation-contributed/javascriptcore/stress/domjit-getter-super-poly.js b/implementation-contributed/javascriptcore/stress/domjit-getter-super-poly.js deleted file mode 100644 index b6f21ddbfb..0000000000 --- a/implementation-contributed/javascriptcore/stress/domjit-getter-super-poly.js +++ /dev/null @@ -1,20 +0,0 @@ -var createDOMJITGetterObject = $vm.createDOMJITGetterObject; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error(`bad value: ${String(actual)}`); -} - -var domjits = []; -for (var i = 0; i < 100; ++i) - domjits.push(createDOMJITGetterObject()); - -function access(domjit) -{ - return domjit.customGetter + domjit.customGetter; -} - -for (var i = 0; i < 1e2; ++i) { - for (var j = 0; j < domjits.length; ++j) - shouldBe(access(domjits[j]), 84); -} diff --git a/implementation-contributed/javascriptcore/stress/domjit-getter-try-catch-getter-as-get-by-id-register-restoration.js b/implementation-contributed/javascriptcore/stress/domjit-getter-try-catch-getter-as-get-by-id-register-restoration.js deleted file mode 100644 index b6ec24d0b4..0000000000 --- a/implementation-contributed/javascriptcore/stress/domjit-getter-try-catch-getter-as-get-by-id-register-restoration.js +++ /dev/null @@ -1,54 +0,0 @@ -var createDOMJITGetterComplexObject = $vm.createDOMJITGetterComplexObject; - -function assert(b) { - if (!b) throw new Error("bad value"); -} -noInline(assert); - -let i; -var o1 = createDOMJITGetterComplexObject(); -o1.x = "x"; - -var o2 = { - customGetter: 40 -} - -var o3 = { - x: 100, - customGetter: "f" -} - -function bar(i) { - if (i === -1000) - return o1; - - if (i % 2) - return o3; - else - return o2; -} -noInline(bar); - -function foo(i) { - var o = bar(i); - let v; - let v2; - let v3; - try { - v2 = o.x; - v = o.customGetter + v2; - } catch(e) { - assert(v2 === "x"); - assert(o === o1); - } -} -noInline(foo); - -foo(i); -for (i = 0; i < 1000; i++) - foo(i); - -o1.enableException(); -i = -1000; -for (let j = 0; j < 1000; j++) - foo(i); diff --git a/implementation-contributed/javascriptcore/stress/domjit-getter-type-check.js b/implementation-contributed/javascriptcore/stress/domjit-getter-type-check.js deleted file mode 100644 index e060a92c9a..0000000000 --- a/implementation-contributed/javascriptcore/stress/domjit-getter-type-check.js +++ /dev/null @@ -1,28 +0,0 @@ -var createDOMJITGetterObject = $vm.createDOMJITGetterObject; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error(`bad value: ${String(actual)}`); -} - -function shouldThrow(func, errorMessage) { - var errorThrown = false; - var error = null; - try { - func(); - } catch (e) { - errorThrown = true; - error = e; - } - if (!errorThrown) - throw new Error('not thrown'); - if (String(error) !== errorMessage) - throw new Error(`bad error: ${String(error)}`); -} - -var domjit = createDOMJITGetterObject(); -for (var i = 0; i < 1e3; ++i) { - shouldThrow(() => { - Reflect.get(domjit, 'customGetter', { customGetter: 42 }); - }, `TypeError: The DOMJITNode.customGetter getter can only be used on instances of DOMJITNode`); -} diff --git a/implementation-contributed/javascriptcore/stress/domjit-getter.js b/implementation-contributed/javascriptcore/stress/domjit-getter.js deleted file mode 100644 index 7da39075a2..0000000000 --- a/implementation-contributed/javascriptcore/stress/domjit-getter.js +++ /dev/null @@ -1,20 +0,0 @@ -var createDOMJITGetterObject = $vm.createDOMJITGetterObject; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error(`bad value: ${String(actual)}`); -} - -var domjit = createDOMJITGetterObject(); - -function access(domjit) -{ - return domjit.customGetter + domjit.customGetter; -} - -for (var i = 0; i < 1e4; ++i) - shouldBe(access(domjit), 84); - -shouldBe(access({ customGetter: 42 }), 84); -domjit.test = 44; -shouldBe(access(domjit), 84); diff --git a/implementation-contributed/javascriptcore/stress/exit-during-inlined-arity-fixup-recover-proper-frame.js b/implementation-contributed/javascriptcore/stress/exit-during-inlined-arity-fixup-recover-proper-frame.js deleted file mode 100644 index 7bcbc554ed..0000000000 --- a/implementation-contributed/javascriptcore/stress/exit-during-inlined-arity-fixup-recover-proper-frame.js +++ /dev/null @@ -1,33 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -let i; -function verify(a, b, c, d, e, f) { - function assert(b, m) { - if (!b) - throw new Error(m); - } - assert(a === i); - assert(b === i+1); - assert(c === i+2); - assert(d === null); - assert(e === undefined); - assert(f === undefined); -} -noInline(verify); - -function func(a, b, c, d, e, f) -{ - verify(a, b, c, d, e, f); - return !!(a%2) ? a + b + c + d : a + b + c + d; -} - -const bar = createBuiltin(`(function (f, a, b, c, d) { - let y = @idWithProfile(null, "SpecInt32Only"); - return f(a, b, c, y); -})`); - -noInline(bar); - -for (i = 0; i < 1000; ++i) { - bar(func, i, i+1, i+2, i+3); -} diff --git a/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-exit-not-double.js b/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-exit-not-double.js deleted file mode 100644 index a20a5f8b06..0000000000 --- a/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-exit-not-double.js +++ /dev/null @@ -1,24 +0,0 @@ -function foo() { - return fiatInt52(bar($vm.dfgTrue())) + 1; -} - -var thingy = false; -function bar(p) { - if (thingy) - return "hello"; - return p ? 42 : 5.5; -} - -noInline(foo); -noInline(bar); - -for (var i = 0; i < 1000000; ++i) { - var result = foo(); - if (result != 43 && result != 6.5) - throw "Error: bad result: " + result; -} - -thingy = true; -var result = foo(); -if (result != "hello1") - throw "Error: bad result at end: " + result; diff --git a/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-exit-not-int52.js b/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-exit-not-int52.js deleted file mode 100644 index e477a10b3b..0000000000 --- a/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-exit-not-int52.js +++ /dev/null @@ -1,24 +0,0 @@ -function foo() { - return fiatInt52(bar($vm.dfgTrue())) + 1; -} - -var thingy = false; -function bar(p) { - if (thingy) - return 5.5; - return p ? 42 : 5.5; -} - -noInline(foo); -noInline(bar); - -for (var i = 0; i < 1000000; ++i) { - var result = foo(); - if (result != 43 && result != 6.5) - throw "Error: bad result: " + result; -} - -thingy = true; -var result = foo(); -if (result != 6.5) - throw "Error: bad result at end: " + result; diff --git a/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-fail-to-fold.js b/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-fail-to-fold.js deleted file mode 100644 index fde0a28a79..0000000000 --- a/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-fail-to-fold.js +++ /dev/null @@ -1,11 +0,0 @@ -function foo() { - return fiatInt52($vm.dfgTrue() ? 5.5 : 42) + 1; -} - -noInline(foo); - -for (var i = 0; i < 1000000; ++i) { - var result = foo(); - if (result != 43 && result != 6.5) - throw "Error: bad result: " + result; -} diff --git a/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-fold.js b/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-fold.js deleted file mode 100644 index 380240c75b..0000000000 --- a/implementation-contributed/javascriptcore/stress/fiat-value-to-int52-then-fold.js +++ /dev/null @@ -1,11 +0,0 @@ -function foo() { - return fiatInt52($vm.dfgTrue() ? 42 : 5.5) + 1; -} - -noInline(foo); - -for (var i = 0; i < 1000000; ++i) { - var result = foo(); - if (result != 43 && result != 6.5) - throw "Error: bad result: " + result; -} diff --git a/implementation-contributed/javascriptcore/stress/fiat-value-to-int52.js b/implementation-contributed/javascriptcore/stress/fiat-value-to-int52.js deleted file mode 100644 index 9833582d3e..0000000000 --- a/implementation-contributed/javascriptcore/stress/fiat-value-to-int52.js +++ /dev/null @@ -1,16 +0,0 @@ -function foo() { - return fiatInt52(bar($vm.dfgTrue())) + 1; -} - -function bar(p) { - return p ? 42 : 5.5; -} - -noInline(foo); -noInline(bar); - -for (var i = 0; i < 1000000; ++i) { - var result = foo(); - if (result != 43 && result != 6.5) - throw "Error: bad result: " + result; -} diff --git a/implementation-contributed/javascriptcore/stress/flatten-object-zero-unused-inline-properties.js b/implementation-contributed/javascriptcore/stress/flatten-object-zero-unused-inline-properties.js deleted file mode 100644 index 6fe5a14c49..0000000000 --- a/implementation-contributed/javascriptcore/stress/flatten-object-zero-unused-inline-properties.js +++ /dev/null @@ -1,7 +0,0 @@ -let o = { foo: 1, bar: 2, baz: 3 }; -if ($vm.inlineCapacity(o) <= 3) - throw new Error("There should be inline capacity"); - -delete o.foo; -$vm.flattenDictionaryObject(o); -o.foo = 1; diff --git a/implementation-contributed/javascriptcore/stress/fold-based-on-int32-proof-mul-branch.js b/implementation-contributed/javascriptcore/stress/fold-based-on-int32-proof-mul-branch.js deleted file mode 100644 index a9c6f01886..0000000000 --- a/implementation-contributed/javascriptcore/stress/fold-based-on-int32-proof-mul-branch.js +++ /dev/null @@ -1,17 +0,0 @@ -function foo(a, b) { - var value = $vm.dfgTrue() ? -0 : "foo"; - if (a * b == value) - return [$vm.dfgTrue(), true]; - return [$vm.dfgTrue(), false]; -} -noInline(foo); - -for (var i = 0; i < 10000; ++i) { - var result = foo(1, 1); - if (result[1] !== false) - throw "Error: bad result: " + result; -} - -var result = foo(-1, 0); -if (result[1] !== true && result[0]) - throw "Error: bad result at end: " + result; diff --git a/implementation-contributed/javascriptcore/stress/fold-profiled-call-to-call.js b/implementation-contributed/javascriptcore/stress/fold-profiled-call-to-call.js deleted file mode 100644 index 0ca898e318..0000000000 --- a/implementation-contributed/javascriptcore/stress/fold-profiled-call-to-call.js +++ /dev/null @@ -1,24 +0,0 @@ -function foo(f) { - if ($vm.dfgTrue()) - f = bar; - return f().f; -} - -noInline(foo); - -var object; -function bar() { - return object; -} - -function baz() { return {f:42}; }; - -object = {f:42}; -for (var i = 0; i < 1000; ++i) - foo((i & 1) ? bar : baz); - -object = {e:1, f:2}; -var result = foo(bar); -if (result != 2) - throw "Error: bad result: " + result; - diff --git a/implementation-contributed/javascriptcore/stress/fold-to-double-constant-then-exit.js b/implementation-contributed/javascriptcore/stress/fold-to-double-constant-then-exit.js deleted file mode 100644 index 8fa2327153..0000000000 --- a/implementation-contributed/javascriptcore/stress/fold-to-double-constant-then-exit.js +++ /dev/null @@ -1,17 +0,0 @@ -function foo(a, b) { - if ($vm.dfgTrue()) - a = b = 5.4; - var c = a + b; - if (isFinalTier()) - OSRExit(); - return c + 0.5; -} - -noInline(foo); - -for (var i = 0; i < 100000; ++i) { - var result = foo(1.4, 1.3); - if (result != 1.4 + 1.3 + 0.5 && result != 5.4 + 5.4 + 0.5) - throw "Error: bad result: " + result; -} - diff --git a/implementation-contributed/javascriptcore/stress/fold-to-int52-constant-then-exit.js b/implementation-contributed/javascriptcore/stress/fold-to-int52-constant-then-exit.js deleted file mode 100644 index e3b4753766..0000000000 --- a/implementation-contributed/javascriptcore/stress/fold-to-int52-constant-then-exit.js +++ /dev/null @@ -1,17 +0,0 @@ -function foo(a, b) { - if ($vm.dfgTrue()) - a = b = 2000000000; - var c = a + b; - if (isFinalTier()) - OSRExit(); - return c + 42; -} - -noInline(foo); - -for (var i = 0; i < 100000; ++i) { - var result = foo(2000000001, 2000000001); - if (result != 2000000001 + 2000000001 + 42 && result != 2000000000 + 2000000000 + 42) - throw "Error: bad result: " + result; -} - diff --git a/implementation-contributed/javascriptcore/stress/fold-to-primitive-in-cfa.js b/implementation-contributed/javascriptcore/stress/fold-to-primitive-in-cfa.js deleted file mode 100644 index 899a171203..0000000000 --- a/implementation-contributed/javascriptcore/stress/fold-to-primitive-in-cfa.js +++ /dev/null @@ -1,14 +0,0 @@ -function foo(x) { - if ($vm.dfgTrue()) - x = "hello"; - return x + " world"; -} - -noInline(foo); - -for (var i = 0; i < 100000; ++i) { - var result = foo({toString:function() { return "foo" }}); - if (result != "foo world" && result != "hello world") - throw "Error: bad result: " + result; -} - diff --git a/implementation-contributed/javascriptcore/stress/fold-to-primitive-to-identity-in-cfa.js b/implementation-contributed/javascriptcore/stress/fold-to-primitive-to-identity-in-cfa.js deleted file mode 100644 index 277488ca97..0000000000 --- a/implementation-contributed/javascriptcore/stress/fold-to-primitive-to-identity-in-cfa.js +++ /dev/null @@ -1,14 +0,0 @@ -function foo(x, p) { - if ($vm.dfgTrue()) - x = p ? "hello" : "bar"; - return x + " world"; -} - -noInline(foo); - -for (var i = 0; i < 100000; ++i) { - var result = foo({toString:function() { return "foo" }}, i & 1); - if (result != "foo world" && result != "hello world" && result != "bar world") - throw "Error: bad result: " + result; -} - diff --git a/implementation-contributed/javascriptcore/stress/for-in-proxy-target-changed-structure.js b/implementation-contributed/javascriptcore/stress/for-in-proxy-target-changed-structure.js deleted file mode 100644 index 332755334a..0000000000 --- a/implementation-contributed/javascriptcore/stress/for-in-proxy-target-changed-structure.js +++ /dev/null @@ -1,34 +0,0 @@ -var createProxy = $vm.createProxy; - -var theO; - -function deleteAll() { - delete theO.a; - delete theO.b; - delete theO.c; - delete theO.d; - for (var i = 0; i < 10; ++i) - theO["i" + i] = 42; - theO.a = 11; - theO.b = 12; - theO.c = 13; - theO.d = 14; -} - -function foo(o_) { - var o = o_; - var result = 0; - for (var s in o) { - result += o[s]; - deleteAll(); - } - return result; -} - -noInline(foo); - -for (var i = 0; i < 10000; ++i) { - var result = foo(createProxy(theO = {a:1, b:2, c:3, d:4})); - if (result != 1 + 12 + 13 + 14) - throw "Error: bad result: " + result; -} diff --git a/implementation-contributed/javascriptcore/stress/for-in-proxy.js b/implementation-contributed/javascriptcore/stress/for-in-proxy.js deleted file mode 100644 index 81b5e27760..0000000000 --- a/implementation-contributed/javascriptcore/stress/for-in-proxy.js +++ /dev/null @@ -1,18 +0,0 @@ -var createProxy = $vm.createProxy; - -function foo(o_) { - var o = o_; - var result = 0; - for (var s in o) { - result += o[s]; - } - return result; -} - -noInline(foo); - -for (var i = 0; i < 10000; ++i) { - var result = foo(createProxy({a:1, b:2, c:3, d:4})); - if (result != 1 + 2 + 3 + 4) - throw "Error: bad result: " + result; -} diff --git a/implementation-contributed/javascriptcore/stress/generational-opaque-roots.js b/implementation-contributed/javascriptcore/stress/generational-opaque-roots.js deleted file mode 100644 index 0ea8874504..0000000000 --- a/implementation-contributed/javascriptcore/stress/generational-opaque-roots.js +++ /dev/null @@ -1,40 +0,0 @@ -// Tests that opaque roots behave correctly during young generation collections - -var Element = $vm.Element; -var Root = $vm.Root; -var getElement = $vm.getElement; - -try { - // regression test for bug 160773. This should not crash. - new (Element.bind()); -} catch(e) { -} - -// Create the primary Root. -var root = new Root(); -// This secondary root is for allocating a second Element without overriding -// the primary Root's Element. -var otherRoot = new Root(); - -// Run an Eden collection so that the Root will be in the old gen (and won't be rescanned). -edenGC(); - -// Create a new Element and set a custom property on it. -var elem = new Element(root); -elem.customProperty = "hello"; - -// Make the Element unreachable except through the ephemeron with the Root. -elem = null; - -// Create another Element so that we process the weak handles in block of the original Element. -var test = new Element(otherRoot); - -// Run another Eden collection to process the weak handles in the Element's block. If opaque roots -// are cleared then we'll think that the original Element is dead because the Root won't be in the -// set of opaque roots. -edenGC(); - -// Check if the primary Root's Element exists and has our custom property. -var elem = getElement(root); -if (elem.customProperty != "hello") - throw new Error("bad value of customProperty: " + elem.customProperty); diff --git a/implementation-contributed/javascriptcore/stress/get-by-id-direct-getter.js b/implementation-contributed/javascriptcore/stress/get-by-id-direct-getter.js deleted file mode 100644 index b11a570524..0000000000 --- a/implementation-contributed/javascriptcore/stress/get-by-id-direct-getter.js +++ /dev/null @@ -1,112 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -function shouldThrow(func, errorMessage) { - var errorThrown = false; - var error = null; - try { - func(); - } catch (e) { - errorThrown = true; - error = e; - } - if (!errorThrown) - throw new Error('not thrown'); - if (String(error) !== errorMessage) - throw new Error(`bad error: ${String(error)}`); -} - -(function () { - var builtin = createBuiltin(`(function (obj) { - return @getByIdDirect(obj, "hello"); - })`); - noInline(builtin); - - var obj = { get hello() { return 42; }, world:33 }; - for (var i = 0; i < 1e4; ++i) - shouldBe(builtin(obj), 42); - - var obj2 = { hello: 22 }; - for (var i = 0; i < 1e4; ++i) { - shouldBe(builtin(obj), 42); - shouldBe(builtin(obj2), 22); - } - - var obj3 = { }; - for (var i = 0; i < 1e4; ++i) - shouldBe(builtin(obj3), undefined); - - var obj4 = { - __proto__: { hello: 33 } - }; - for (var i = 0; i < 1e4; ++i) - shouldBe(builtin(obj4), undefined); - - var target5 = "Hello"; - var target6 = 42; - var target7 = false; - var target8 = Symbol("Cocoa"); - for (var i = 0; i < 1e4; ++i) { - shouldBe(builtin(target5), undefined); - shouldBe(builtin(target6), undefined); - shouldBe(builtin(target7), undefined); - shouldBe(builtin(target8), undefined); - } - - shouldThrow(() => { - builtin(null); - }, `TypeError: null is not an object`); - - shouldThrow(() => { - builtin(undefined); - }, `TypeError: undefined is not an object`); - - shouldBe(builtin(obj), 42); - shouldBe(builtin(obj2), 22); - shouldBe(builtin(obj3), undefined); - shouldBe(builtin(obj4), undefined); - shouldBe(builtin(target5), undefined); - shouldBe(builtin(target6), undefined); - shouldBe(builtin(target7), undefined); - shouldBe(builtin(target8), undefined); -}()); - -(function () { - var builtin = createBuiltin(`(function (obj) { - return @getByIdDirect(obj, "hello"); - })`); - noInline(builtin); - - var obj = { }; - for (var i = 0; i < 1e4; ++i) - shouldBe(builtin(obj), undefined); - shouldBe(builtin(obj), undefined); - obj.hello = 42; - shouldBe(builtin(obj), 42); -}()); - - -(function () { - var builtin = createBuiltin(`(function (obj) { - return @getByIdDirect(obj, "length"); - })`); - noInline(builtin); - - var array = [0, 1, 2]; - for (var i = 0; i < 1e4; ++i) - shouldBe(builtin(array), 3); - shouldBe(builtin({}), undefined); - - var obj = { length:2 }; - var obj2 = { get length() { return 2; } }; - for (var i = 0; i < 1e4; ++i) { - shouldBe(builtin(array), 3); - shouldBe(builtin(obj), 2); - shouldBe(builtin(obj2), 2); - shouldBe(builtin("Cocoa"), 5); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/get-by-id-direct.js b/implementation-contributed/javascriptcore/stress/get-by-id-direct.js deleted file mode 100644 index e0e48642dc..0000000000 --- a/implementation-contributed/javascriptcore/stress/get-by-id-direct.js +++ /dev/null @@ -1,110 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -function shouldThrow(func, errorMessage) { - var errorThrown = false; - var error = null; - try { - func(); - } catch (e) { - errorThrown = true; - error = e; - } - if (!errorThrown) - throw new Error('not thrown'); - if (String(error) !== errorMessage) - throw new Error(`bad error: ${String(error)}`); -} - -(function () { - var builtin = createBuiltin(`(function (obj) { - return @getByIdDirect(obj, "hello"); - })`); - noInline(builtin); - - var obj = { hello: 42, world:33 }; - for (var i = 0; i < 1e4; ++i) - shouldBe(builtin(obj), 42); - - var obj2 = { hello: 22 }; - for (var i = 0; i < 1e4; ++i) { - shouldBe(builtin(obj), 42); - shouldBe(builtin(obj2), 22); - } - - var obj3 = { }; - for (var i = 0; i < 1e4; ++i) - shouldBe(builtin(obj3), undefined); - - var obj4 = { - __proto__: { hello: 33 } - }; - for (var i = 0; i < 1e4; ++i) - shouldBe(builtin(obj4), undefined); - - var target5 = "Hello"; - var target6 = 42; - var target7 = false; - var target8 = Symbol("Cocoa"); - for (var i = 0; i < 1e4; ++i) { - shouldBe(builtin(target5), undefined); - shouldBe(builtin(target6), undefined); - shouldBe(builtin(target7), undefined); - shouldBe(builtin(target8), undefined); - } - - shouldThrow(() => { - builtin(null); - }, `TypeError: null is not an object`); - - shouldThrow(() => { - builtin(undefined); - }, `TypeError: undefined is not an object`); - - shouldBe(builtin(obj), 42); - shouldBe(builtin(obj2), 22); - shouldBe(builtin(obj3), undefined); - shouldBe(builtin(obj4), undefined); - shouldBe(builtin(target5), undefined); - shouldBe(builtin(target6), undefined); - shouldBe(builtin(target7), undefined); - shouldBe(builtin(target8), undefined); -}()); - -(function () { - var builtin = createBuiltin(`(function (obj) { - return @getByIdDirect(obj, "hello"); - })`); - noInline(builtin); - - var obj = { }; - for (var i = 0; i < 1e4; ++i) - shouldBe(builtin(obj), undefined); - shouldBe(builtin(obj), undefined); - obj.hello = 42; - shouldBe(builtin(obj), 42); -}()); - - -(function () { - var builtin = createBuiltin(`(function (obj) { - return @getByIdDirect(obj, "length"); - })`); - noInline(builtin); - - var array = [0, 1, 2]; - for (var i = 0; i < 1e4; ++i) - shouldBe(builtin(array), 3); - shouldBe(builtin({}), undefined); - - var obj = { length:2 }; - for (var i = 0; i < 1e4; ++i) { - shouldBe(builtin(array), 3); - shouldBe(builtin(obj), 2); - shouldBe(builtin("Cocoa"), 5); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-2.js b/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-2.js deleted file mode 100644 index fcfddf4949..0000000000 --- a/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-2.js +++ /dev/null @@ -1,15 +0,0 @@ -var setGlobalConstRedeclarationShouldNotThrow = $vm.setGlobalConstRedeclarationShouldNotThrow; - -function assert(b) { - if (!b) - throw new Error("Bad assertion."); -} - -setGlobalConstRedeclarationShouldNotThrow(); // Allow duplicate const declarations at the global level. - -for (let i = 0; i < 100; i++) { - load("./global-const-redeclaration-setting/first.js"); - assert(foo === 20); - load("./global-const-redeclaration-setting/second.js"); - assert(foo === 40); -} diff --git a/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-3.js b/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-3.js deleted file mode 100644 index 1177cb9581..0000000000 --- a/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-3.js +++ /dev/null @@ -1,20 +0,0 @@ -var setGlobalConstRedeclarationShouldNotThrow = $vm.setGlobalConstRedeclarationShouldNotThrow; - -function assert(b) { - if (!b) - throw new Error("Bad assertion."); -} - -setGlobalConstRedeclarationShouldNotThrow(); // Allow duplicate const declarations at the global level. - -load("./global-const-redeclaration-setting/first.js"); -assert(foo === 20); -let threw = false; -try { - load("./global-const-redeclaration-setting/strict.js"); // We ignore the setting and always throw an error when in strict mode! -} catch(e) { - threw = true; -} - -assert(threw); -assert(foo === 20); diff --git a/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-4.js b/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-4.js deleted file mode 100644 index d96a3d6e2e..0000000000 --- a/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-4.js +++ /dev/null @@ -1,20 +0,0 @@ -var setGlobalConstRedeclarationShouldNotThrow = $vm.setGlobalConstRedeclarationShouldNotThrow; - -function assert(b) { - if (!b) - throw new Error("Bad assertion."); -} - -setGlobalConstRedeclarationShouldNotThrow(); // Allow duplicate const declarations at the global level. - -load("./global-const-redeclaration-setting/first.js"); -assert(foo === 20); -let threw = false; -try { - load("./global-const-redeclaration-setting/let.js"); // Redeclaration a 'let' variable should throw because this doesn't break backwards compat. -} catch(e) { - threw = true; -} - -assert(threw); -assert(foo === 20); diff --git a/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-5.js b/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-5.js deleted file mode 100644 index e3ea091814..0000000000 --- a/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting-5.js +++ /dev/null @@ -1,20 +0,0 @@ -var setGlobalConstRedeclarationShouldNotThrow = $vm.setGlobalConstRedeclarationShouldNotThrow; - -function assert(b) { - if (!b) - throw new Error("Bad assertion."); -} - -setGlobalConstRedeclarationShouldNotThrow(); // Allow duplicate const declarations at the global level. - -load("./global-const-redeclaration-setting/let.js"); -assert(foo === 50); -let threw = false; -try { - load("./global-const-redeclaration-setting/first.js"); // Redeclaration of a 'let' to 'const' should always throw because it isn't breaking backwards compat. -} catch(e) { - threw = true; -} - -assert(threw); -assert(foo === 50); diff --git a/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting.js b/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting.js deleted file mode 100644 index aed1b41c4a..0000000000 --- a/implementation-contributed/javascriptcore/stress/global-const-redeclaration-setting.js +++ /dev/null @@ -1,13 +0,0 @@ -var setGlobalConstRedeclarationShouldNotThrow = $vm.setGlobalConstRedeclarationShouldNotThrow; - -function assert(b) { - if (!b) - throw new Error("Bad assertion."); -} - -setGlobalConstRedeclarationShouldNotThrow(); // Allow duplicate const declarations at the global level. - -load("./global-const-redeclaration-setting/first.js"); -assert(foo === 20); -load("./global-const-redeclaration-setting/second.js"); -assert(foo === 40); diff --git a/implementation-contributed/javascriptcore/stress/has-indexed-property-array-storage-ftl.js b/implementation-contributed/javascriptcore/stress/has-indexed-property-array-storage-ftl.js deleted file mode 100644 index 6d937d61bb..0000000000 --- a/implementation-contributed/javascriptcore/stress/has-indexed-property-array-storage-ftl.js +++ /dev/null @@ -1,48 +0,0 @@ -//@ if isFTLEnabled then runFTLNoCJIT else skip end - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var didFTLCompile = false; -var ftlTrue = $vm.ftlTrue; -function test1(array) -{ - didFTLCompile = ftlTrue(); - return 2 in array; -} -noInline(test1); - -var array = [1, 2, 3, 4]; -ensureArrayStorage(array); -didFTLCompile = false; -for (var i = 0; i < 1e5; ++i) - shouldBe(test1(array), true); -shouldBe(didFTLCompile, true); - -var array = [1, 2, , 4]; -ensureArrayStorage(array); -shouldBe(test1(array), false); - -var array = []; -ensureArrayStorage(array); -shouldBe(test1(array), false); - -function test2(array) -{ - didFTLCompile = ftlTrue(); - return 13 in array; -} -noInline(test2); - -var array1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; -ensureArrayStorage(array1); -var array2 = [1, 2]; -ensureArrayStorage(array2); -didFTLCompile = false; -for (var i = 0; i < 1e5; ++i) - shouldBe(test2(array2), false); -shouldBe(didFTLCompile, true); -shouldBe(test2(array2), false); -shouldBe(test2(array1), true); diff --git a/implementation-contributed/javascriptcore/stress/has-indexed-property-slow-put-array-storage-ftl.js b/implementation-contributed/javascriptcore/stress/has-indexed-property-slow-put-array-storage-ftl.js deleted file mode 100644 index 828afdbea3..0000000000 --- a/implementation-contributed/javascriptcore/stress/has-indexed-property-slow-put-array-storage-ftl.js +++ /dev/null @@ -1,61 +0,0 @@ -//@ if isFTLEnabled then runFTLNoCJIT else skip end - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var didFTLCompile = false; -var ftlTrue = $vm.ftlTrue; -function test1(array) -{ - didFTLCompile = ftlTrue(); - return 2 in array; -} -noInline(test1); - -var object = { a: 10 }; -Object.defineProperties(object, { - "0": { - get: function() { return this.a; }, - set: function(x) { this.a = x; }, - }, -}); - -var array = [1, 2, 3, 4]; -array.__proto__ = object; -ensureArrayStorage(array); -didFTLCompile = false; -for (var i = 0; i < 1e5; ++i) - shouldBe(test1(array), true); -shouldBe(didFTLCompile, true); - -var array = [1, 2, , 4]; -array.__proto__ = object; -ensureArrayStorage(array); -shouldBe(test1(array), false); - -var array = []; -array.__proto__ = object; -ensureArrayStorage(array); -shouldBe(test1(array), false); - -function test2(array) -{ - didFTLCompile = ftlTrue(); - return 9 in array; -} -noInline(test2); - -var array1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; -array1.__proto__ = object; -ensureArrayStorage(array1); -var array2 = [1, 2]; -array2.__proto__ = object; -ensureArrayStorage(array2); -didFTLCompile = false; -for (var i = 0; i < 1e5; ++i) - shouldBe(test2(array2), false); -shouldBe(didFTLCompile, true); -shouldBe(test2(array2), false); -shouldBe(test2(array1), true); diff --git a/implementation-contributed/javascriptcore/stress/import-basic.js b/implementation-contributed/javascriptcore/stress/import-basic.js deleted file mode 100644 index d718b219c9..0000000000 --- a/implementation-contributed/javascriptcore/stress/import-basic.js +++ /dev/null @@ -1,55 +0,0 @@ -var abort = $vm.abort; - -(async function () { - const { shouldBe } = await import('./import-tests/should.js'); - { - let a = await import('./import-tests/cocoa.js'); - let b = await import('./import-tests/cocoa.js'); - shouldBe(a, b); - shouldBe(a.hello(), 42); - } - - { - let a = await import('./import-tests/multiple.js'); - let a2 = await a.result(); - shouldBe(a !== a2, true); - shouldBe(a2.ok(), 42); - let a3 = await a.result(); - shouldBe(a2, a3); - } - - { - let error = null; - try { - let a = await import({ toString() { throw new Error('out'); } }); - } catch (e) { - error = e; - } - shouldBe(error !== null, true); - shouldBe(String(error), `Error: out`); - } - - { - async function load(cond) { - if (cond) - return import('./import-tests/cocoa.js'); - return undefined; - } - - let v = await load(false); - shouldBe(v, undefined); - let v2 = await load(true); - let v3 = await import('./import-tests/cocoa.js'); - shouldBe(v2, v2); - } - - { - let value = './import-tests/cocoa.js'; - let v = await import(value); - let v2 = await import('./import-tests/cocoa.js'); - shouldBe(v, v2); - } -}()).catch((error) => { - print(String(error)); - abort(); -}); diff --git a/implementation-contributed/javascriptcore/stress/import-from-eval.js b/implementation-contributed/javascriptcore/stress/import-from-eval.js deleted file mode 100644 index 5f75db00bc..0000000000 --- a/implementation-contributed/javascriptcore/stress/import-from-eval.js +++ /dev/null @@ -1,38 +0,0 @@ -var abort = $vm.abort; - -(async function () { - const { shouldBe, shouldThrow } = await import("./import-tests/should.js"); - - { - let cocoa = await eval(`import("./import-tests/cocoa.js")`); - shouldBe(cocoa.hello(), 42); - } - - { - let cocoa = await (0, eval)(`import("./import-tests/cocoa.js")`); - shouldBe(cocoa.hello(), 42); - } - - { - let cocoa = await eval(`eval('import("./import-tests/cocoa.js")')`); - shouldBe(cocoa.hello(), 42); - } - - { - let cocoa = await ((new Function(`return eval('import("./import-tests/cocoa.js")')`))()); - shouldBe(cocoa.hello(), 42); - } - - { - let cocoa = await eval(`(new Function('return import("./import-tests/cocoa.js")'))()`); - shouldBe(cocoa.hello(), 42); - } - - { - let cocoa = await [`import("./import-tests/cocoa.js")`].map(eval)[0]; - shouldBe(cocoa.hello(), 42); - } -}()).catch((error) => { - print(String(error)); - abort(); -}); diff --git a/implementation-contributed/javascriptcore/stress/import-reject-with-exception.js b/implementation-contributed/javascriptcore/stress/import-reject-with-exception.js deleted file mode 100644 index 8a5381a6bf..0000000000 --- a/implementation-contributed/javascriptcore/stress/import-reject-with-exception.js +++ /dev/null @@ -1,17 +0,0 @@ -var abort = $vm.abort; - -function shouldBe(actual, expected) -{ - if (actual !== expected) - abort(); -} - -let x = { - get toString() { - throw new Error('bad'); - } -}; - -import(x).then(abort, function (error) { - shouldBe(String(error), `Error: bad`); -}); diff --git a/implementation-contributed/javascriptcore/stress/import-syntax.js b/implementation-contributed/javascriptcore/stress/import-syntax.js deleted file mode 100644 index 25a3fbbf68..0000000000 --- a/implementation-contributed/javascriptcore/stress/import-syntax.js +++ /dev/null @@ -1,66 +0,0 @@ -var abort = $vm.abort; - -function testSyntaxError(script, message) { - var error = null; - try { - eval(script); - } catch (e) { - error = e; - } - if (!error) - throw new Error("Expected syntax error not thrown"); - - if (String(error) !== message) - throw new Error(`Bad error: ${String(error)}`); -} - -async function testSyntax(script, message) { - var error = null; - try { - await eval(script); - } catch (e) { - error = e; - } - if (error) { - if (error instanceof SyntaxError) - throw new Error("Syntax error thrown"); - } -} - -testSyntaxError(`import)`, `SyntaxError: Unexpected token ')'. import call expects exactly one argument.`); -testSyntaxError(`new import(`, `SyntaxError: Cannot use new with import.`); -testSyntaxError(`import.hello()`, `SyntaxError: Unexpected identifier 'hello'. "import." can only followed with meta.`); -testSyntaxError(`import[`, `SyntaxError: Unexpected token '['. import call expects exactly one argument.`); -testSyntaxError(`import<`, `SyntaxError: Unexpected token '<'. import call expects exactly one argument.`); - -testSyntaxError(`import()`, `SyntaxError: Unexpected token ')'`); -testSyntaxError(`import(a, b)`, `SyntaxError: Unexpected token ','. import call expects exactly one argument.`); -testSyntaxError(`import(a, b, c)`, `SyntaxError: Unexpected token ','. import call expects exactly one argument.`); -testSyntaxError(`import(...a)`, `SyntaxError: Unexpected token '...'`); -testSyntaxError(`import(,a)`, `SyntaxError: Unexpected token ','`); -testSyntaxError(`import(,)`, `SyntaxError: Unexpected token ','`); -testSyntaxError(`import("Hello";`, `SyntaxError: Unexpected token ';'. import call expects exactly one argument.`); -testSyntaxError(`import("Hello"];`, `SyntaxError: Unexpected token ']'. import call expects exactly one argument.`); -testSyntaxError(`import("Hello",;`, `SyntaxError: Unexpected token ','. import call expects exactly one argument.`); -testSyntaxError(`import("Hello", "Hello2";`, `SyntaxError: Unexpected token ','. import call expects exactly one argument.`); - - -testSyntaxError(`import = 42`, `SyntaxError: Unexpected token '='. import call expects exactly one argument.`); -testSyntaxError(`[import] = 42`, `SyntaxError: Unexpected token ']'. import call expects exactly one argument.`); -testSyntaxError(`{import} = 42`, `SyntaxError: Unexpected token '}'. import call expects exactly one argument.`); -testSyntaxError(`let import = 42`, `SyntaxError: Unexpected keyword 'import'`); -testSyntaxError(`var import = 42`, `SyntaxError: Cannot use the keyword 'import' as a variable name.`); -testSyntaxError(`const import = 42`, `SyntaxError: Cannot use the keyword 'import' as a lexical variable name.`); - -(async function () { - await testSyntax(`import("./import-tests/cocoa.js")`); - await testSyntax(`import("./import-tests/../import-tests/cocoa.js")`); - await testSyntax(`import("./import-tests/../import-tests/cocoa.js").then(() => { })`); - await testSyntax(`(import("./import-tests/../import-tests/cocoa.js").then(() => { }))`); - await testSyntax(`(import("./import-tests/../import-tests/cocoa.js"))`); - await testSyntax(`import("./import-tests/../import-tests/cocoa.js").catch(() => { })`); - await testSyntax(`(import("./import-tests/../import-tests/cocoa.js").catch(() => { }))`); -}()).catch((error) => { - print(String(error)); - abort(); -}); diff --git a/implementation-contributed/javascriptcore/stress/import-with-empty-string.js b/implementation-contributed/javascriptcore/stress/import-with-empty-string.js deleted file mode 100644 index d174ec9ecf..0000000000 --- a/implementation-contributed/javascriptcore/stress/import-with-empty-string.js +++ /dev/null @@ -1,2 +0,0 @@ -import("").then($vm.abort, function () { -}); diff --git a/implementation-contributed/javascriptcore/stress/impure-get-own-property-slot-inline-cache.js b/implementation-contributed/javascriptcore/stress/impure-get-own-property-slot-inline-cache.js deleted file mode 100644 index b1293bd40c..0000000000 --- a/implementation-contributed/javascriptcore/stress/impure-get-own-property-slot-inline-cache.js +++ /dev/null @@ -1,19 +0,0 @@ -var createImpureGetter = $vm.createImpureGetter; -var setImpureGetterDelegate = $vm.setImpureGetterDelegate; - -var ig = createImpureGetter(null); -ig.x = 42; - -var foo = function(o) { - return o.x; -}; - -noInline(foo); - -for (var i = 0; i < 10000; ++i) - foo(ig); - -setImpureGetterDelegate(ig, {x:"x"}); - -if (foo(ig) !== "x") - throw new Error("Incorrect result!"); diff --git a/implementation-contributed/javascriptcore/stress/in-by-id-custom-accessors.js b/implementation-contributed/javascriptcore/stress/in-by-id-custom-accessors.js deleted file mode 100644 index 9571ec8eb5..0000000000 --- a/implementation-contributed/javascriptcore/stress/in-by-id-custom-accessors.js +++ /dev/null @@ -1,25 +0,0 @@ -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -function test1(object) -{ - return "customValue" in object; -} -noInline(test1); - -function test2(object) -{ - return "customAccessor" in object; -} -noInline(test2); - -var target1 = $vm.createCustomTestGetterSetter(); -var target2 = { __proto__: target1 }; -for (var i = 0; i < 1e5; ++i) { - shouldBe(test1(target1), true); - shouldBe(test1(target2), true); - shouldBe(test2(target1), true); - shouldBe(test2(target2), true); -} diff --git a/implementation-contributed/javascriptcore/stress/int52-ai-add-then-filter-int32.js b/implementation-contributed/javascriptcore/stress/int52-ai-add-then-filter-int32.js deleted file mode 100644 index 3f038dcbfe..0000000000 --- a/implementation-contributed/javascriptcore/stress/int52-ai-add-then-filter-int32.js +++ /dev/null @@ -1,15 +0,0 @@ -function foo(a, b, c) { - var o = {f:42}; - if ($vm.dfgTrue()) - o.f = a + b + c; - return o.f | 0; -} - -noInline(foo); - -for (var i = 0; i < 10000; ++i) { - var result = foo(2000000000, 2000000000, -2000000000); - if (result != 2000000000 && result != 42) - throw "Error: bad result: " + result; -} - diff --git a/implementation-contributed/javascriptcore/stress/int52-ai-mul-and-clean-neg-zero-then-filter-int32.js b/implementation-contributed/javascriptcore/stress/int52-ai-mul-and-clean-neg-zero-then-filter-int32.js deleted file mode 100644 index 061b7ea7fe..0000000000 --- a/implementation-contributed/javascriptcore/stress/int52-ai-mul-and-clean-neg-zero-then-filter-int32.js +++ /dev/null @@ -1,15 +0,0 @@ -function foo(a, b, c) { - var o = {f:42}; - if ($vm.dfgTrue()) - o.f = (a * b + 5) * c + 5; - return o.f | 0; -} - -noInline(foo); - -for (var i = 0; i < 10000; ++i) { - var result = foo(65536, 65536, 0); - if (result != 5 && result != 42) - throw "Error: bad result: " + result; -} - diff --git a/implementation-contributed/javascriptcore/stress/int52-ai-mul-then-filter-int32.js b/implementation-contributed/javascriptcore/stress/int52-ai-mul-then-filter-int32.js deleted file mode 100644 index 541801728f..0000000000 --- a/implementation-contributed/javascriptcore/stress/int52-ai-mul-then-filter-int32.js +++ /dev/null @@ -1,15 +0,0 @@ -function foo(a, b, c) { - var o = {f:42}; - if ($vm.dfgTrue()) - o.f = a * b * c; - return o.f | 0; -} - -noInline(foo); - -for (var i = 0; i < 10000; ++i) { - var result = foo(65536, 65536, 0); - if (result != 0 && result != 42) - throw "Error: bad result: " + result; -} - diff --git a/implementation-contributed/javascriptcore/stress/int52-ai-neg-then-filter-int32.js b/implementation-contributed/javascriptcore/stress/int52-ai-neg-then-filter-int32.js deleted file mode 100644 index 82c971c0d1..0000000000 --- a/implementation-contributed/javascriptcore/stress/int52-ai-neg-then-filter-int32.js +++ /dev/null @@ -1,15 +0,0 @@ -function foo(a, b) { - var o = {f:42}; - if ($vm.dfgTrue()) - o.f = -(a + b); - return o.f | 0; -} - -noInline(foo); - -for (var i = 0; i < 10000; ++i) { - var result = foo(1073741824, 1073741824); - if (result != -2147483648 && result != 42) - throw "Error: bad result: " + result; -} - diff --git a/implementation-contributed/javascriptcore/stress/int52-ai-sub-then-filter-int32.js b/implementation-contributed/javascriptcore/stress/int52-ai-sub-then-filter-int32.js deleted file mode 100644 index 7d70b155b7..0000000000 --- a/implementation-contributed/javascriptcore/stress/int52-ai-sub-then-filter-int32.js +++ /dev/null @@ -1,15 +0,0 @@ -function foo(a, b) { - var o = {f:42}; - if ($vm.dfgTrue()) - o.f = a - b - 2000000000; - return o.f | 0; -} - -noInline(foo); - -for (var i = 0; i < 10000; ++i) { - var result = foo(2000000000, -2000000000); - if (result != 2000000000 && result != 42) - throw "Error: bad result: " + result; -} - diff --git a/implementation-contributed/javascriptcore/stress/is-constructor.js b/implementation-contributed/javascriptcore/stress/is-constructor.js deleted file mode 100644 index b6947a4115..0000000000 --- a/implementation-contributed/javascriptcore/stress/is-constructor.js +++ /dev/null @@ -1,101 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function assert(x) { - if (!x) - throw Error("Bad"); -} - -let isConstructor = createBuiltin("(function (c) { return @isConstructor(c); })"); - -// Functions. -assert(isConstructor(assert)); -assert(isConstructor(class{})); -assert(isConstructor(function(){})); - -// Proxy functions. -assert(isConstructor(new Proxy(assert, {}))); -assert(isConstructor(new Proxy(class{}, {}))); -assert(isConstructor(new Proxy(function(){}, {}))); - -// Bound functions. -assert(isConstructor(assert.bind(null), {})); -assert(isConstructor((class{}).bind(null), {})); -assert(isConstructor(function(){}.bind(null), {})); - -// Builtin constructors. -assert(isConstructor(Array)); -assert(isConstructor(ArrayBuffer)); -assert(isConstructor(Boolean)); -assert(isConstructor(Date)); -assert(isConstructor(Error)); -assert(isConstructor(Function)); -assert(isConstructor(Map)); -assert(isConstructor(Number)); -assert(isConstructor(Object)); -assert(isConstructor(Promise)); -assert(isConstructor(Proxy)); -assert(isConstructor(RegExp)); -assert(isConstructor(Set)); -assert(isConstructor(String)); -assert(isConstructor(WeakMap)); -assert(isConstructor(WeakSet)); - -// Non-function values. -assert(!isConstructor(undefined)); -assert(!isConstructor(null)); -assert(!isConstructor(true)); -assert(!isConstructor(false)); -assert(!isConstructor(0)); -assert(!isConstructor(1)); -assert(!isConstructor(1.1)); -assert(!isConstructor(-1)); -assert(!isConstructor(Date.now())); -assert(!isConstructor(new Date)); -assert(!isConstructor(Infinity)); -assert(!isConstructor(NaN)); -assert(!isConstructor("")); -assert(!isConstructor("test")); -assert(!isConstructor([])); -assert(!isConstructor({})); -assert(!isConstructor(/regex/)); -assert(!isConstructor(Math)); -assert(!isConstructor(JSON)); -assert(!isConstructor(Symbol())); -assert(!isConstructor(new Error)); -assert(!isConstructor(new Proxy({}, {}))); -assert(!isConstructor(Array.prototype)); - -// Symbol is not a constructor. -assert(!isConstructor(Symbol)); - -// Getters / setters are not constructors. -assert(!isConstructor(Object.getOwnPropertyDescriptor({get f(){}}, "f").get)); -assert(!isConstructor(Object.getOwnPropertyDescriptor({set f(x){}}, "f").set)); - -// Arrow functions are not constructors. -assert(!isConstructor(()=>{})); - -// Generators are not constructors. -assert(!isConstructor(function*(){})); - -// Native builtins are not constructors. -assert(!isConstructor(isConstructor)); - -// https://tc39.github.io/ecma262/#sec-built-in-function-objects -// Built-in function objects that are not identified as constructors do not -// implement the [[Construct]] internal method unless otherwise specified in -// the description of a particular function. -assert(!isConstructor(Array.of)); -assert(!isConstructor(Object.getOwnPropertyDescriptor)); -assert(!isConstructor(Date.now)); -assert(!isConstructor(Math.cos)); -assert(!isConstructor(JSON.stringify)); -assert(!isConstructor(Promise.all)); -assert(!isConstructor(Symbol.for)); -assert(!isConstructor(Array.prototype.push)); - -// Proxy and bound functions carry forward non-constructor-ness. -assert(!isConstructor(new Proxy(Symbol, {}))); -assert(!isConstructor(new Proxy(Math.cos, {}))); -assert(!isConstructor(Symbol.bind(null))); -assert(!isConstructor(Math.cos.bind(null))); diff --git a/implementation-contributed/javascriptcore/stress/istypedarrayview-intrinsic.js b/implementation-contributed/javascriptcore/stress/istypedarrayview-intrinsic.js deleted file mode 100644 index 998a8f6a5d..0000000000 --- a/implementation-contributed/javascriptcore/stress/istypedarrayview-intrinsic.js +++ /dev/null @@ -1,77 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -let typedArrays = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array]; - -function makeFn(dontInline) { - let foo = createBuiltin(`(function (a) { "use strict"; return @isTypedArrayView(a); })`); - if (dontInline) - noInline(foo) - return foo; -} - -typedArrays.forEach(function() { - let test = Function( - ` - let foo = makeFn(); - let bar = makeFn(true); - let view = new Int8Array(10); - - for (i = 0; i < 100000; i++) { - if (!foo(view)) - throw new Error(i); - if (!bar(view)) - throw new Error(i); - } - ` - ); - test(); -}); - -typedArrays.forEach(constructor1 => { - typedArrays.forEach(constructor2 => { - let test = Function( - ` - let foo = makeFn(); - let bar = makeFn(true); - let view1 = new ${constructor1.name}(10); - let view2 = new ${constructor2.name}(10); - - for (i = 0; i < 100000; i++) { - let view = i % 2 === 0 ? view1 : view2; - if (!foo(view)) - throw new Error(i); - if (!bar(view)) - throw new Error(i); - } - ` - ); - test(); - }); -}); - -let test = function() { - let foo = makeFn(); - let bar = makeFn(true); - for (i = 0; i < 100000; i++) { - if (foo(true)) - throw new Error(i); - if (bar(true)) - throw new Error(i); - } -} -test(); - -test = function() { - let bar = makeFn(true); - let view = new Int8Array(10); - let obj = new DataView(new ArrayBuffer(10)); - for (i = 0; i < 100000; i++) { - if (i % 2 === 0) { - if (!foo(view)) - throw new Error(i); - } else { - if (foo(obj)) - throw new Error(i); - } - } -} diff --git a/implementation-contributed/javascriptcore/stress/jsc-setImpureGetterDelegate-on-bad-type.js b/implementation-contributed/javascriptcore/stress/jsc-setImpureGetterDelegate-on-bad-type.js deleted file mode 100644 index 84b5fe5b65..0000000000 --- a/implementation-contributed/javascriptcore/stress/jsc-setImpureGetterDelegate-on-bad-type.js +++ /dev/null @@ -1,23 +0,0 @@ -//@ runFTLNoCJIT -// This test passes if it does not crash or trigger any assertion failures. - -var setImpureGetterDelegate = $vm.setImpureGetterDelegate; - -function shouldEqual(actual, expected) { - if (actual != expected) { - throw "ERROR: expect " + expected + ", actual " + actual; - } -} - -var arrayBuffer = new ArrayBuffer(0x20); -var dataView_A = new DataView(arrayBuffer); -var dataView_B = new DataView(arrayBuffer); - -var exception; -try { - setImpureGetterDelegate(dataView_A, dataView_B); -} catch (e) { - exception = e; -} - -shouldEqual(exception, "TypeError: argument is not an ImpureGetter"); diff --git a/implementation-contributed/javascriptcore/stress/jsc-test-functions-should-be-more-robust.js b/implementation-contributed/javascriptcore/stress/jsc-test-functions-should-be-more-robust.js deleted file mode 100644 index 3c9619894e..0000000000 --- a/implementation-contributed/javascriptcore/stress/jsc-test-functions-should-be-more-robust.js +++ /dev/null @@ -1,28 +0,0 @@ -//@ runFTLNoCJIT -// This test passes if it does not crash or trigger any assertion failures. - -var getHiddenValue = $vm.getHiddenValue; -var setHiddenValue = $vm.setHiddenValue; - -function shouldEqual(actual, expected) { - if (actual != expected) { - throw "ERROR: expect " + expected + ", actual " + actual; - } -} - -function test(testAction, expectedException) { - var exception; - try { - testAction(); - } catch (e) { - exception = e; - } - shouldEqual(exception, expectedException); -} - -test(() => { getHiddenValue(); }, "TypeError: Invalid use of getHiddenValue test function"); -test(() => { getHiddenValue({}); }, "TypeError: Invalid use of getHiddenValue test function"); - -test(() => { setHiddenValue(); }, "TypeError: Invalid use of setHiddenValue test function"); -test(() => { setHiddenValue({}); }, "TypeError: Invalid use of setHiddenValue test function"); - diff --git a/implementation-contributed/javascriptcore/stress/licm-pre-header-cannot-exit-nested.js b/implementation-contributed/javascriptcore/stress/licm-pre-header-cannot-exit-nested.js deleted file mode 100644 index b866747cc7..0000000000 --- a/implementation-contributed/javascriptcore/stress/licm-pre-header-cannot-exit-nested.js +++ /dev/null @@ -1,21 +0,0 @@ -//@ runFTLNoCJIT("--createPreHeaders=false") - -function foo(object, predicate) { - for (var j = 0; j < 10; ++j) { - var result = 0; - var i = 0; - if ($vm.dfgTrue()) - predicate = 42; - while (predicate >= 42) { - result += object.array[i++]; - if (i >= object.array.length) - break; - } - } - return result; -} - -noInline(foo); - -for (var i = 0; i < 10000; ++i) - foo({array: [1, 2, 3]}, {valueOf: function() { return 42; }}); diff --git a/implementation-contributed/javascriptcore/stress/licm-pre-header-cannot-exit.js b/implementation-contributed/javascriptcore/stress/licm-pre-header-cannot-exit.js deleted file mode 100644 index 8a4262d759..0000000000 --- a/implementation-contributed/javascriptcore/stress/licm-pre-header-cannot-exit.js +++ /dev/null @@ -1,19 +0,0 @@ -//@ runFTLNoCJIT("--createPreHeaders=false") - -function foo(object, predicate) { - var result = 0; - var i = 0; - if ($vm.dfgTrue()) - predicate = 42; - while (predicate >= 42) { - result += object.array[i++]; - if (i >= object.array.length) - break; - } - return result; -} - -noInline(foo); - -for (var i = 0; i < 10000; ++i) - foo({array: [1, 2, 3]}, {valueOf: function() { return 42; }}); diff --git a/implementation-contributed/javascriptcore/stress/object-assign-fast-path.js b/implementation-contributed/javascriptcore/stress/object-assign-fast-path.js deleted file mode 100644 index 5c6d54760a..0000000000 --- a/implementation-contributed/javascriptcore/stress/object-assign-fast-path.js +++ /dev/null @@ -1,161 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error(`bad value: ${String(actual)}`); -} - -function shouldThrow(func, errorMessage) { - var errorThrown = false; - var error = null; - try { - func(); - } catch (e) { - errorThrown = true; - error = e; - } - if (!errorThrown) - throw new Error('not thrown'); - if (String(error) !== errorMessage) - throw new Error(`bad error: ${String(error)}`); -} - -function checkProperty(object, name, value, attributes = { writable: true, enumerable: true, configurable: true }) -{ - var desc = Object.getOwnPropertyDescriptor(object, name); - shouldBe(!!desc, true); - shouldBe(desc.writable, attributes.writable); - shouldBe(desc.enumerable, attributes.enumerable); - shouldBe(desc.configurable, attributes.configurable); - shouldBe(desc.value, value); -} - -{ - let result = Object.assign({}, RegExp); - shouldBe(JSON.stringify(Object.getOwnPropertyNames(result).sort()), `["$1","$2","$3","$4","$5","$6","$7","$8","$9","input","lastMatch","lastParen","leftContext","multiline","rightContext"]`); -} -{ - function Hello() { } - let result = Object.assign(Hello, { - ok: 42 - }); - - shouldBe(JSON.stringify(Object.getOwnPropertyNames(result).sort()), `["arguments","caller","length","name","ok","prototype"]`); - checkProperty(result, "ok", 42); -} -{ - let result = Object.assign({ ok: 42 }, { 0: 0, 1: 1 }); - shouldBe(JSON.stringify(Object.getOwnPropertyNames(result).sort()), `["0","1","ok"]`); - checkProperty(result, "ok", 42); - checkProperty(result, "0", 0); - checkProperty(result, "1", 1); -} -{ - let object = { 0: 0, 1: 1 }; - ensureArrayStorage(object); - let result = Object.assign({ ok: 42 }, object); - shouldBe(JSON.stringify(Object.getOwnPropertyNames(result).sort()), `["0","1","ok"]`); - checkProperty(result, "ok", 42); - checkProperty(result, "0", 0); - checkProperty(result, "1", 1); -} -{ - let called = false; - let result = Object.assign({}, { - get hello() { - called = true; - return 42; - } - }); - shouldBe(JSON.stringify(Object.getOwnPropertyNames(result).sort()), `["hello"]`); - shouldBe(called, true); - checkProperty(result, "hello", 42); -} -{ - let object = {}; - Object.defineProperty(object, "__proto__", { - value: 42, - enumerable: true, - writable: true, - configurable: true - }); - checkProperty(object, "__proto__", 42); - shouldBe(JSON.stringify(Object.getOwnPropertyNames(object).sort()), `["__proto__"]`); - let result = Object.assign({}, object); - shouldBe(JSON.stringify(Object.getOwnPropertyNames(result).sort()), `[]`); - shouldBe(Object.getOwnPropertyDescriptor(result, "__proto__"), undefined); - shouldBe(result.__proto__, Object.prototype); -} -{ - let object = {}; - Object.defineProperty(object, "hello", { - value: 42, - writable: false, - enumerable: true, - configurable: false - }); - checkProperty(object, "hello", 42, { writable: false, enumerable: true, configurable: false }); - shouldBe(JSON.stringify(Object.getOwnPropertyNames(object).sort()), `["hello"]`); - shouldThrow(() => { - Object.assign(object, { hello: 50 }); - }, `TypeError: Attempted to assign to readonly property.`); -} -{ - let counter = 0; - let helloCalled = null; - let okCalled = null; - let source = {}; - source.hello = 42; - source.ok = 52; - checkProperty(source, "hello", 42); - checkProperty(source, "ok", 52); - shouldBe(JSON.stringify(Object.getOwnPropertyNames(source)), `["hello","ok"]`); - - let result = Object.assign({ - set hello(value) { - this.__hello = value; - helloCalled = counter++; - }, - set ok(value) { - this.__ok = value; - okCalled = counter++; - } - }, source); - checkProperty(result, "__hello", 42); - checkProperty(result, "__ok", 52); - shouldBe(JSON.stringify(Object.getOwnPropertyNames(result).sort()), `["__hello","__ok","hello","ok"]`); - shouldBe(helloCalled, 0); - shouldBe(okCalled, 1); -} -{ - let builtin = createBuiltin(`(function (obj) { - return @getByIdDirectPrivate(obj, "generatorState"); - })`); - function* hello() { } - let generator = hello(); - shouldBe(typeof builtin(generator), "number"); - let result = Object.assign({}, generator); - shouldBe(typeof builtin(result), "undefined"); -} -{ - let object = {}; - let setterCalledWithValue = null; - let result = Object.assign(object, { - get hello() { - Object.defineProperty(object, "added", { - get() { - return 42; - }, - set(value) { - setterCalledWithValue = value; - } - }); - return 0; - } - }, { - added: "world" - }); - shouldBe(result.added, 42); - shouldBe(result.hello, 0); - shouldBe(setterCalledWithValue, "world"); -} diff --git a/implementation-contributed/javascriptcore/stress/object-toString-with-proxy.js b/implementation-contributed/javascriptcore/stress/object-toString-with-proxy.js deleted file mode 100644 index 2351d6ee0a..0000000000 --- a/implementation-contributed/javascriptcore/stress/object-toString-with-proxy.js +++ /dev/null @@ -1,29 +0,0 @@ -var createProxy = $vm.createProxy; - -let foo = {}; -let properties = []; -let p = new Proxy(foo, { get:(target, property) => { - properties.push(property.toString()); - if (property === Symbol.toStringTag) - return "bad things"; - return target[property]; -}}); - -for (i = 0; i < 5; i++) { - if (p != "[object bad things]") - throw new Error("bad toString result."); - - if (properties[0] !== "Symbol(Symbol.toPrimitive)" || properties[1] !== "valueOf" || properties[2] !== "toString" || properties[3] !== "Symbol(Symbol.toStringTag)") - throw new Error("bad property accesses."); - - properties = []; -} - -p = createProxy(foo); - -for (i = 0; i < 5; i++) { - let str = "bad things" + i; - foo[Symbol.toStringTag] = str; - if (p != "[object " + str + "]") - throw new Error("bad toString result."); -} diff --git a/implementation-contributed/javascriptcore/stress/poly-proto-custom-value-and-accessor.js b/implementation-contributed/javascriptcore/stress/poly-proto-custom-value-and-accessor.js deleted file mode 100644 index c3c3c4034c..0000000000 --- a/implementation-contributed/javascriptcore/stress/poly-proto-custom-value-and-accessor.js +++ /dev/null @@ -1,95 +0,0 @@ -var createCustomTestGetterSetter = $vm.createCustomTestGetterSetter; - -function assert(b, m) { - if (!b) - throw new Error("Bad:" + m); -} - -function makePolyProtoObject() { - function foo() { - class C { - constructor() { this.field = 20; } - }; - return new C; - } - for (let i = 0; i < 15; ++i) { - assert(foo().field === 20); - } - return foo(); -} - -let items = [ - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), - makePolyProtoObject(), -]; - -let customGetterSetter = createCustomTestGetterSetter(); -items.forEach((x) => { - x.__proto__ = customGetterSetter; - assert(x.__proto__ === customGetterSetter); -}); - -function validate(x, valueResult, accessorResult) { - assert(x.customValue === valueResult); - - assert(x.customAccessor === accessorResult); - - let o = {}; - x.customValue = o; - assert(o.result === valueResult); - - o = {}; - x.customAccessor = o; - assert(o.result === accessorResult); - - assert(x.randomProp === 42 || x.randomProp === undefined); -} -noInline(validate); - - -let start = Date.now(); -for (let i = 0; i < 10000; ++i) { - for (let i = 0; i < items.length; ++i) { - validate(items[i], customGetterSetter, items[i]); - } -} - -customGetterSetter.randomProp = 42; - -for (let i = 0; i < 10000; ++i) { - for (let i = 0; i < items.length; ++i) { - validate(items[i], customGetterSetter, items[i]); - } -} - -items.forEach((x) => { - Reflect.setPrototypeOf(x, { - get customValue() { return 42; }, - get customAccessor() { return 22; }, - set customValue(x) { x.result = 42; }, - set customAccessor(x) { x.result = 22; }, - }); -}); - -for (let i = 0; i < 10000; ++i) { - for (let i = 0; i < items.length; ++i) { - validate(items[i], 42, 22); - } -} - -if (false) - print(Date.now() - start); diff --git a/implementation-contributed/javascriptcore/stress/proxy-inline-cache.js b/implementation-contributed/javascriptcore/stress/proxy-inline-cache.js deleted file mode 100644 index f3e9af6b41..0000000000 --- a/implementation-contributed/javascriptcore/stress/proxy-inline-cache.js +++ /dev/null @@ -1,76 +0,0 @@ -var createProxy = $vm.createProxy; - -var niters = 100000; - -// proxy -> target -> x -function cacheOnTarget() { - var target = {x:42}; - var proxy = createProxy(target); - - var getX = function(o) { return o.x; }; - noInline(getX); - - var sum = 0; - for (var i = 0; i < niters; ++i) - sum += getX(proxy); - - if (sum != 42 * niters) - throw new Error("Incorrect result"); -}; - -// proxy -> target -> proto -> x -function cacheOnPrototypeOfTarget() { - var proto = {x:42}; - var target = Object.create(proto); - var proxy = createProxy(target); - - var getX = function(o) { return o.x; }; - noInline(getX); - - var sum = 0; - for (var i = 0; i < niters; ++i) - sum += getX(proxy); - - if (sum != 42 * niters) - throw new Error("Incorrect result"); -}; - -// base -> proto (proxy) -> target -> x -function dontCacheOnProxyInPrototypeChain() { - var target = {x:42}; - var protoProxy = createProxy(target); - var base = Object.create(protoProxy); - - var getX = function(o) { return o.x; }; - noInline(getX); - - var sum = 0; - for (var i = 0; i < niters; ++i) - sum += getX(base); - - if (sum != 42 * niters) - throw new Error("Incorrect result"); -}; - -// proxy -> target 1 -> proto (proxy) -> target 2 -> x -function dontCacheOnTargetOfProxyInPrototypeChainOfTarget() { - var target2 = {x:42}; - var protoProxy = createProxy(target2); - var target1 = Object.create(protoProxy); - var proxy = createProxy(target1); - - var getX = function(o) { return o.x; }; - noInline(getX); - - var sum = 0; - for (var i = 0; i < niters; ++i) - sum += getX(proxy); - - if (sum != 42 * niters) - throw new Error("Incorrect result"); -}; - -cacheOnTarget(); -cacheOnPrototypeOfTarget(); -dontCacheOnProxyInPrototypeChain(); -dontCacheOnTargetOfProxyInPrototypeChainOfTarget(); diff --git a/implementation-contributed/javascriptcore/stress/put-by-id-direct.js b/implementation-contributed/javascriptcore/stress/put-by-id-direct.js deleted file mode 100644 index b5c06df7b1..0000000000 --- a/implementation-contributed/javascriptcore/stress/put-by-id-direct.js +++ /dev/null @@ -1,23 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -(function () { - var builtin = createBuiltin(`(function (obj, value) { - return @putByIdDirect(obj, "hello", value); - })`); - noInline(builtin); - - var setValue = null; - var object = { - __proto__: { - hello: 30 - } - }; - builtin(object, 42); - shouldBe(object.hello, 42); - shouldBe(object.hasOwnProperty("hello"), true); -}()); diff --git a/implementation-contributed/javascriptcore/stress/put-by-val-direct-out-of-bounds-setter.js b/implementation-contributed/javascriptcore/stress/put-by-val-direct-out-of-bounds-setter.js deleted file mode 100644 index 4e1401cd05..0000000000 --- a/implementation-contributed/javascriptcore/stress/put-by-val-direct-out-of-bounds-setter.js +++ /dev/null @@ -1,26 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var testInt32 = createBuiltin(`(function (array, index, value) { - @putByValDirect(array, index, value); -})`); -noInline(testInt32); - -Object.defineProperty(Array.prototype, 42, { - get() { - return 30; - }, - set(value) { - } -}); -for (var i = 0; i < 1e5; ++i) { - var array = [1, 2, 3, 4, 5]; - shouldBe(array[42], 30); - testInt32(array, 42, 42); - shouldBe(array[42], 42); - shouldBe(Array.prototype[42], 30); -} diff --git a/implementation-contributed/javascriptcore/stress/re-execute-error-module.js b/implementation-contributed/javascriptcore/stress/re-execute-error-module.js deleted file mode 100644 index 98a98babc9..0000000000 --- a/implementation-contributed/javascriptcore/stress/re-execute-error-module.js +++ /dev/null @@ -1,28 +0,0 @@ -var abort = $vm.abort; - -function shouldBe(actual, expected) -{ - if (actual !== expected) - throw new Error(`bad value: ${String(actual)}`); -} - -(async function () { - { - let errorMessage = null; - try { - await import("./resources/error-module.js"); - } catch (error) { - errorMessage = String(error); - } - shouldBe(errorMessage, `SyntaxError: Importing binding name 'x' is not found.`); - } - { - let errorMessage = null; - try { - await import("./resources/error-module.js"); - } catch (error) { - errorMessage = String(error); - } - shouldBe(errorMessage, `SyntaxError: Importing binding name 'x' is not found.`); - } -}()).catch(abort); diff --git a/implementation-contributed/javascriptcore/stress/regress-150532.js b/implementation-contributed/javascriptcore/stress/regress-150532.js deleted file mode 100644 index d8f6b28b2c..0000000000 --- a/implementation-contributed/javascriptcore/stress/regress-150532.js +++ /dev/null @@ -1,43 +0,0 @@ -// Makes sure we don't use base's tag register on 32-bit when an inline cache fails and jumps to the slow path -// because the slow path depends on the base being present. - -var createCustomGetterObject = $vm.createCustomGetterObject; - -function assert(b) { - if (!b) - throw new Error("baddd"); -} -noInline(assert); - -let customGetter = createCustomGetterObject(); -let otherObj = { - customGetter: 20 -}; -function randomFunction() {} -noInline(randomFunction); - -function foo(o, c) { - let baz = o.customGetter; - if (c) { - o = 42; - } - let jaz = o.foo; - let kaz = jaz + "hey"; - let raz = kaz + "hey"; - let result = o.customGetter; - randomFunction(!c, baz, jaz, kaz, raz); - return result; -} -noInline(foo); - -for (let i = 0; i < 10000; i++) { - switch (i % 2) { - case 0: - assert(foo(customGetter) === 100); - break; - case 1: - assert(foo(otherObj) === 20); - break; - } -} -assert(foo({hello: 20, world:50, customGetter: 40}) === 40); // Make sure we don't trample registers in "o.customGetter" inline cache failure in foo. diff --git a/implementation-contributed/javascriptcore/stress/regress-156992.js b/implementation-contributed/javascriptcore/stress/regress-156992.js deleted file mode 100644 index 1ceb6d9095..0000000000 --- a/implementation-contributed/javascriptcore/stress/regress-156992.js +++ /dev/null @@ -1,35 +0,0 @@ -// Verify that DFG TryGetById nodes properly save live registers. This test should not crash. - -var createBuiltin = $vm.createBuiltin; - -function tryMultipleGetByIds() { return '(function (base) { return @tryGetById(base, "value1") + @tryGetById(base, "value2") + @tryGetById(base, "value3"); })'; } - - -let get = createBuiltin(tryMultipleGetByIds()); -noInline(get); - -function test() { - let obj1 = { - value1: "Testing, ", - value2: "testing, ", - value3: "123", - expected: "Testing, testing, 123" - }; - let obj2 = { - extraFieldToMakeThisObjectDifferentThanObj1: 42, - value1: 20, - value2: 10, - value3: 12, - expected: 42 - }; - - let objects = [obj1, obj2]; - - for (let i = 0; i < 200000; i++) { - let obj = objects[i % 2]; - if (get(obj) !== obj.expected) - throw new Error("wrong on iteration: " + i); - } -} - -test(); diff --git a/implementation-contributed/javascriptcore/stress/regress-179619.js b/implementation-contributed/javascriptcore/stress/regress-179619.js deleted file mode 100644 index 78f1d4600e..0000000000 --- a/implementation-contributed/javascriptcore/stress/regress-179619.js +++ /dev/null @@ -1,67 +0,0 @@ -//@ runDefault - -var createBuiltin = $vm.createBuiltin; -var loadGetterFromGetterSetter = $vm.loadGetterFromGetterSetter; - -var exception; -var getter; - -try { - getter = loadGetterFromGetterSetter(); -} catch (e) { - exception = e; -} -if (exception != "TypeError: Invalid use of loadGetterFromGetterSetter test function: argument is not a GetterSetter") - throw "FAILED"; -if (getter) - throw "FAILED: unexpected result"; -exception = undefined; - -try { - getter = loadGetterFromGetterSetter(undefined); -} catch (e) { - exception = e; -} -if (exception != "TypeError: Invalid use of loadGetterFromGetterSetter test function: argument is not a GetterSetter") - throw "FAILED"; -if (getter) - throw "FAILED: unexpected result"; -exception = undefined; - -function tryGetByIdText(propertyName) { return `(function (base) { return @tryGetById(base, '${propertyName}'); })`; } -let getSetterGetter = createBuiltin(tryGetByIdText("bar")); - -try { - noGetterSetter = { }; - getter = loadGetterFromGetterSetter(getSetterGetter(noGetterSetter, "bar")); -} catch (e) { - exception = e; -} -if (exception != "TypeError: Invalid use of loadGetterFromGetterSetter test function: argument is not a GetterSetter") - throw "FAILED"; -if (getter) - throw "FAILED: unexpected result"; -exception = undefined; - -try { - hasGetter = { get bar() { return 22; } }; - getter = loadGetterFromGetterSetter(getSetterGetter(hasGetter, "bar")); -} catch (e) { - exception = e; -} -if (exception) - throw "FAILED: unexpected exception: " + exception; -if (!getter) - throw "FAILED: unable to get getter"; - -try { - // When a getter is not specified, a default getter should be assigned as long as there's also a setter. - hasSetter = { set bar(x) { return 22; } }; - getter = loadGetterFromGetterSetter(getSetterGetter(hasSetter, "bar")); -} catch (e) { - exception = e; -} -if (exception) - throw "FAILED: unexpected exception: " + exception; -if (!getter) - throw "FAILED: unexpected result"; diff --git a/implementation-contributed/javascriptcore/stress/regress-187211.js b/implementation-contributed/javascriptcore/stress/regress-187211.js deleted file mode 100644 index ebf002298b..0000000000 --- a/implementation-contributed/javascriptcore/stress/regress-187211.js +++ /dev/null @@ -1,80 +0,0 @@ -function assert(successCondition) { - if (!successCondition) { - $vm.print("FAILED at:"); - $vm.dumpStack(); - throw "FAIL"; - } -} - -function testNonStrict() { - let foo = function () { } - let bar = function () { } - let arrow = () => { } - let arrow2 = () => { } - let native = $vm.dataLog; - let native2 = $vm.print; - - // This test relies on invoking hasOwnProperty on a builtin first before invoking - // it on a regular function. So, the following order is important here. - assert(isNaN.hasOwnProperty("prototype") == false); - assert(foo.hasOwnProperty("prototype") == true); - assert(arrow.hasOwnProperty("prototype") == false); - assert(native.hasOwnProperty("prototype") == false); - - assert(isFinite.hasOwnProperty("prototype") == false); - assert(bar.hasOwnProperty("prototype") == true); - assert(arrow2.hasOwnProperty("prototype") == false); - assert(native2.hasOwnProperty("prototype") == false); - - // Repeat to exercise HasOwnPropertyCache. - assert(isNaN.hasOwnProperty("prototype") == false); - assert(foo.hasOwnProperty("prototype") == true); - assert(arrow.hasOwnProperty("prototype") == false); - assert(native.hasOwnProperty("prototype") == false); - - assert(isFinite.hasOwnProperty("prototype") == false); - assert(bar.hasOwnProperty("prototype") == true); - assert(arrow2.hasOwnProperty("prototype") == false); - assert(native2.hasOwnProperty("prototype") == false); -} -noInline(testNonStrict); - -function testStrict() { - "use strict"; - - let foo = function () { } - let bar = function () { } - let arrow = () => { } - let arrow2 = () => { } - let native = $vm.dataLog; - let native2 = $vm.print; - - // This test relies on invoking hasOwnProperty on a builtin first before invoking - // it on a regular function. So, the following order is important here. - assert(isNaN.hasOwnProperty("prototype") == false); - assert(foo.hasOwnProperty("prototype") == true); - assert(arrow.hasOwnProperty("prototype") == false); - assert(native.hasOwnProperty("prototype") == false); - - assert(isFinite.hasOwnProperty("prototype") == false); - assert(bar.hasOwnProperty("prototype") == true); - assert(arrow2.hasOwnProperty("prototype") == false); - assert(native2.hasOwnProperty("prototype") == false); - - // Repeat to exercise HasOwnPropertyCache. - assert(isNaN.hasOwnProperty("prototype") == false); - assert(foo.hasOwnProperty("prototype") == true); - assert(arrow.hasOwnProperty("prototype") == false); - assert(native.hasOwnProperty("prototype") == false); - - assert(isFinite.hasOwnProperty("prototype") == false); - assert(bar.hasOwnProperty("prototype") == true); - assert(arrow2.hasOwnProperty("prototype") == false); - assert(native2.hasOwnProperty("prototype") == false); -} -noInline(testStrict); - -for (var i = 0; i < 10000; ++i) { - testNonStrict(); - testStrict(); -} diff --git a/implementation-contributed/javascriptcore/stress/resources/shadow-chicken-support.js b/implementation-contributed/javascriptcore/stress/resources/shadow-chicken-support.js deleted file mode 100644 index d0b55848a1..0000000000 --- a/implementation-contributed/javascriptcore/stress/resources/shadow-chicken-support.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; - -var shadowChickenFunctionsOnStack = $vm.shadowChickenFunctionsOnStack; - -function describeFunction(f) -{ - var name; - try { - name = f.name; - } catch (e) {} - if (!name) - name = "<" + describe(f) + ">"; - return name; -} - -function describeArray(array) { - var result = "["; - for (var i = 0; i < array.length; ++i) { - if (i) - result += ", "; - result += describeFunction(array[i]); - } - return result + "]"; -} - -function compareStacks(stack, array) { - if (stack.length != array.length) - throw new Error("Bad stack length: " + describeArray(stack) + " (expected " + describeArray(array) + ")"); - for (var i = 0; i < stack.length; ++i) { - if (stack[i] != array[i]) - throw new Error("Bad stack at i = " + i + ": " + describeArray(stack) + " (expected " + describeArray(array) + ")"); - } -} - -function expectStack(array) { - var stack = shadowChickenFunctionsOnStack(); - if (verbose) - print("stack = " + describeArray(stack)); - var myTop = stack.pop(); - if (myTop != stackTop) - throw new Error("Bad stack top: " + myTop); - var myBottom = stack.shift(); - if (myBottom != shadowChickenFunctionsOnStack) - throw new Error("Bad stack bottom: " + myBottom); - myBottom = stack.shift(); - if (myBottom != expectStack) - throw new Error("Bad stack next-to-bottom: " + myBottom); - compareStacks(stack, array); -} - -var initialShadow; -var stackTop; - -function initialize() -{ - initialShadow = shadowChickenFunctionsOnStack(); - if (initialShadow.length != 3) - throw new Error("bad initial shadow length: " + initialShadow.length); - if (initialShadow[0] != shadowChickenFunctionsOnStack) - throw new Error("bad top of stack: " + describeFunction(initialShadow[0])); - if (initialShadow[1] != initialize) - throw new Error("bad middle of stack: " + describeFunction(initialShadow[1])); - stackTop = initialShadow[2]; - - expectStack([initialize]); -} - diff --git a/implementation-contributed/javascriptcore/stress/runtime-array.js b/implementation-contributed/javascriptcore/stress/runtime-array.js deleted file mode 100644 index 2372750098..0000000000 --- a/implementation-contributed/javascriptcore/stress/runtime-array.js +++ /dev/null @@ -1,15 +0,0 @@ -var createRuntimeArray = $vm.createRuntimeArray; - -function testArrayConcat() { - var array = createRuntimeArray(1, 2, 3); - var result = array.concat(); - - if (result.length != 3) - throw new Error("Runtime array length is incorrect"); - for (var i = 0; i < result.length; i++) { - if (result[i] != i + 1) - throw new Error("Runtime array concat result is incorrect"); - } -}; - -testArrayConcat(); diff --git a/implementation-contributed/javascriptcore/stress/sampling-profiler-microtasks.js b/implementation-contributed/javascriptcore/stress/sampling-profiler-microtasks.js deleted file mode 100644 index ce35d16ab1..0000000000 --- a/implementation-contributed/javascriptcore/stress/sampling-profiler-microtasks.js +++ /dev/null @@ -1,56 +0,0 @@ -var abort = $vm.abort; - -if (platformSupportsSamplingProfiler()) { - load("./sampling-profiler/samplingProfiler.js"); - - let tree = null; - function testResults() { - if (!tree) - tree = makeTree(); - else - updateCallingContextTree(tree); - - let result = doesTreeHaveStackTrace(tree, ["jar", "hello", "promiseReactionJob"], false); - return result; - } - - let o1 = {}; - let o2 = {}; - function jar(x) { - for (let i = 0; i < 1000; i++) { - o1[i] = i; - o2[i] = i + o1[i]; - i++; - i--; - } - return x; - } - noInline(jar) - - let numLoops = 0; - function loop() { - let counter = 0; - const numPromises = 100; - function jaz() { - Promise.resolve(42).then(function hello(v1) { - for (let i = 0; i < 100; i++) - jar(); - counter++; - if (counter >= numPromises) { - numLoops++; - if (!testResults()) { - if (numLoops > 5) - abort(); - else - loop(); - } - } - }); - } - - for (let i = 0; i < numPromises; i++) - jaz(); - } - - loop(); -} diff --git a/implementation-contributed/javascriptcore/stress/shadow-chicken-enabled.js b/implementation-contributed/javascriptcore/stress/shadow-chicken-enabled.js deleted file mode 100644 index 19cf73d040..0000000000 --- a/implementation-contributed/javascriptcore/stress/shadow-chicken-enabled.js +++ /dev/null @@ -1,210 +0,0 @@ -//@ runShadowChicken - -"use strict"; - -var shadowChickenFunctionsOnStack = $vm.shadowChickenFunctionsOnStack; - -var verbose = false; - -load("resources/shadow-chicken-support.js"); -initialize(); - -(function test1() { - function foo() { - expectStack([foo, bar, baz, test1]); - } - - function bar() { - return foo(); - } - - function baz() { - return bar(); - } - - baz(); -})(); - -(function test2() { - function foo() { - } - - function bar() { - return foo(); - } - - function baz() { - return bar(); - } - - baz(); -})(); - -(function test3() { - if (verbose) { - print("test3:"); - print("bob = " + describe(bob)); - print("thingy = " + describe(thingy)); - print("foo = " + describe(foo)); - print("bar = " + describe(bar)); - print("baz = " + describe(baz)); - } - - function bob() { - if (verbose) - print("Doing bob..."); - expectStack([bob, thingy, foo, bar, baz, test3]); - } - - function thingy() { - return bob(); - } - - function foo() { - if (verbose) - print("Doing foo..."); - expectStack([foo, bar, baz, test3]); - return thingy(); - } - - function bar() { - return foo(); - } - - function baz() { - return bar(); - } - - baz(); -})(); - -(function test4() { - if (verbose) { - print("test4:"); - print("bob = " + describe(bob)); - print("thingy = " + describe(thingy)); - print("foo = " + describe(foo)); - print("bar = " + describe(bar)); - print("baz = " + describe(baz)); - } - - function bob(thingyIsTail) { - if (verbose) - print("Doing bob..."); - expectStack([bob, thingy, foo, bar, baz, test4]); - } - - function thingy(isTail) { - bob(false); - return bob(isTail); - } - - function foo() { - if (verbose) - print("Doing foo..."); - expectStack([foo, bar, baz, test4]); - thingy(false); - return thingy(true); - } - - function bar() { - foo(); - return foo(); - } - - function baz() { - bar(); - return bar(); - } - - baz(); -})(); - -(function test5a() { - if (verbose) - print("In test5a:"); - var foos = 50; - - function foo(ttl) { - if (ttl <= 1) { - var array = []; - for (var i = 0; i < foos; ++i) - array.push(foo); - array.push(test5a); - expectStack(array); - return; - } - return foo(ttl - 1); - } - - foo(foos); -})(); - -(function test5b() { - if (verbose) - print("In test5b:"); - var foos = 100; - - function foo(ttl) { - if (ttl <= 1) { - var array = []; - for (var i = 0; i < foos; ++i) - array.push(foo); - array.push(test5b); - expectStack(array); - return; - } - return foo(ttl - 1); - } - - foo(foos); -})(); - -(function test6() { - if (verbose) { - print("In test6"); - print("foo = " + describe(foo)); - print("array.push = " + describe([].push)); - } - - var foos = 128; - - function foo(ttl) { - if (ttl <= 1) { - var array = []; - for (var i = 0; i < foos; ++i) - array.push(foo); - array.push(test6); - expectStack(array); - return; - } - return foo(ttl - 1); - } - - foo(foos); - - if (verbose) - print("Done with test6."); -})(); - -(function test7() { - var foos = 200000; - - function foo(ttl) { - if (ttl <= 1) { - var stack = shadowChickenFunctionsOnStack(); - var expectedStack = []; - expectedStack.push(shadowChickenFunctionsOnStack); - while (expectedStack.length < stack.length - 2) - expectedStack.push(foo); - expectedStack.push(test7); - expectedStack.push(stackTop); - compareStacks(stack, expectedStack); - return; - } - return foo(ttl - 1); - } - - foo(foos); -})(); - diff --git a/implementation-contributed/javascriptcore/stress/sparse-array-entry-update-144067.js b/implementation-contributed/javascriptcore/stress/sparse-array-entry-update-144067.js deleted file mode 100644 index 6802ee1721..0000000000 --- a/implementation-contributed/javascriptcore/stress/sparse-array-entry-update-144067.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2015 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// Regression test for https://bugs.webkit.org/show_bug.cgi?id=144067. -// This test aims to continually override the setter in a sparse array object, and -// trigger GCs to give it a chance to collect the newly set entry value if the bug exists. -// With the bug fixed, this test should not crash. - -var data = {}; -var sparseObj = {}; - -for (var i = 0; i < 5; i++) - sparseObj[i] = i; - -function useMemoryToTriggerGCs() { - var arr = []; - var limit = $vm.dfgTrue() ? 10000 : 100; - for (var i = 0; i < limit; i++) - arr[i] = { a: "using" + i, b: "up" + i, c: "memory" + i }; - return arr; -} - -function foo(x) { - if (!x) - return; - data.textContent = sparseObj.__defineSetter__("16384", foo); - for (var i = 0; i < 10; i++) - sparseObj.__defineSetter__("" + (16384 + i), foo); - useMemoryToTriggerGCs(); - sparseObj[16384] = x - 1; -} - -var recursionDepthNeededToTriggerTheFailure = 100; -foo(recursionDepthNeededToTriggerTheFailure); diff --git a/implementation-contributed/javascriptcore/stress/spread-correct-global-object-on-exception.js b/implementation-contributed/javascriptcore/stress/spread-correct-global-object-on-exception.js deleted file mode 100644 index dec8e71c54..0000000000 --- a/implementation-contributed/javascriptcore/stress/spread-correct-global-object-on-exception.js +++ /dev/null @@ -1,45 +0,0 @@ -var globalObjectForObject = $vm.globalObjectForObject; - -function assert(b) { - if (!b) - throw new Error("Bad assertion"); -} -function spread(a) { - return [...a]; -} -noInline(spread); - -const objectText = ` - let o = { - [Symbol.iterator]() { - return { - next() { - return {done: true}; - } - }; - } - }; - o; -`; - -let o = eval(objectText); -for (let i = 0; i < 1000; i++) { - if (i % 23 === 0) - o = eval(objectText); - spread(o); -} - -let myGlobalObject = globalObjectForObject(new Object); - -let secondGlobalObject = createGlobalObject(); -let o2 = secondGlobalObject.Function("return {};")(); - -let error = null; -try { - spread(o2); -} catch(e) { - error = e; -} - -assert(error); -assert(globalObjectForObject(error) === myGlobalObject); diff --git a/implementation-contributed/javascriptcore/stress/super-get-by-id.js b/implementation-contributed/javascriptcore/stress/super-get-by-id.js deleted file mode 100644 index 2097163d62..0000000000 --- a/implementation-contributed/javascriptcore/stress/super-get-by-id.js +++ /dev/null @@ -1,207 +0,0 @@ -"use strict"; - -var createCustomGetterObject = $vm.createCustomGetterObject; - -function assert(a) { - if (!a) - throw new Error("Bad!"); -} - -var Base = class Base { - constructor() { this._name = "Name"; } - get name() { return this._name; } // If this instead returns a static: return "Foo" things somewhat work. - set name(x) { this._name = x; } -}; - -var Subclass = class Subclass extends Base { - get name() { return super.name; } -}; - -function getterName(instance) { - return instance.name; -} - -noInline(getterName); - -function getterValue(instance) { - return instance.value; -} - -noInline(getterValue); - -const runTimes = 10000; - -// Base case -var instance = new Subclass; -for (let i = 0; i < runTimes; i++) - assert(getterName(instance) == "Name"); - -// Polymorphic case - -class PolymorphicSubclass { - get value() { return super.value; } -}; - -let numPolymorphicClasses = 4; -let subclasses = new Array(numPolymorphicClasses); -for (let i = 0; i < numPolymorphicClasses; i++) { - let BaseCode = ` - (class Base${i} { - get value() { return this._value; } - }); - `; - - let Base = eval(BaseCode); - subclasses[i] = new PolymorphicSubclass(); - subclasses[i]._value = i; - - Object.setPrototypeOf(subclasses[i], Base.prototype); -} - -for (let i = 0; i < runTimes; i++) { - let index = i % numPolymorphicClasses; - let value = getterValue(subclasses[index]); - assert(value == index); -} - -// Megamorphic case - -let nClasses = 1000; -class MegamorphicSubclass { - get value() { return super.value; } -}; - -subclasses = new Array(nClasses); -for (let i = 0; i < nClasses; i++) { - let BaseCode = ` - (class Base${i + 4} { - get value() { return this._value; } - }); - `; - - let Base = eval(BaseCode); - subclasses[i] = new MegamorphicSubclass(); - subclasses[i]._value = i; - - Object.setPrototypeOf(subclasses[i], Base.prototype); -} - -for (let i = 0; i < runTimes; i++) { - let index = i % nClasses; - let value = getterValue(subclasses[index]); - assert(value == index); -} - -// CustomGetter case - -let customGetter = createCustomGetterObject(); -Object.setPrototypeOf(customGetter, Object.prototype); - -let subObj = { - __proto__: customGetter, - get value () { - return super.customGetterAccessor; - } -} - -for (let i = 0; i < runTimes; i++) { - let value = getterValue(subObj); - assert(value == 100); -} - -subObj.shouldThrow = true; -for (let i = 0; i < runTimes; i++) { - try { - getterValue(subObj); - assert(false); - } catch(e) { - assert(e instanceof TypeError); - }; -} - -// CustomValue case - -customGetter = createCustomGetterObject(); -Object.setPrototypeOf(customGetter, Object.prototype); - -subObj = { - __proto__: customGetter, - get value () { - return super.customGetter; - } -} - -for (let i = 0; i < runTimes; i++) { - let value = getterValue(subObj); - assert(value == 100); -} - -subObj.shouldThrow = true; -for (let i = 0; i < runTimes; i++) { - let value = getterValue(subObj); - assert(value == 100); -} - -// Exception handling case - -class BaseException { - constructor() { this._name = "Name"; } - get name() { - if (this.shouldThrow) - throw new Error("Forced Exception"); - return this._name; - } -}; - -class SubclassException extends BaseException { - get name() { return super.name; } -}; - -let eObj = new SubclassException; -for (let i = 0; i < runTimes; i++) - assert(getterName(eObj) == "Name"); - -eObj.shouldThrow = true; -for (let i = 0; i < runTimes; i++) { - try { - getterValue(eObj); - assert(false); - } catch(e) { - eObj.shouldThrow = false; - assert(getterName(eObj) == "Name"); - }; -} - -// In getter exception handling - -class BaseExceptionComplex { - constructor() { this._name = "Name"; } - foo () { - if (this.shouldThrow) - throw new Error("Forced Exception"); - } - get name() { - this.foo(); - return this._name; - } -}; - -class SubclassExceptionComplex extends BaseExceptionComplex { - get name() { - try { - return super.name; - } catch(e) { - this.shouldThrow = false; - return super.name; - } - } -}; - -eObj = new SubclassExceptionComplex; -for (let i = 0; i < runTimes; i++) - assert(getterName(eObj) == "Name"); - -eObj.shouldThrow = true; -for (let i = 0; i < runTimes; i++) - assert(getterName(eObj) == "Name"); - diff --git a/implementation-contributed/javascriptcore/stress/tailCallForwardArguments.js b/implementation-contributed/javascriptcore/stress/tailCallForwardArguments.js deleted file mode 100644 index f654f7298c..0000000000 --- a/implementation-contributed/javascriptcore/stress/tailCallForwardArguments.js +++ /dev/null @@ -1,163 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -// This is pretty bad but I need a private name. -var putFuncToPrivateName = createBuiltin(`(function (func) { @arrayIteratorIsDone = func })`) -putFuncToPrivateName(function (a,b) { return b; }) - -function createTailCallForwardingFuncWith(body, thisValue) { - return createBuiltin(`(function (a) { - "use strict"; - - ${body} - - return @tailCallForwardArguments(@arrayIteratorIsDone, ${thisValue}); - })`); -} - -var foo = createTailCallForwardingFuncWith("", "@undefined"); - -function baz() { - return foo.call(true, 7); -} -noInline(baz); - - - -var fooNoInline = createTailCallForwardingFuncWith("", "@undefined"); -noInline(foo); - -for (let i = 0; i < 100000; i++) { - if (baz.call() !== undefined) - throw new Error(i); - if (fooNoInline.call(undefined, 3) !== undefined) - throw new Error(i); -} - -putFuncToPrivateName(function () { "use strict"; return { thisValue: this, argumentsValue: arguments}; }); -var foo2 = createTailCallForwardingFuncWith("", "this"); -var fooNI2 = createTailCallForwardingFuncWith("", "this"); -noInline(fooNI2); - -function baz2() { - return foo2.call(true, 7); -} -noInline(baz2); - -for (let i = 0; i < 100000; i++) { - let result = foo2.call(true, 7); - if (result.thisValue !== true || result.argumentsValue.length !== 1 || result.argumentsValue[0] !== 7) - throw new Error(i); - result = baz2.call(); - if (result.thisValue !== true || result.argumentsValue.length !== 1 || result.argumentsValue[0] !== 7) - throw new Error(i); - result = fooNI2.call(true, 7); - if (result.thisValue !== true || result.argumentsValue.length !== 1 || result.argumentsValue[0] !== 7) - throw new Error(i); -} - -putFuncToPrivateName(function () { "use strict"; return this; }); -var foo3 = createTailCallForwardingFuncWith("", "{ thisValue: this, otherValue: 'hello'} "); -var fooNI3 = createTailCallForwardingFuncWith("", "{ thisValue: this, otherValue: 'hello'} "); -noInline(fooNI3); -function baz3() { - return foo3.call(true, 7); -} -noInline(baz3); - -for (let i = 0; i < 100000; i++) { - let result = foo3.call(true, 7); - if (result.thisValue !== true) - throw new Error(i); - result = baz3.call(); - if (result.thisValue !== true) - throw new Error(i); - result = fooNI3.call(true, 7); - if (result.thisValue !== true) - throw new Error(i); -} - - -putFuncToPrivateName(function () { "use strict"; return this; }); -let bodyText = ` -for (let i = 0; i < 100; i++) { - if (a + i === 100) - return a; -} -`; -var foo4 = createTailCallForwardingFuncWith(bodyText, "{ thisValue: this, otherValue: 'hello'} "); -var fooNI4 = createTailCallForwardingFuncWith(bodyText, "{ thisValue: this, otherValue: 'hello'} "); -noInline(fooNI4); -function baz4() { - return foo4.call(true, 0); -} -noInline(baz4); - -for (let i = 0; i < 100000; i++) { - let result = foo4.call(true, 0); - if (result.thisValue !== true || result.otherValue !== "hello") - throw new Error(i); - result = baz4.call(); - if (result.thisValue !== true || result.otherValue !== "hello") - throw new Error(i); - result = fooNI4.call(true, 0); - if (result.thisValue !== true || result.otherValue !== "hello") - throw new Error(i); - result = fooNI4.call(true, 1); - if (result !== 1) - throw new Error(i); - result = fooNI4.call(true, ""); - if (result.thisValue !== true || result.otherValue !== "hello") - throw new Error(i); -} - -var testFunc = function () { "use strict"; return this; } -noInline(testFunc); -putFuncToPrivateName(testFunc); - -var foo5 = createTailCallForwardingFuncWith(bodyText, "{ thisValue: this, otherValue: 'hello'} "); -var fooNI5 = createTailCallForwardingFuncWith(bodyText, "{ thisValue: this, otherValue: 'hello'} "); -noInline(fooNI5); -function baz5() { - return foo5.call(true, 0); -} -noInline(baz5); - -for (let i = 0; i < 100000; i++) { - let result = foo5.call(true, 0); - if (result.thisValue !== true || result.otherValue !== "hello") - throw new Error(i); - result = baz5.call(); - if (result.thisValue !== true || result.otherValue !== "hello") - throw new Error(i); - result = fooNI5.call(true, 0); - if (result.thisValue !== true || result.otherValue !== "hello") - throw new Error(i); - result = fooNI5.call(true, 1); - if (result !== 1) - throw new Error(i); - result = fooNI5.call(true, ""); - if (result.thisValue !== true || result.otherValue !== "hello") - throw new Error(i); -} - -putFuncToPrivateName(function() { return arguments; }); -var foo6 = createTailCallForwardingFuncWith(bodyText, "{ thisValue: this, otherValue: 'hello'} "); -function baz6() { - "use strict" - return foo6.apply(this, arguments); -} -noInline(baz6); - -function arrayEq(a, b) { - if (a.length !== b.length) - throw new Error(); - for (let i = 0; i < a.length; i++) { - if (a[i] !== b[i]) - throw new Error(); - } -} -let args = ["a", {}, [], Symbol(), 1, 1.234, undefined, null]; -for (let i = 0; i < 100000; i++) { - let result = baz6.apply(undefined, args); - arrayEq(result, args); -} diff --git a/implementation-contributed/javascriptcore/stress/test-spec-misc.js b/implementation-contributed/javascriptcore/stress/test-spec-misc.js deleted file mode 100644 index 4194b0c9c6..0000000000 --- a/implementation-contributed/javascriptcore/stress/test-spec-misc.js +++ /dev/null @@ -1,43 +0,0 @@ -var a = [ "String", false, 42 ]; -var count = 0; - -function getX(fromDFG) { - if (fromDFG) - return 42; - return false; -} - -noInline(getX); - -function foo(index) { - var result = false; - var x = getX($vm.dfgTrue()); - - x * 2; - - var y = a[index % a.length]; - result = y === x; - count += 1; - return result; -} - -noInline(foo); - -var loopCount = 10000; - -function bar() { - var result; - - for (var i = 0; i < loopCount - 1; i++) - result = foo(i) - - result = foo(0); - - return result; -} - -var result = bar(); -if (result != false) - throw "Error: bad result expected false: " + result; -if (count != loopCount) - throw "Error: bad count, expected: " + loopCount + ", got: " + count; diff --git a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-boolean-edge.js b/implementation-contributed/javascriptcore/stress/to-object-intrinsic-boolean-edge.js deleted file mode 100644 index 3f2ebb15f7..0000000000 --- a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-boolean-edge.js +++ /dev/null @@ -1,19 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (target) { - return @toObject(target, ""); -})`); -noInline(builtin); - -(function () { - for (var i = 0; i < 1e4; ++i) { - var object = builtin(true); - shouldBe(object instanceof Boolean, true); - shouldBe(object.valueOf(), true); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-null-or-undefined-edge.js b/implementation-contributed/javascriptcore/stress/to-object-intrinsic-null-or-undefined-edge.js deleted file mode 100644 index c2fb990f3a..0000000000 --- a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-null-or-undefined-edge.js +++ /dev/null @@ -1,36 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldThrow(func, errorMessage) { - var errorThrown = false; - var error = null; - try { - func(); - } catch (e) { - errorThrown = true; - error = e; - } - if (!errorThrown) - throw new Error('not thrown'); - if (String(error) !== errorMessage) - throw new Error(`bad error: ${String(error)}`); -} - -(function () { - var builtin = createBuiltin(`(function (target) { - return @toObject(target, ""); - })`); - noInline(builtin); - - for (var i = 0; i < 1e4; ++i) - shouldThrow(() => builtin(null), `TypeError: null is not an object`); -}()); - -(function () { - var builtin = createBuiltin(`(function (target) { - return @toObject(target, ""); - })`); - noInline(builtin); - - for (var i = 0; i < 1e4; ++i) - shouldThrow(() => builtin(undefined), `TypeError: undefined is not an object`); -}()); diff --git a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-number-edge.js b/implementation-contributed/javascriptcore/stress/to-object-intrinsic-number-edge.js deleted file mode 100644 index 73b0b50f87..0000000000 --- a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-number-edge.js +++ /dev/null @@ -1,23 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (target) { - return @toObject(target, ""); -})`); -noInline(builtin); - -(function () { - for (var i = 0; i < 1e4; ++i) { - var object = builtin(42); - shouldBe(object instanceof Number, true); - shouldBe(object.valueOf(), 42); - - var object = builtin(42.195); - shouldBe(object instanceof Number, true); - shouldBe(object.valueOf(), 42.195); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-object-edge.js b/implementation-contributed/javascriptcore/stress/to-object-intrinsic-object-edge.js deleted file mode 100644 index 7eacd172cc..0000000000 --- a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-object-edge.js +++ /dev/null @@ -1,27 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (target) { - return @toObject(target, ""); -})`); -noInline(builtin); - -(function () { - for (var i = 0; i < 1e4; ++i) { - var arg = {}; - var object = builtin(arg); - shouldBe(object, arg); - - var arg = []; - var object = builtin(arg); - shouldBe(object, arg); - - var arg = function () { }; - var object = builtin(arg); - shouldBe(object, arg); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-string-edge.js b/implementation-contributed/javascriptcore/stress/to-object-intrinsic-string-edge.js deleted file mode 100644 index 738d1ba6bc..0000000000 --- a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-string-edge.js +++ /dev/null @@ -1,19 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (target) { - return @toObject(target, ""); -})`); -noInline(builtin); - -(function () { - for (var i = 0; i < 1e4; ++i) { - var object = builtin("Cocoa"); - shouldBe(object instanceof String, true); - shouldBe(object.valueOf(), "Cocoa"); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-symbol-edge.js b/implementation-contributed/javascriptcore/stress/to-object-intrinsic-symbol-edge.js deleted file mode 100644 index 33a13a8a23..0000000000 --- a/implementation-contributed/javascriptcore/stress/to-object-intrinsic-symbol-edge.js +++ /dev/null @@ -1,19 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -var builtin = createBuiltin(`(function (target) { - return @toObject(target, ""); -})`); -noInline(builtin); - -(function () { - for (var i = 0; i < 1e4; ++i) { - var object = builtin(Symbol("Cocoa")); - shouldBe(object instanceof Symbol, true); - shouldBe(String(object.valueOf()), `Symbol(Cocoa)`); - } -}()); diff --git a/implementation-contributed/javascriptcore/stress/to-object-intrinsic.js b/implementation-contributed/javascriptcore/stress/to-object-intrinsic.js deleted file mode 100644 index 3b5fb3a877..0000000000 --- a/implementation-contributed/javascriptcore/stress/to-object-intrinsic.js +++ /dev/null @@ -1,53 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -function shouldBe(actual, expected) { - if (actual !== expected) - throw new Error('bad value: ' + actual); -} - -function shouldThrow(func, errorMessage) { - var errorThrown = false; - var error = null; - try { - func(); - } catch (e) { - errorThrown = true; - error = e; - } - if (!errorThrown) - throw new Error('not thrown'); - if (String(error) !== errorMessage) - throw new Error(`bad error: ${String(error)}`); -} - -var builtin = createBuiltin(`(function (target) { - return @toObject(target, ""); -})`); -noInline(builtin); - -(function () { - for (var i = 0; i < 1e4; ++i) { - shouldThrow(() => builtin(null), `TypeError: null is not an object`); - shouldThrow(() => builtin(undefined), `TypeError: undefined is not an object`); - var object = builtin(42); - shouldBe(object instanceof Number, true); - shouldBe(object.valueOf(), 42); - - var object = builtin("Cocoa"); - shouldBe(object instanceof String, true); - shouldBe(object.valueOf(), "Cocoa"); - - var object = builtin(true); - shouldBe(object instanceof Boolean, true); - shouldBe(object.valueOf(), true); - - var object = builtin(Symbol("Cocoa")); - shouldBe(object instanceof Symbol, true); - shouldBe(String(object.valueOf()), `Symbol(Cocoa)`); - - var arg = {}; - var object = builtin(arg); - shouldBe(object, arg); - } -}()); - diff --git a/implementation-contributed/javascriptcore/stress/tricky-array-bounds-checks.js b/implementation-contributed/javascriptcore/stress/tricky-array-bounds-checks.js deleted file mode 100644 index 699f350b63..0000000000 --- a/implementation-contributed/javascriptcore/stress/tricky-array-bounds-checks.js +++ /dev/null @@ -1,28 +0,0 @@ -function foo(a, i, p) { - if (p || !$vm.dfgTrue()) - return [$vm.dfgTrue(), a[(i - ($vm.dfgTrue() ? 2147483646 : 0)) | 0], a[i], a[(i + ($vm.dfgTrue() ? 2147483646 : 0)) | 0], $vm.dfgTrue()]; - return [12]; -} - -noInline(foo); - -function arraycmp(a, b) { - if (a.length != b.length) - return false; - for (var i = 0; i < a.length; ++i) { - if (a[i] != b[i]) - return false; - } - return true; -} - -for (var i = 0; i < 100000; ++i) { - var result = foo([42], 0, false); - if (!arraycmp(result, [false, 42, 42, 42, false]) && !arraycmp(result, [12])) - throw "Error: bad result for i = " + i + ": " + result; -} - -var result = foo([1, 2, 3, 4, 5], -2147483646, true); -if (!arraycmp(result, [true, 5, void 0, void 0, false]) - && !arraycmp(result, [false, void 0, void 0, void 0, false])) - throw "Error: bad result for trick: " + result; diff --git a/implementation-contributed/javascriptcore/stress/try-catch-custom-getter-as-get-by-id.js b/implementation-contributed/javascriptcore/stress/try-catch-custom-getter-as-get-by-id.js deleted file mode 100644 index fe7d5c4c7a..0000000000 --- a/implementation-contributed/javascriptcore/stress/try-catch-custom-getter-as-get-by-id.js +++ /dev/null @@ -1,55 +0,0 @@ -var createCustomGetterObject = $vm.createCustomGetterObject; - -function assert(b) { - if (!b) throw new Error("b"); -} -noInline(assert); - -let i; -var o1 = createCustomGetterObject(); -o1.shouldThrow = false; - -var o2 = { - customGetter: 40 -} - -var o3 = { - x: 100, - customGetter: 50 -} - -i = -1000; -bar(i); -foo(i); -function bar(i) { - if (i === -1000) - return o1; - - if (i % 2) - return o3; - else - return o2; -} -noInline(bar); - -function foo(i) { - var o = bar(i); - var v; - try { - v = o.customGetter; - } catch(e) { - assert(o === o1); - } -} -noInline(foo); - -foo(i); -for (i = 0; i < 1000; i++) - foo(i); - -i = -1000; -for (let j = 0; j < 1000; j++) { - if (j > 10) - o1.shouldThrow = true; - foo(i); -} diff --git a/implementation-contributed/javascriptcore/stress/try-get-by-id-poly-proto.js b/implementation-contributed/javascriptcore/stress/try-get-by-id-poly-proto.js deleted file mode 100644 index d73ef37e7c..0000000000 --- a/implementation-contributed/javascriptcore/stress/try-get-by-id-poly-proto.js +++ /dev/null @@ -1,41 +0,0 @@ -var createBuiltin = $vm.createBuiltin; -var loadGetterFromGetterSetter = $vm.loadGetterFromGetterSetter; - -function assert(b, m) { - if (!b) - throw new Error("Bad:" + m); -} - -function makePolyProtoObject() { - function foo() { - class C { - constructor() { this._field = 42; } - }; - return new C; - } - for (let i = 0; i < 15; ++i) - foo(); - return foo(); -} - -function tryGetByIdText(propertyName) { return `(function (base) { return @tryGetById(base, '${propertyName}'); })`; } -let getFoo = createBuiltin(tryGetByIdText("foo")); -let getBar = createBuiltin(tryGetByIdText("bar")); -let getNonExistentField = createBuiltin(tryGetByIdText("nonExistentField")); - -let x = makePolyProtoObject(); -x.__proto__ = { foo: 42, get bar() { return 22; } }; -let barGetter = Object.getOwnPropertyDescriptor(x.__proto__, "bar").get; -assert(typeof barGetter === "function"); -assert(barGetter() === 22); - -function validate(x) { - assert(getFoo(x) === 42); - assert(loadGetterFromGetterSetter(getBar(x)) === barGetter); - assert(getNonExistentField(x) === undefined); -} -noInline(validate); - -for (let i = 0; i < 1000; ++i) { - validate(x); -} diff --git a/implementation-contributed/javascriptcore/stress/try-get-by-id-should-spill-registers-dfg.js b/implementation-contributed/javascriptcore/stress/try-get-by-id-should-spill-registers-dfg.js deleted file mode 100644 index 22507c1572..0000000000 --- a/implementation-contributed/javascriptcore/stress/try-get-by-id-should-spill-registers-dfg.js +++ /dev/null @@ -1,12 +0,0 @@ -var createBuiltin = $vm.createBuiltin; - -let f = createBuiltin(`(function (arg) { - let r = @tryGetById(arg, "prototype"); - if (arg !== true) throw new @Error("Bad clobber of arg"); - return r; -})`); -noInline(f); - -for (let i = 0; i < 10000; i++) { - f(true); -} diff --git a/implementation-contributed/javascriptcore/stress/try-get-by-id.js b/implementation-contributed/javascriptcore/stress/try-get-by-id.js deleted file mode 100644 index 5407eec169..0000000000 --- a/implementation-contributed/javascriptcore/stress/try-get-by-id.js +++ /dev/null @@ -1,175 +0,0 @@ -var createBuiltin = $vm.createBuiltin; -var getGetterSetter = $vm.getGetterSetter; - -function tryGetByIdText(propertyName) { return `(function (base) { return @tryGetById(base, '${propertyName}'); })`; } - -function tryGetByIdTextStrict(propertyName) { return `(function (base) { "use strict"; return @tryGetById(base, '${propertyName}'); })`; } - -// Test get value off object. -{ - let get = createBuiltin(tryGetByIdText("caller")); - noInline(get); - let getStrict = createBuiltin(tryGetByIdTextStrict("caller")); - noInline(getStrict); - - let obj = {caller: 1}; - - for (let i = 0; i < 100000; i++) { - if (get(obj) !== 1) - throw new Error("wrong on iteration: " + i); - if (getStrict(obj) !== 1) - throw new Error("wrong on iteration: " + i); - } -} - -// Test slot is custom function trap for a value. -{ - let get = createBuiltin(tryGetByIdText("caller")); - noInline(get); - let getStrict = createBuiltin(tryGetByIdTextStrict("caller")); - noInline(getStrict); - - let func = function () {}; - - for (let i = 0; i < 100000; i++) { - if (get(func) !== null) - throw new Error("wrong on iteration: " + i); - if (getStrict(func) !== null) - throw new Error("wrong on iteration: " + i); - } -} - -// Test slot is a GetterSetter. -{ - let get = createBuiltin(tryGetByIdText("getterSetter")); - noInline(get); - let getStrict = createBuiltin(tryGetByIdTextStrict("getterSetter")); - noInline(getStrict); - - let obj = {}; - Object.defineProperty(obj, "getterSetter", { get: function () { throw new Error("should not be called"); } }); - - for (let i = 0; i < 100000; i++) { - if (get(obj) !== getGetterSetter(obj, "getterSetter")) - throw new Error("wrong on iteration: " + i); - if (getStrict(obj) !== getGetterSetter(obj, "getterSetter")) - throw new Error("wrong on iteration: " + i); - } -} - -// Test slot is unset. -{ - let get = createBuiltin(tryGetByIdText("getterSetter")); - noInline(get); - let getStrict = createBuiltin(tryGetByIdTextStrict("getterSetter")); - noInline(getStrict); - - let obj = {}; - - for (let i = 0; i < 100000; i++) { - if (get(obj) !== undefined) - throw new Error("wrong on iteration: " + i); - if (getStrict(obj) !== undefined) - throw new Error("wrong on iteration: " + i); - } -} - -// Test slot is on a proxy with value. -{ - let get = createBuiltin(tryGetByIdText("value")); - noInline(get); - let getStrict = createBuiltin(tryGetByIdTextStrict("value")); - noInline(getStrict); - - let obj = {value: 1}; - let p = new Proxy(obj, { get: function() { throw new Error("should not be called"); } }); - - for (let i = 0; i < 100000; i++) { - if (get(p) !== null) - throw new Error("wrong on iteration: " + i); - if (getStrict(p) !== null) - throw new Error("wrong on iteration: " + i); - } -} - -// Test mutating inline cache. -{ - let get = createBuiltin(tryGetByIdText("caller")); - noInline(get); - let getStrict = createBuiltin(tryGetByIdTextStrict("caller")); - noInline(getStrict); - - let obj = {caller : 1}; - let func = function() {}; - - for (let i = 0; i < 100000; i++) { - if (i % 100 === 0) { - if (get(func) !== null) - throw new Error("wrong on iteration: " + i); - if (getStrict(func) !== null) - throw new Error("wrong on iteration: " + i); - } else { - if (get(obj) !== 1) - throw new Error("wrong on iteration: " + i); - if (getStrict(obj) !== 1) - throw new Error("wrong on iteration: " + i); - } - } -} - -// Test new type on each iteration. -{ - let get = createBuiltin(tryGetByIdText("caller")); - noInline(get); - let getStrict = createBuiltin(tryGetByIdTextStrict("caller")); - noInline(getStrict); - - let func = function() {}; - - for (let i = 0; i < 100000; i++) { - if (i % 100 === 0) { - if (get(func) !== null) - throw new Error("wrong on iteration: " + i); - if (getStrict(func) !== null) - throw new Error("wrong on iteration: " + i); - } else { - let obj = {caller : 1}; - if (get(obj) !== 1) - throw new Error("wrong on iteration: " + i); - if (getStrict(obj) !== 1) - throw new Error("wrong on iteration: " + i); - } - } -} - -// Test with array length. This is null because the value is not cacheable. -{ - let get = createBuiltin(tryGetByIdText("length")); - noInline(get); - let getStrict = createBuiltin(tryGetByIdTextStrict("length")); - noInline(getStrict); - - let arr = []; - - for (let i = 0; i < 100000; i++) { - if (get(arr) !== null) - throw new Error("wrong on iteration: " + i); - if (getStrict(arr) !== null) - throw new Error("wrong on iteration: " + i); - } -} - -// Test with non-object. -{ - let get = createBuiltin(tryGetByIdText("length")); - noInline(get); - let getStrict = createBuiltin(tryGetByIdTextStrict("length")); - noInline(getStrict); - - for (let i = 0; i < 100000; i++) { - if (get(1) !== undefined) - throw new Error("wrong on iteration: " + i); - if (getStrict(1) !== undefined) - throw new Error("wrong on iteration: " + i); - } -} diff --git a/implementation-contributed/javascriptcore/typeProfiler/arrow-functions.js b/implementation-contributed/javascriptcore/typeProfiler/arrow-functions.js deleted file mode 100644 index 50905cf8b6..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/arrow-functions.js +++ /dev/null @@ -1,42 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; -var returnTypeFor = $vm.returnTypeFor; - -load("./driver/driver.js"); - -let foo = (x) => x; -let bar = abc => abc; -let baz = abc => { return abc; }; -let jaz = abc => { }; - -function wrapper(b) { - let baz = (x) => x; - baz(b); - - let foo = yyy => yyy; - foo(b); -} - -// ====== End test cases ====== - -foo(20); -var types = returnTypeFor(foo); -assert(types.globalTypeSet.displayTypeName === T.Integer, "Function 'foo' should return 'Integer'"); - -bar("hello"); -types = returnTypeFor(bar); -assert(types.globalTypeSet.displayTypeName === T.String, "Function 'bar' should return 'String'"); - -baz("hello"); -types = returnTypeFor(baz); -assert(types.globalTypeSet.displayTypeName === T.String, "Function 'baz' should return 'String'"); - -jaz("hello"); -types = returnTypeFor(jaz); -assert(types.globalTypeSet.displayTypeName === T.Undefined, "Function 'jaz' should return 'Undefined'"); - -wrapper("hello"); -types = findTypeForExpression(wrapper, "x)"); -assert(types.instructionTypeSet.displayTypeName === T.String, "Parameter 'x' should be 'String'"); - -types = findTypeForExpression(wrapper, "yyy =>"); -assert(types.instructionTypeSet.displayTypeName === T.String, "Parameter 'yyy' should be 'String'"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/basic.js b/implementation-contributed/javascriptcore/typeProfiler/basic.js deleted file mode 100644 index 378e0a4201..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/basic.js +++ /dev/null @@ -1,44 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -function wrapper() { - -function foo(bar){} -foo(20); -foo(20.5); - -var test = {x:20, y:50}; -test = "hello"; - -} -wrapper(); - -// ====== End test cases ====== - -var types = findTypeForExpression(wrapper, "bar)"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Number) !== -1, "Primitive type names should contain 'Number'"); -assert(types.instructionTypeSet.displayTypeName === T.Number , "Primitive type names display name should be 'Number'"); - -types = findTypeForExpression(wrapper, "test = {"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Variable 'test' should have been type 'String' globally"); -assert(types.instructionTypeSet.structures.length === 1, "Variable 'test' should have one structure"); -assert(types.instructionTypeSet.structures[0].constructorName === "Object", "variable 'test'") -assert(types.instructionTypeSet.structures[0].proto.constructorName === "Object", "Variable 'test' shouldn't have a prototype"); -assert(types.instructionTypeSet.structures[0].proto.proto === null, "Variable 'test' shouldn't have a prototype"); -assert(types.instructionTypeSet.structures[0].constructorName === "Object", "variable 'test' should have constructor name 'Object'") -assert(types.globalTypeSet.displayTypeName === "Object", "Variable 'test' global type name should display as 'Object'"); -assert(types.instructionTypeSet.structures[0].fields.length === 2, "variable 'test' should have two fields: x,y"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("x") !== -1, "variable 'test' should have field 'x'"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("y") !== -1, "variable 'test' should have field 'y'"); - -types = findTypeForExpression(wrapper, "test = \"h"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Variable 'test' should have been type 'String' globally"); -assert(types.instructionTypeSet.displayTypeName === T.String, "Variable 'test' should have been display type 'String' at this instruction"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Variable 'test' should have been type 'String' globally"); -assert(types.instructionTypeSet.structures.length === 0, "Variable 'test' at this instruction shouldn't have a structure."); -assert(types.globalTypeSet.structures.length === 1, "Variable 'test' should still have one structure"); -assert(types.globalTypeSet.structures[0].fields.indexOf("x") !== -1, "variable 'test' should have field 'x' globally"); -assert(types.globalTypeSet.structures[0].fields.indexOf("y") !== -1, "variable 'test' should have field 'y' globally"); - diff --git a/implementation-contributed/javascriptcore/typeProfiler/captured.js b/implementation-contributed/javascriptcore/typeProfiler/captured.js deleted file mode 100644 index 656003477b..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/captured.js +++ /dev/null @@ -1,34 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -var changeFoo; -function wrapper() { - -var foo=20; -changeFoo = function(arg) { foo = arg; } - -} -wrapper(); - -// ====== End test cases ====== - -var types = findTypeForExpression(wrapper, "foo=20;"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -assert(types.globalTypeSet.primitiveTypeNames.length === 1, "Primitive type names should contain exactly only one item globally"); -assert(types.instructionTypeSet.primitiveTypeNames.length === 1, "Primitive type names should contain exactly only one item on the instruction"); -assert(types.globalTypeSet.displayTypeName === T.Integer, "global display name should be Integer"); -assert(types.instructionTypeSet.displayTypeName === T.Integer, "instruction display name should be Integer"); - -changeFoo(20.5); -types = findTypeForExpression(wrapper, "foo=20;"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -assert(types.instructionTypeSet.primitiveTypeNames.length === 1, "Primitive type names should contain STILL only contain exactly one item on the instruction"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Global primitive type names should now still contain 'Integer'"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Number) !== -1, "Global primitive type names should now contain 'Number'"); -assert(types.globalTypeSet.primitiveTypeNames.length === 2, "Global primitive type names should contain exactly two items globally"); -assert(types.globalTypeSet.displayTypeName === T.Number, "global display name should be Number"); - -changeFoo(null); - diff --git a/implementation-contributed/javascriptcore/typeProfiler/classes.js b/implementation-contributed/javascriptcore/typeProfiler/classes.js deleted file mode 100644 index 52ac8b022d..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/classes.js +++ /dev/null @@ -1,31 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -function wrapper() { - -class Base { constructor() { this._base = true; } }; -class Derived extends Base { constructor() { super(); this._derived = true; } }; - -var baseInstance = new Base; -var derivedInstance = new Derived; - -} -wrapper(); - -// ====== End test cases ====== - -var types = findTypeForExpression(wrapper, "baseInstance = new Base"); -assert(types.globalTypeSet.displayTypeName === "Base", "variable 'baseInstance' should have displayTypeName 'Base'"); -assert(types.instructionTypeSet.displayTypeName === "Base", "variable 'baseInstance' should have displayTypeName 'Base'"); -assert(types.instructionTypeSet.structures.length === 1, "Variable 'baseInstance' should have one structure"); -assert(types.instructionTypeSet.structures[0].fields.length === 1, "variable 'baseInstance' should have one field: _base"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("_base") !== -1, "variable 'baseInstance' should have field '_base'"); - -types = findTypeForExpression(wrapper, "derivedInstance = new Derived"); -assert(types.globalTypeSet.displayTypeName === "Derived", "variable 'derivedInstance' should have displayTypeName 'Derived'"); -assert(types.instructionTypeSet.displayTypeName === "Derived", "variable 'derivedInstance' should have displayTypeName 'Derived'"); -assert(types.instructionTypeSet.structures.length === 1, "Variable 'derivedInstance' should have one structure"); -assert(types.instructionTypeSet.structures[0].fields.length === 2, "variable 'derivedInstance' should have one field: _base,_derived"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("_base") !== -1, "variable 'derivedInstance' should have field '_base'"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("_derived") !== -1, "variable 'derivedInstance' should have field '_derived'"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/dfg-jit-optimizations.js b/implementation-contributed/javascriptcore/typeProfiler/dfg-jit-optimizations.js deleted file mode 100644 index 7e1b1aaa75..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/dfg-jit-optimizations.js +++ /dev/null @@ -1,54 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -function tierUpToDFG(func, arg) -{ - for (var i = 0; i < 1000; i++) - func(arg); -} - -var types = [T.Boolean, T.Integer, T.Null, T.Number, T.String, T.Undefined]; -var values = [true, 1, null, 1.1, "hello", undefined]; -var funcs = [function(x) { return x; }, function(x) { return x; }, function(x) { return x; }, - function(x) { return x; }, function(x) { return x; }, function(x) { return x; }] - -assert(types.length === values.length && values.length === funcs.length); - -// Make sure baseline DFG type check optimizations work. -// Tier up each function on a different type, then call it with all other primitive types to make sure they're recorded. -for (var i = 0; i < types.length; i++) { - var func = funcs[i]; - var type = types[i]; - var value = values[i]; - noInline(func); - tierUpToDFG(func, value); - var typeInfo = findTypeForExpression(func, "x"); - assert(typeInfo.instructionTypeSet.primitiveTypeNames.length === 1, "Only one primitive type should have been seen so far."); - assert(typeInfo.instructionTypeSet.primitiveTypeNames.indexOf(type) !== -1, "Should have been optimized on type: " + type); - for (var j = 0; j < types.length; j++) { - if (type === T.Number && types[j] === T.Integer) { - // If we optimize on type Number, but we pass in an Integer, our typecheck will still pass, so we wont directly get - // type Integer because T.Integer is implied to be contained in T.Number. - continue; - } - - func(values[j]); - typeInfo = findTypeForExpression(func, "x"); - assert(typeInfo.instructionTypeSet.primitiveTypeNames.indexOf(types[j]) !== -1, "Should have seen type: " + types[j] + " " + i + "," + j); - } -} - -function testStrucure(obj) { return obj; } -var obj = {x: 20}; -tierUpToDFG(testStrucure, obj); -var types = findTypeForExpression(testStrucure, "obj"); -assert(types.instructionTypeSet.structures.length === 1, "variable 'test' should have exactly structure"); -assert(types.instructionTypeSet.structures[0].fields.length === 1, "variable 'test' should have exactly ONE field"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("x") !== -1, "variable 'test' should have field 'x'"); - -testStrucure({x:20, y: 40}) -types = findTypeForExpression(testStrucure, "obj"); -assert(types.instructionTypeSet.structures.length === 1, "variable 'test' should have still have exactly one structure"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("x") !== -1, "variable 'test' should have field 'x'"); -assert(types.instructionTypeSet.structures[0].optionalFields.indexOf("y") !== -1, "variable 'test' should have field optional field 'y'"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/dictionary-mode.js b/implementation-contributed/javascriptcore/typeProfiler/dictionary-mode.js deleted file mode 100644 index f348d7e31f..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/dictionary-mode.js +++ /dev/null @@ -1,29 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -function wrapper() -{ - -var foo = {}; -for (var i = 0; i < 150; i++) { - foo["hello" + i] = i; -} -var shouldBeInDictionaryMode = foo; - -var shouldNotBeInDictionaryMode = { - "1": 1, - "2": 2, - "3": 3 -} - -} -wrapper(); - -var types = findTypeForExpression(wrapper, "shouldBeInDictionaryMode"); -assert(types.globalTypeSet.structures.length === 1, "Should have one structure."); -assert(types.globalTypeSet.structures[0].isInDictionaryMode, "Should be in dictionary mode"); - -types = findTypeForExpression(wrapper, "shouldNotBeInDictionaryMode"); -assert(types.globalTypeSet.structures.length === 1, "Should have one structure."); -assert(!types.globalTypeSet.structures[0].isInDictionaryMode, "Should not be in dictionary mode"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/es6-block-scoping.js b/implementation-contributed/javascriptcore/typeProfiler/es6-block-scoping.js deleted file mode 100644 index 03300f9599..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/es6-block-scoping.js +++ /dev/null @@ -1,85 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -let changeFoo; -let tdzError; -let scoping; -let scoping2; -function noop(){} -function arr() { - return [1, 1.5, "hello", {}]; -} - -function wrapper() { - -let foo=20; -changeFoo = function(arg) { foo = arg; } - -scoping = function () -{ - let x = "hello"; - if (true) { - let x = 20; - const y = true; - x = "h" - } - noop(x); -} - -scoping2 = function() -{ - for (const item of arr()) { - noop(item); - } -} - -} -wrapper(); - -// ====== End test cases ====== - -var types = findTypeForExpression(wrapper, "foo=20;"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -assert(types.globalTypeSet.primitiveTypeNames.length === 1, "Primitive type names should contain exactly only one item globally"); -assert(types.instructionTypeSet.primitiveTypeNames.length === 1, "Primitive type names should contain exactly only one item on the instruction"); -assert(types.globalTypeSet.displayTypeName === T.Integer, "global display name should be Integer"); -assert(types.instructionTypeSet.displayTypeName === T.Integer, "instruction display name should be Integer"); - -changeFoo(20.5); -types = findTypeForExpression(wrapper, "foo=20;"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -assert(types.instructionTypeSet.primitiveTypeNames.length === 1, "Primitive type names should contain STILL only contain exactly one item on the instruction"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Global primitive type names should now still contain 'Integer'"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Number) !== -1, "Global primitive type names should now contain 'Number'"); -assert(types.globalTypeSet.primitiveTypeNames.length === 2, "Global primitive type names should contain exactly two items globally"); -assert(types.globalTypeSet.displayTypeName === T.Number, "global display name should be Number"); - - -scoping(); -types = findTypeForExpression(scoping, "x = 20"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -assert(types.instructionTypeSet.primitiveTypeNames.length === 1, "Primitive type names should contain only one item on the instruction"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -assert(types.globalTypeSet.primitiveTypeNames.length === 2, "Primitive type names should contain two items: [String, Integer]"); - -types = findTypeForExpression(scoping, "x)"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Global primitive type names should have string."); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Global primitive type names should have string."); - -types = findTypeForExpression(scoping, "y = true"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Boolean) !== -1, "Global primitive type names should have boolean."); -assert(types.globalTypeSet.primitiveTypeNames.length === 1, "type only have one item."); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Boolean) !== -1, "Global primitive type names should have boolean."); -assert(types.instructionTypeSet.primitiveTypeNames.length === 1, "type only have one item."); - - -scoping2(); -types = findTypeForExpression(scoping2, "item)"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Number) !== -1, "Primitive type names should contain 'Number'"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Primitive type names should contain 'String'"); -assert(types.instructionTypeSet.structures.length === 1, "should have one structure"); -assert(types.instructionTypeSet.structures[0].constructorName === "Object", "Should be object"); -assert(types.instructionTypeSet.structures[0].fields.length === 0, "Should have no fields"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/es6-classes.js b/implementation-contributed/javascriptcore/typeProfiler/es6-classes.js deleted file mode 100644 index bdb74ba375..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/es6-classes.js +++ /dev/null @@ -1,41 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -let changeFoo; -let tdzError; -let scoping; -let scoping2; -function noop(){} - -function wrapper() { - class Animal { - constructor() { } - methodA() {} - } - class Dog extends Animal { - constructor() { super() } - methodB() {} - } - - let dogInstance = new Dog; - const animalInstance = new Animal; -} -wrapper(); - -// ====== End test cases ====== - -var types = findTypeForExpression(wrapper, "dogInstance ="); -assert(types.globalTypeSet.displayTypeName === "Dog", "Should show constructor name"); -assert(types.globalTypeSet.structures[0].constructorName === "Dog", "Should be Dog"); -assert(types.globalTypeSet.structures[0].proto.fields.length === 2, "should have two fields"); -assert(types.globalTypeSet.structures[0].proto.fields.indexOf("constructor") !== -1, "should have constructor"); -assert(types.globalTypeSet.structures[0].proto.fields.indexOf("methodB") !== -1, "should have methodB"); - -types = findTypeForExpression(wrapper, "animalInstance ="); -assert(types.globalTypeSet.displayTypeName === "Animal", "Should show constructor name"); -assert(types.globalTypeSet.structures.length === 1, "should have one structure"); -assert(types.globalTypeSet.structures[0].constructorName === "Animal", "Should be Animal"); -assert(types.globalTypeSet.structures[0].proto.fields.length === 2, "should have two fields"); -assert(types.globalTypeSet.structures[0].proto.fields.indexOf("constructor") !== -1, "should have constructor"); -assert(types.globalTypeSet.structures[0].proto.fields.indexOf("methodA") !== -1, "should have methodA"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/inheritance.js b/implementation-contributed/javascriptcore/typeProfiler/inheritance.js deleted file mode 100644 index 9bc64510f4..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/inheritance.js +++ /dev/null @@ -1,53 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -function wrapper() -{ - -var theA = new A; -var theB = new B; -var theC = new C; -var hierarchyTest = new B; -hierarchyTest = new C; - -var secondHierarchyTest = Object.create(theB); -secondHierarchyTest = Object.create(theC); - -var secondB = Object.create(theB); - -function A() { }; -function B() { }; B.prototype.__proto__ = A.prototype; -function C() { }; C.prototype.__proto__ = A.prototype; - -} -wrapper(); - -// ====== End test cases ====== - -types = findTypeForExpression(wrapper, "theA = n"); -assert(types.globalTypeSet.displayTypeName === "A", "variable 'theA' should have displayTypeName 'A'"); -assert(types.instructionTypeSet.displayTypeName === "A", "variable 'theA' should have displayTypeName 'A'"); - -types = findTypeForExpression(wrapper, "theB = n"); -assert(types.globalTypeSet.displayTypeName === "B", "variable 'theB' should have displayTypeName 'B'"); -assert(types.instructionTypeSet.displayTypeName === "B", "variable 'theB' should have displayTypeName 'B'"); - -types = findTypeForExpression(wrapper, "theC = n"); -assert(types.globalTypeSet.displayTypeName === "C", "variable 'theC' should have displayTypeName 'C'"); -assert(types.instructionTypeSet.displayTypeName === "C", "variable 'theC' should have displayTypeName 'C'"); - -types = findTypeForExpression(wrapper, "hierarchyTest = new B;"); -assert(types.globalTypeSet.displayTypeName === "A", "variable 'hierarchyTest' should have displayTypeName 'A'"); - -types = findTypeForExpression(wrapper, "hierarchyTest = new C;"); -assert(types.globalTypeSet.displayTypeName === "A", "variable 'hierarchyTest' should have displayTypeName 'A'"); - -types = findTypeForExpression(wrapper, "secondHierarchyTest = Object.create(theB);"); -assert(types.globalTypeSet.displayTypeName === "A", "variable 'secondHierarchyTest' should have displayTypeName 'A'"); - -types = findTypeForExpression(wrapper, "secondHierarchyTest = Object.create(theC);"); -assert(types.globalTypeSet.displayTypeName === "A", "variable 'secondHierarchyTest' should have displayTypeName 'A'"); - -types = findTypeForExpression(wrapper, "secondB"); -assert(types.globalTypeSet.displayTypeName === "B", "variable 'secondB' should have displayTypeName 'B'"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/int52-dfg.js b/implementation-contributed/javascriptcore/typeProfiler/int52-dfg.js deleted file mode 100644 index 60fcefb96d..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/int52-dfg.js +++ /dev/null @@ -1,19 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -function test() -{ - var ok = 0; - for (var i = 0; i < 1e4; ++i) { - // Int52. ProfileType should not use AnyIntUse edge in 32bit environment. - // If 32bit uses AnyIntUse, it leads crashing. - ok += 0xfffffffff; - } - return ok; -} -test(); - -var types = findTypeForExpression(test, "ok += 0x"); -assert(types.instructionTypeSet.primitiveTypeNames.length === 1, "Primitive type names should one candidate."); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/loop.js b/implementation-contributed/javascriptcore/typeProfiler/loop.js deleted file mode 100644 index 2ff7e1fc7e..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/loop.js +++ /dev/null @@ -1,59 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -function testForIn(x) { - for (var arg1 in x) - x; - - for (arg2 in x) - x; - - for ({x: arg3} in x) - x; - - for (var {x: arg4} in x) - x; -} - -function testForOf(x) { - for (var arg1 of x) - x; - - for (arg2 of x) - x; - - for ({x: arg3} of x) - x; - for (var {x: arg4} of x) - x; -} - -testForIn([1]) -var types = findTypeForExpression(testForIn, "arg1"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Primitive type names should contain 'String'"); -types = findTypeForExpression(testForIn, "arg2"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Primitive type names should contain 'String'"); -types = findTypeForExpression(testForIn, "arg3"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Undefined) !== -1, "Primitive type names should contain 'Undefined'"); -types = findTypeForExpression(testForIn, "arg4"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Undefined) !== -1, "Primitive type names should contain 'Undefined'"); - -testForOf([1]) -types = findTypeForExpression(testForOf, "arg1"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -types = findTypeForExpression(testForOf, "arg2"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -types = findTypeForExpression(testForOf, "arg3"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Undefined) !== -1, "Primitive type names should contain 'Undefined'"); -types = findTypeForExpression(testForOf, "arg4"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Undefined) !== -1, "Primitive type names should contain 'Undefined'"); -testForOf([{x:29}]) -types = findTypeForExpression(testForOf, "arg1"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("x") !== -1, "variable 'arg1' should have field 'x'"); -types = findTypeForExpression(testForOf, "arg2"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("x") !== -1, "variable 'arg2' should have field 'x'"); -types = findTypeForExpression(testForOf, "arg3"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -types = findTypeForExpression(testForOf, "arg4"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/optional-fields.js b/implementation-contributed/javascriptcore/typeProfiler/optional-fields.js deleted file mode 100644 index 222de55a7c..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/optional-fields.js +++ /dev/null @@ -1,54 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -var func; -function wrapper() { - -func = function(arg){}; - -} -wrapper(); - -// ====== End test cases ====== - -var obj = {x:20, y:50}; - -func(obj); -var types = findTypeForExpression(wrapper, "arg"); -assert(types.instructionTypeSet.structures.length === 1, "arg should have one structure"); -assert(types.instructionTypeSet.structures[0].fields.length === 2, "arg should have two fields"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("x") !== -1, "arg should have field: 'x'"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("y") !== -1, "arg should have field: 'y'"); -assert(types.instructionTypeSet.structures[0].optionalFields.length === 0, "arg should have zero optional fields"); - -obj.z = 40; -func(obj); -types = findTypeForExpression(wrapper, "arg"); -assert(types.instructionTypeSet.structures[0].fields.length === 2, "arg should still have two fields"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("x") !== -1, "arg should have field: 'x'"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("y") !== -1, "arg should have field: 'y'"); -assert(types.instructionTypeSet.structures[0].optionalFields.length === 1, "arg should have one optional field"); -assert(types.instructionTypeSet.structures[0].optionalFields.indexOf("z") !== -1, "arg should have optional field: 'z'"); - -obj["foo"] = "type"; -obj["baz"] = "profiler"; -func(obj); -types = findTypeForExpression(wrapper, "arg"); -assert(types.instructionTypeSet.structures[0].fields.length === 2, "arg should still have two fields"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("x") !== -1, "arg should have field: 'x'"); -assert(types.instructionTypeSet.structures[0].fields.indexOf("y") !== -1, "arg should have field: 'y'"); -assert(types.instructionTypeSet.structures[0].optionalFields.length === 3, "arg should have three optional field"); -assert(types.instructionTypeSet.structures[0].optionalFields.indexOf("z") !== -1, "arg should have optional field: 'z'"); -assert(types.instructionTypeSet.structures[0].optionalFields.indexOf("foo") !== -1, "arg should have optional field: 'foo'"); -assert(types.instructionTypeSet.structures[0].optionalFields.indexOf("baz") !== -1, "arg should have optional field: 'baz'"); - -func({}); -types = findTypeForExpression(wrapper, "arg"); -assert(types.instructionTypeSet.structures[0].fields.length === 0, "arg should have no common fields"); -assert(types.instructionTypeSet.structures[0].optionalFields.length === 5, "arg should have five optional field"); -assert(types.instructionTypeSet.structures[0].optionalFields.indexOf("x") !== -1, "arg should have optional field: 'x'"); -assert(types.instructionTypeSet.structures[0].optionalFields.indexOf("y") !== -1, "arg should have optional field: 'y'"); -assert(types.instructionTypeSet.structures[0].optionalFields.indexOf("z") !== -1, "arg should have optional field: 'z'"); -assert(types.instructionTypeSet.structures[0].optionalFields.indexOf("foo") !== -1, "arg should have optional field: 'foo'"); -assert(types.instructionTypeSet.structures[0].optionalFields.indexOf("baz") !== -1, "arg should have optional field: 'baz'"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/overflow.js b/implementation-contributed/javascriptcore/typeProfiler/overflow.js deleted file mode 100644 index 0bf543bb62..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/overflow.js +++ /dev/null @@ -1,42 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -function wrapper() -{ - -var x; -var Proto = function() {}; -var oldProto; -for (var i = 0; i < MaxStructureCountWithoutOverflow; i++) { - // Make sure we get a new prototype chain on each assignment to x because objects with shared prototype chains will be merged. - x = new Proto; - x['field' + i] = 20; - x = x - oldProto = Proto; - Proto = function() {}; - Proto.prototype.__proto__ = oldProto.prototype; -} -x = {}; - -var y; -Proto = function() {}; -oldProto = null; -for (var i = 0; i < MaxStructureCountWithoutOverflow - 1; i++) { - y = new Proto; - y['field' + i] = 20; - y = y - oldProto = Proto; - Proto = function() {}; - Proto.prototype.__proto__ = oldProto.prototype; -} -y = {}; - -} -wrapper(); - -var types = findTypeForExpression(wrapper, "x;"); -assert(types.isOverflown, "x should be overflown with too many structure shapes."); - -var types = findTypeForExpression(wrapper, "y;"); -assert(!types.isOverflown, "y should not be overflown with too many structure shapes."); diff --git a/implementation-contributed/javascriptcore/typeProfiler/return.js b/implementation-contributed/javascriptcore/typeProfiler/return.js deleted file mode 100644 index c10cd7e1d8..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/return.js +++ /dev/null @@ -1,36 +0,0 @@ -var returnTypeFor = $vm.returnTypeFor; - -load("./driver/driver.js"); - -function foo(x) { return x; } -function Ctor() { - if (!(this instanceof Ctor)) - return "Not called with `new`"; -} - -// ====== End test cases ====== - -foo(20); -var types = returnTypeFor(foo); -assert(types.globalTypeSet.displayTypeName === T.Integer, "Function 'foo' should return 'Integer'"); - -foo(20.5); -types = returnTypeFor(foo); -assert(types.globalTypeSet.displayTypeName === T.Number, "Function 'foo' should return 'Number' after being called twice"); - -foo("hello"); -types = returnTypeFor(foo); -assert(types.globalTypeSet.displayTypeName === T.Many, "Function 'foo' should return '(many)' after being called three times"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Function 'foo' should have returned 'String' at some point"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Function 'foo' should have returned 'Integer' at some point"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Number) !== -1, "Function 'foo' should have returned 'Number' at some point"); - -new Ctor; -types = returnTypeFor(Ctor); -assert(types.globalTypeSet.displayTypeName === "Ctor", "Function 'Ctor' should return 'Ctor'"); -assert(types.globalTypeSet.structures.length === 1, "Function 'Ctor' should have seen one structure"); - -Ctor(); -types = returnTypeFor(Ctor); -assert(types.globalTypeSet.displayTypeName === "Object", "Function 'Ctor' should return Object"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Function 'Ctor' should return String"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/symbol.js b/implementation-contributed/javascriptcore/typeProfiler/symbol.js deleted file mode 100644 index 79daf6439e..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/symbol.js +++ /dev/null @@ -1,46 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -function wrapper() { - var s1 = Symbol(); - - var sCaptured = Symbol(); - function foo() { - sCaptured = null; - } - foo(); - - function bar(s3) { return s3; } - for (var i = 0; i < 1000; i++) - bar(i) - bar(Symbol()) - - function baz(s4) { return s4; } - for (var i = 0; i < 1000; i++) - baz(Symbol()) - baz("hello") -} - -wrapper(); - -// ====== End test cases ====== - -var types = findTypeForExpression(wrapper, "s1"); -assert(types.instructionTypeSet.primitiveTypeNames.length === 1, "Primitive type names should contain one type"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Symbol) !== -1, "Primitive type names should contain 'Symbol'"); - -types = findTypeForExpression(wrapper, "sCaptured"); -assert(types.globalTypeSet.primitiveTypeNames.length === 2, "Primitive type names should contain two items."); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Symbol) !== -1, "Primitive type names should contain 'Symbol'"); -assert(types.globalTypeSet.primitiveTypeNames.indexOf(T.Null) !== -1, "Primitive type names should contain 'Null'"); - -types = findTypeForExpression(wrapper, "s3"); -assert(types.instructionTypeSet.primitiveTypeNames.length === 2, "Primitive type names should contain 2 items"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Symbol) !== -1, "Primitive type names should contain 'Symbol'"); - -types = findTypeForExpression(wrapper, "s4"); -assert(types.instructionTypeSet.primitiveTypeNames.length === 2, "Primitive type names should contain 2 items"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Primitive type names should contain 'String'"); -assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Symbol) !== -1, "Primitive type names should contain 'Symbol'"); diff --git a/implementation-contributed/javascriptcore/typeProfiler/weird-prototype-chain.js b/implementation-contributed/javascriptcore/typeProfiler/weird-prototype-chain.js deleted file mode 100644 index ac38e30c82..0000000000 --- a/implementation-contributed/javascriptcore/typeProfiler/weird-prototype-chain.js +++ /dev/null @@ -1,23 +0,0 @@ -var findTypeForExpression = $vm.findTypeForExpression; - -load("./driver/driver.js"); - -function wrapper() { - -function foo(o) { - let variableName = o; - return variableName; -} -let o1 = new Number; -o1.__proto__ = null; -foo(o1); - -let o2 = function() {} -foo(o2); - -} -wrapper(); - -// ====== End test cases ====== -var types = findTypeForExpression(wrapper, "variableName;"); -assert(types.instructionTypeSet.displayTypeName === "Object", "'Object' should be our TOP."); diff --git a/implementation-contributed/javascriptcore/wasm/modules/default-import-star-error.js b/implementation-contributed/javascriptcore/wasm/modules/default-import-star-error.js deleted file mode 100644 index f6c64610e6..0000000000 --- a/implementation-contributed/javascriptcore/wasm/modules/default-import-star-error.js +++ /dev/null @@ -1,4 +0,0 @@ -import * as assert from '../assert.js'; -import("./default-import-star-error/entry.wasm").then($vm.abort, function (error) { - assert.eq(String(error), `SyntaxError: Importing binding name 'default' cannot be resolved by star export entries.`); -}).then(function () { }, $vm.abort); diff --git a/implementation-contributed/javascriptcore/wasm/modules/js-wasm-cycle.js b/implementation-contributed/javascriptcore/wasm/modules/js-wasm-cycle.js deleted file mode 100644 index 94f0f866c2..0000000000 --- a/implementation-contributed/javascriptcore/wasm/modules/js-wasm-cycle.js +++ /dev/null @@ -1,4 +0,0 @@ -import * as assert from '../assert.js'; -import("./js-wasm-cycle/entry.js").then($vm.abort, function (error) { - assert.eq(String(error), `Error: import function ./entry.js:return42 must be callable`); -}).then(function () { }, $vm.abort); diff --git a/implementation-contributed/javascriptcore/wasm/modules/js-wasm-start.js b/implementation-contributed/javascriptcore/wasm/modules/js-wasm-start.js deleted file mode 100644 index c2274c04fa..0000000000 --- a/implementation-contributed/javascriptcore/wasm/modules/js-wasm-start.js +++ /dev/null @@ -1,9 +0,0 @@ -import * as assert from '../assert.js'; - -Promise.all([ - import("./start.wasm"), - import("./start.wasm"), -]).then(([start0, start1]) => { - assert.eq(start0, start1); - assert.eq(start0.get(), 1); -}, $vm.abort); diff --git a/implementation-contributed/javascriptcore/wasm/modules/wasm-import-wasm-export-i64-error.js b/implementation-contributed/javascriptcore/wasm/modules/wasm-import-wasm-export-i64-error.js deleted file mode 100644 index 75ed5693ec..0000000000 --- a/implementation-contributed/javascriptcore/wasm/modules/wasm-import-wasm-export-i64-error.js +++ /dev/null @@ -1,4 +0,0 @@ -import * as assert from '../assert.js'; -import("./wasm-imports-wasm-exports-i64-error/imports.wasm").then($vm.abort, function (error) { - assert.eq(String(error), `Error: exported global cannot be an i64`); -}).catch($vm.abort); diff --git a/implementation-contributed/javascriptcore/wasm/modules/wasm-wasm-cycle.js b/implementation-contributed/javascriptcore/wasm/modules/wasm-wasm-cycle.js deleted file mode 100644 index b1a504ea9c..0000000000 --- a/implementation-contributed/javascriptcore/wasm/modules/wasm-wasm-cycle.js +++ /dev/null @@ -1,4 +0,0 @@ -import * as assert from '../assert.js'; -import("./wasm-wasm-cycle/entry.wasm").then($vm.abort, function (error) { - assert.eq(String(error), `Error: import function ./entry.wasm:return42 must be callable`); -}).then(function () { }, $vm.abort);