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 var m = (function m() { |
| 8 "use asm" |
| 9 var i32 = new Int32Array(4); |
| 10 var f64 = new Float64Array(4); |
| 11 |
| 12 function init() { |
| 13 i32[0] = 1; |
| 14 f64[0] = 0.1; |
| 15 } |
| 16 |
| 17 function load(b) { |
| 18 return (b ? 0 : i32[0]) + i32[0]; |
| 19 } |
| 20 |
| 21 function store(b) { |
| 22 if (b|0) { |
| 23 } else { |
| 24 f64[0] = 42; |
| 25 } |
| 26 return f64[0]; |
| 27 } |
| 28 |
| 29 return { init : init, load : load, store : store }; |
| 30 })(); |
| 31 |
| 32 m.init(); |
| 33 |
| 34 %OptimizeFunctionOnNextCall(m.load); |
| 35 assertEquals(2, m.load()); |
| 36 |
| 37 %OptimizeFunctionOnNextCall(m.store); |
| 38 assertEquals(0.1, m.store(1)); |
OLD | NEW |