diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-02 17:11:31 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-06 16:53:06 +0200 |
commit | 704fd8f3745527fc080f96e54e5ec1857c505399 (patch) | |
tree | bff68e8a731f3618d3e8f1708aa9de194bc1f612 /deps/v8/test/mjsunit/compiler | |
parent | eec43351c44c0bec31a83e1a28be15e30722936a (diff) | |
download | node-new-704fd8f3745527fc080f96e54e5ec1857c505399.tar.gz |
v8: upgrade to v3.20.2
Diffstat (limited to 'deps/v8/test/mjsunit/compiler')
-rw-r--r-- | deps/v8/test/mjsunit/compiler/inline-arguments.js | 43 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/compiler/osr-big.js | 45 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/compiler/osr-nested.js | 46 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/compiler/osr-one.js | 40 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/compiler/osr-regress-max-locals.js (renamed from deps/v8/test/mjsunit/compiler/regress-max-locals-for-osr.js) | 0 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/compiler/osr-simple.js (renamed from deps/v8/test/mjsunit/compiler/simple-osr.js) | 0 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/compiler/osr-two.js | 44 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/compiler/osr-with-args.js | 44 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/compiler/parallel-proto-change.js | 22 |
9 files changed, 278 insertions, 6 deletions
diff --git a/deps/v8/test/mjsunit/compiler/inline-arguments.js b/deps/v8/test/mjsunit/compiler/inline-arguments.js index df1bd2214d..75d01b5df3 100644 --- a/deps/v8/test/mjsunit/compiler/inline-arguments.js +++ b/deps/v8/test/mjsunit/compiler/inline-arguments.js @@ -266,3 +266,46 @@ test_toarr(toarr2); } } })(); + + +// Test materialization of arguments object with values in registers. +(function () { + "use strict"; + var forceDeopt = { deopt:false }; + function inner(a,b,c,d,e,f,g,h,i,j) { + var args = arguments; + forceDeopt.deopt; + assertSame(10, args.length); + assertSame(a, args[0]); + assertSame(b, args[1]); + assertSame(c, args[2]); + assertSame(d, args[3]); + assertSame(e, args[4]); + assertSame(f, args[5]); + assertSame(g, args[6]); + assertSame(h, args[7]); + assertSame(i, args[8]); + assertSame(j, args[9]); + } + + var a = 0.5; + var b = 1.7; + var c = 123; + function outer() { + inner( + a - 0.3, // double in double register + b + 2.3, // integer in double register + c + 321, // integer in general register + c - 456, // integer in stack slot + a + 0.1, a + 0.2, a + 0.3, a + 0.4, a + 0.5, + a + 0.6 // double in stack slot + ); + } + + outer(); + outer(); + %OptimizeFunctionOnNextCall(outer); + outer(); + delete forceDeopt.deopt; + outer(); +})(); diff --git a/deps/v8/test/mjsunit/compiler/osr-big.js b/deps/v8/test/mjsunit/compiler/osr-big.js new file mode 100644 index 0000000000..ed71744b78 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/osr-big.js @@ -0,0 +1,45 @@ +// Copyright 2013 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "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 THE COPYRIGHT +// OWNER 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. + +// Flags: --use-osr + +function f(x) { + var sum = 0; + var outer = 1000000; + var a = 1, b = 2, c = 3, d = 4, e = 5; + while (outer > 0) { + a = a + 5; + b = b + 4; + c = c + 3; + d = d + 2; + e = e + 1; + outer--; + } + return a + b + c + d + e; +} + +assertEquals(15000015, f(5)); diff --git a/deps/v8/test/mjsunit/compiler/osr-nested.js b/deps/v8/test/mjsunit/compiler/osr-nested.js new file mode 100644 index 0000000000..4bdb0828ca --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/osr-nested.js @@ -0,0 +1,46 @@ +// Copyright 2013 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "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 THE COPYRIGHT +// OWNER 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. + +// Flags: --use-osr + +function f() { + var sum = 0; + for (var i = 0; i < 10; i++) { + for (var j = 0; j < 100000; j++) { + var x = i + 2; + var y = x + 5; + var z = y + 3; + sum += z; + } + } + return sum; +} + + +assertEquals(14500000, f()); +assertEquals(14500000, f()); +assertEquals(14500000, f()); diff --git a/deps/v8/test/mjsunit/compiler/osr-one.js b/deps/v8/test/mjsunit/compiler/osr-one.js new file mode 100644 index 0000000000..2c27192d27 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/osr-one.js @@ -0,0 +1,40 @@ +// Copyright 2013 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "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 THE COPYRIGHT +// OWNER 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. + +// Flags: --use-osr + +function f(x) { + var sum = 0; + var count = 10000000; + while (count > 0) { + sum += x; + count--; + } + return sum; +} + +assertEquals(50000000, f(5)); diff --git a/deps/v8/test/mjsunit/compiler/regress-max-locals-for-osr.js b/deps/v8/test/mjsunit/compiler/osr-regress-max-locals.js index cc150edfd7..cc150edfd7 100644 --- a/deps/v8/test/mjsunit/compiler/regress-max-locals-for-osr.js +++ b/deps/v8/test/mjsunit/compiler/osr-regress-max-locals.js diff --git a/deps/v8/test/mjsunit/compiler/simple-osr.js b/deps/v8/test/mjsunit/compiler/osr-simple.js index 8ec1b2b936..8ec1b2b936 100644 --- a/deps/v8/test/mjsunit/compiler/simple-osr.js +++ b/deps/v8/test/mjsunit/compiler/osr-simple.js diff --git a/deps/v8/test/mjsunit/compiler/osr-two.js b/deps/v8/test/mjsunit/compiler/osr-two.js new file mode 100644 index 0000000000..8ac4c2cc12 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/osr-two.js @@ -0,0 +1,44 @@ +// Copyright 2013 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "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 THE COPYRIGHT +// OWNER 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. + +// Flags: --use-osr + +function f(x) { + var sum = 0; + var outer = 100; + while (outer > 0) { + var inner = 100000; + while (inner > 0) { + sum += x; + inner--; + } + outer--; + } + return sum; +} + +assertEquals(50000000, f(5)); diff --git a/deps/v8/test/mjsunit/compiler/osr-with-args.js b/deps/v8/test/mjsunit/compiler/osr-with-args.js new file mode 100644 index 0000000000..44fa1cb2cf --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/osr-with-args.js @@ -0,0 +1,44 @@ +// Copyright 2013 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "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 THE COPYRIGHT +// OWNER 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. + +// Flags: --use-osr + +function f() { + var sum = 0; + for (var i = 0; i < 1000000; i++) { + var t = arguments[0] + 2; + var x = arguments[1] + 2; + var y = t + x + 5; + var z = y + 3; + sum += z; + } + return sum; +} + +for (var i = 0; i < 4; i++) { + assertEquals(17000000, f(2, 3)); +} diff --git a/deps/v8/test/mjsunit/compiler/parallel-proto-change.js b/deps/v8/test/mjsunit/compiler/parallel-proto-change.js index 74e6d86a10..2392a37c95 100644 --- a/deps/v8/test/mjsunit/compiler/parallel-proto-change.js +++ b/deps/v8/test/mjsunit/compiler/parallel-proto-change.js @@ -25,7 +25,17 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Flags: --allow-natives-syntax --parallel-recompilation +// Flags: --allow-natives-syntax +// Flags: --parallel-recompilation --parallel-recompilation-delay=50 + +if (!%IsParallelRecompilationSupported()) { + print("Parallel recompilation is disabled. Skipping this test."); + quit(); +} + +function assertUnoptimized(fun) { + assertTrue(%GetOptimizationStatus(fun) != 1); +} function f(foo) { return foo.bar(); } @@ -36,10 +46,10 @@ assertEquals(1, f(o)); assertEquals(1, f(o)); %OptimizeFunctionOnNextCall(f, "parallel"); -assertEquals(1, f(o)); -// Change the prototype chain during optimization. +assertEquals(1, f(o)); // Trigger optimization. +assertUnoptimized(f); // Optimization not yet done. +// Change the prototype chain during optimization to trigger map invalidation. o.__proto__.__proto__ = { bar: function() { return 2; } }; - -%WaitUntilOptimized(f); - +%CompleteOptimization(f); // Conclude optimization with... +assertUnoptimized(f); // ... bailing out due to map dependency. assertEquals(2, f(o)); |