OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 TestDeoptFromCopmputedNameInObjectLiteral() { |
| 8 function f() { |
| 9 var o = { |
| 10 toString: function() { |
| 11 %DeoptimizeFunction(f); |
| 12 return "x"; |
| 13 } |
| 14 }; |
| 15 return { [o]() { return 23 } }; |
| 16 } |
| 17 assertEquals(23, f().x()); |
| 18 assertEquals(23, f().x()); |
| 19 %OptimizeFunctionOnNextCall(f); |
| 20 assertEquals(23, f().x()); |
| 21 })(); |
| 22 |
| 23 (function TestDeoptFromCopmputedNameInClassLiteral() { |
| 24 function g() { |
| 25 var o = { |
| 26 toString: function() { |
| 27 %DeoptimizeFunction(g); |
| 28 return "y"; |
| 29 } |
| 30 }; |
| 31 class C { |
| 32 [o]() { return 42 }; |
| 33 } |
| 34 return new C(); |
| 35 } |
| 36 assertEquals(42, g().y()); |
| 37 assertEquals(42, g().y()); |
| 38 %OptimizeFunctionOnNextCall(g); |
| 39 assertEquals(42, g().y()); |
| 40 })(); |
OLD | NEW |