| 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 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // We change the stack size for the ARM64 simulator because at one point this | 28 // We change the stack size for the ARM64 simulator because at one point this |
| 29 // test enters an infinite recursion which goes through the runtime and we | 29 // test enters an infinite recursion which goes through the runtime and we |
| 30 // overflow the system stack before the simulator stack. | 30 // overflow the system stack before the simulator stack. |
| 31 | 31 |
| 32 // Flags: --harmony-proxies --sim-stack-size=500 --turbo-deoptimization | 32 // Flags: --harmony-proxies --sim-stack-size=500 --turbo-deoptimization |
| 33 // Flags: --allow-natives-syntax |
| 33 | 34 |
| 34 | 35 |
| 35 // Helper. | 36 // Helper. |
| 36 | 37 |
| 37 function TestWithProxies(test, x, y, z) { | 38 function TestWithProxies(test, x, y, z) { |
| 38 test(Proxy.create, x, y, z) | 39 test(Proxy.create, x, y, z) |
| 39 test(function(h) {return Proxy.createFunction(h, function() {})}, x, y, z) | 40 test(function(h) {return Proxy.createFunction(h, function() {})}, x, y, z) |
| 40 } | 41 } |
| 41 | 42 |
| 42 | 43 |
| (...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2295 | 2296 |
| 2296 function TestConstructorWithProxyPrototype2(create, handler) { | 2297 function TestConstructorWithProxyPrototype2(create, handler) { |
| 2297 function C() {}; | 2298 function C() {}; |
| 2298 C.prototype = create(handler); | 2299 C.prototype = create(handler); |
| 2299 | 2300 |
| 2300 var o = new C; | 2301 var o = new C; |
| 2301 assertSame(C.prototype, Object.getPrototypeOf(o)); | 2302 assertSame(C.prototype, Object.getPrototypeOf(o)); |
| 2302 } | 2303 } |
| 2303 | 2304 |
| 2304 TestConstructorWithProxyPrototype(); | 2305 TestConstructorWithProxyPrototype(); |
| 2306 |
| 2307 function TestOptWithProxyPrototype() { |
| 2308 var handler = { |
| 2309 getPropertyDescriptor: function(k) { |
| 2310 return {value: 10, configurable: true, enumerable: true, writable: true}; |
| 2311 } |
| 2312 }; |
| 2313 |
| 2314 function C() {}; |
| 2315 C.prototype = Proxy.create(handler); |
| 2316 var o = new C(); |
| 2317 |
| 2318 function f() { |
| 2319 return o.x; |
| 2320 } |
| 2321 assertEquals(10, f()); |
| 2322 assertEquals(10, f()); |
| 2323 %OptimizeFunctionOnNextCall(f); |
| 2324 assertEquals(10, f()); |
| 2325 } |
| 2326 |
| 2327 TestOptWithProxyPrototype(); |
| OLD | NEW |