OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --allow-natives-syntax |
| 6 |
| 7 function f() { |
| 8 this.x = 1; |
| 9 } |
| 10 |
| 11 var a = []; |
| 12 |
| 13 // Create enough objects to trigger slack tracking. |
| 14 for (let i = 0; i < 100; i++) { |
| 15 new f(); |
| 16 } |
| 17 |
| 18 function h() { |
| 19 // Create a new object and add an out-of-object property 'y'. |
| 20 var o = new f(); |
| 21 o.y = 1.5; |
| 22 return o; |
| 23 } |
| 24 |
| 25 function g(o) { |
| 26 // Add more properties so that we trigger extension of out-ot-object |
| 27 // property store. |
| 28 o.u = 1.1; |
| 29 o.v = 1.2; |
| 30 o.z = 1.3; |
| 31 // Return a field from the out-of-object-property store. |
| 32 return o.y; |
| 33 } |
| 34 |
| 35 g(h()); |
| 36 g(h()); |
| 37 %OptimizeFunctionOnNextCall(g); |
| 38 assertEquals(1.5, g(h())); |
OLD | NEW |