OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 function Module(stdlib, foreign, heap) { |
| 6 "use asm"; |
| 7 var MEM32 = new stdlib.Int32Array(heap); |
| 8 function load0() { |
| 9 return MEM32[0]; |
| 10 } |
| 11 function load4() { |
| 12 return MEM32[4]; |
| 13 } |
| 14 function store0(v) { |
| 15 MEM32[0] = v; |
| 16 } |
| 17 function store4(v) { |
| 18 MEM32[4] = v; |
| 19 } |
| 20 return { load0: load0, store0: store0, load4: load4, store4: store4 }; |
| 21 } |
| 22 |
| 23 var m = Module(this, {}, new ArrayBuffer(4)); |
| 24 |
| 25 assertEquals(0, m.load0()); |
| 26 assertEquals(undefined, m.load4()); |
| 27 m.store0(0x12345678); |
| 28 assertEquals(0x12345678, m.load0()); |
| 29 assertEquals(undefined, m.load4()); |
| 30 m.store4(43); |
| 31 assertEquals(0x12345678, m.load0()); |
| 32 assertEquals(undefined, m.load4()); |
OLD | NEW |