| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 f1(a, i) { | |
| 8 return a[i] + 0.5; | |
| 9 } | |
| 10 | |
| 11 var other_realm = Realm.create(); | |
| 12 var arr = [,0.0,2.5]; | |
| 13 assertEquals(0.5, f1(arr, 1)); | |
| 14 assertEquals(0.5, f1(arr, 1)); | |
| 15 %OptimizeFunctionOnNextCall(f1); | |
| 16 assertEquals(0.5, f1(arr, 1)); | |
| 17 | |
| 18 Realm.shared = arr.__proto__; | |
| 19 | |
| 20 // The call syntax is useful to make sure the native context is that of the | |
| 21 // other realm. | |
| 22 Realm.eval(other_realm, "Array.prototype.push.call(Realm.shared, 1);"); | |
| 23 assertEquals(1.5, f1(arr, 0)); | |
| OLD | NEW |