OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --opt --allow-natives-syntax --no-always-opt | 5 // Flags: --opt --allow-natives-syntax --no-always-opt |
6 | 6 |
7 class A { | 7 class A { |
8 constructor() { } | 8 constructor() { } |
9 } | 9 } |
10 class B extends A { | 10 class B extends A { |
11 constructor(call_super) { | 11 constructor(call_super) { |
12 super(); | 12 super(); |
13 if (call_super) { | 13 if (call_super) { |
14 super(); | 14 super(); |
15 } | 15 } |
16 } | 16 } |
17 } | 17 } |
18 | 18 |
19 test = new B(0); | 19 test = new B(0); |
20 test = new B(0); | 20 test = new B(0); |
| 21 assertThrowsEquals(() => {new B(1)}, ReferenceError()); |
| 22 assertThrowsEquals(() => {new B(1)}, ReferenceError()); |
21 %OptimizeFunctionOnNextCall(B); | 23 %OptimizeFunctionOnNextCall(B); |
22 test = new B(0); | 24 test = new B(0); |
23 assertOptimized(B); | 25 assertOptimized(B); |
24 // Check that hole checks are handled correctly in optimized code. | 26 // Check that hole checks are handled correctly in optimized code. |
25 assertThrowsEquals(() => {new B(1)}, ReferenceError()); | 27 assertThrowsEquals(() => {new B(1)}, ReferenceError()); |
26 assertOptimized(B); | 28 assertOptimized(B); |
OLD | NEW |