OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 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: --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
6 | 6 |
7 var doubles = new Float64Array(1); | 7 var doubles = new Float64Array(1); |
8 function ToHeapNumber(i) { | 8 function ToHeapNumber(i) { |
9 doubles[0] = i; | 9 doubles[0] = i; |
10 return doubles[0]; | 10 return doubles[0]; |
11 } | 11 } |
12 for (var i = 0; i < 3; i++) ToHeapNumber(i); | 12 for (var i = 0; i < 3; i++) ToHeapNumber(i); |
13 %OptimizeFunctionOnNextCall(ToHeapNumber); | 13 %OptimizeFunctionOnNextCall(ToHeapNumber); |
14 assertFalse(%IsSmi(ToHeapNumber(1))); | 14 ToHeapNumber(1); |
15 | 15 |
16 function Fail(a, i, v) { | 16 function Fail(a, i, v) { |
17 a[i] = v; | 17 a[i] = v; |
18 } | 18 } |
19 | 19 |
20 for (var i = 0; i < 3; i++) Fail(new Array(1), 1, i); | 20 for (var i = 0; i < 3; i++) Fail(new Array(1), 1, i); |
21 %OptimizeFunctionOnNextCall(Fail); | 21 %OptimizeFunctionOnNextCall(Fail); |
22 // 1050 > JSObject::kMaxGap, causing stub failure and runtime call. | 22 // 1050 > JSObject::kMaxGap, causing stub failure and runtime call. |
23 Fail(new Array(1), ToHeapNumber(1050), 3); | 23 Fail(new Array(1), ToHeapNumber(1050), 3); |
OLD | NEW |