| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // Flags: --allow-natives-syntax | 28 // Flags: --allow-natives-syntax |
| 29 | 29 |
| 30 // Check that %NewObjectFromBound works correctly when called from optimized | 30 // Check that %NewObjectFromBound works correctly when called from optimized |
| 31 // frame. | 31 // frame. |
| 32 function foo(x, y, z) { | 32 function foo(x, y, z) { |
| 33 assertEquals(1, x); | 33 assertEquals(1, x); |
| 34 assertEquals(2, y); | 34 assertEquals(2, y); |
| 35 assertEquals(3, z); | 35 assertEquals(3, z); |
| 36 } | 36 } |
| 37 | 37 |
| 38 var bound_arg = [1]; | 38 var foob = foo.bind({}, 1); |
| 39 | 39 |
| 40 function f(y, z) { | 40 function f(y, z) { |
| 41 return %NewObjectFromBound(foo, bound_arg); | 41 return %NewObjectFromBound(foob); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Check that %NewObjectFromBound looks at correct frame for inlined function. | 44 // Check that %NewObjectFromBound looks at correct frame for inlined function. |
| 45 function g(z, y) { | 45 function g(z, y) { |
| 46 return f(y, z); /* f should be inlined into g, note rotated arguments */ | 46 return f(y, z); /* f should be inlined into g, note rotated arguments */ |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Check that %NewObjectFromBound looks at correct frame for inlined function. | 49 // Check that %NewObjectFromBound looks at correct frame for inlined function. |
| 50 function ff(x) { } | 50 function ff(x) { } |
| 51 function h(z2, y2) { | 51 function h(z2, y2) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 78 function bar(x, y, z) { | 78 function bar(x, y, z) { |
| 79 var non_construct = baz(); /* baz should be inlined */ | 79 var non_construct = baz(); /* baz should be inlined */ |
| 80 assertEquals(non_construct, NON_CONSTRUCT_MARKER); | 80 assertEquals(non_construct, NON_CONSTRUCT_MARKER); |
| 81 var construct = new baz(); | 81 var construct = new baz(); |
| 82 assertEquals(construct, CONSTRUCT_MARKER); | 82 assertEquals(construct, CONSTRUCT_MARKER); |
| 83 } | 83 } |
| 84 | 84 |
| 85 for (var i = 0; i < 5; i++) new bar(1, 2, 3); | 85 for (var i = 0; i < 5; i++) new bar(1, 2, 3); |
| 86 %OptimizeFunctionOnNextCall(bar); | 86 %OptimizeFunctionOnNextCall(bar); |
| 87 bar(1, 2, 3); | 87 bar(1, 2, 3); |
| OLD | NEW |