blob: 154bd82cd379a0ea932fb5e6dd989cd0d5b1bbc4 [file] [log] [blame]
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001// 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
5var stdlib = this;
6var buffer = new ArrayBuffer(64 * 1024);
7var foreign = {}
8
9
10var m = (function Module(stdlib, foreign, heap) {
11 "use asm";
12 var MEM64 = new stdlib.Float64Array(heap);
13 function load(i) {
14 i = i|0;
15 i = +MEM64[i >> 3];
16 return i;
17 }
18 function store(i, v) {
19 i = i|0;
20 v = +v;
21 MEM64[i >> 3] = v;
22 }
23 function load8(i) {
24 i = i|0;
25 i = +MEM64[i + 8 >> 3];
26 return i;
27 }
28 function store8(i, v) {
29 i = i|0;
30 v = +v;
31 MEM64[i + 8 >> 3] = v;
32 }
33 return { load: load, store: store, load8: load8, store8: store8 };
34})(stdlib, foreign, buffer);
35
36assertEquals(NaN, m.load(-8));
37assertEquals(NaN, m.load8(-16));
38m.store(0, 42.0);
39assertEquals(42.0, m.load8(-8));
40m.store8(-8, 99.0);
41assertEquals(99.0, m.load(0));
42assertEquals(99.0, m.load8(-8));