2014-10-17 09:35:45 +00:00
|
|
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
function Module(stdlib, foreign, heap) {
|
|
|
|
"use asm";
|
|
|
|
var MEM32 = new stdlib.Int32Array(heap);
|
2014-10-20 06:25:41 +00:00
|
|
|
function loadm4194304() {
|
2017-02-14 09:26:52 +00:00
|
|
|
var i = -4194304 << 2;
|
|
|
|
return MEM32[i >> 2] | 0;
|
2014-10-20 06:25:41 +00:00
|
|
|
}
|
|
|
|
function loadm0() {
|
2017-02-14 09:26:52 +00:00
|
|
|
return MEM32[-0] | 0;
|
2014-10-20 06:25:41 +00:00
|
|
|
}
|
2014-10-17 09:35:45 +00:00
|
|
|
function load0() {
|
2017-02-14 09:26:52 +00:00
|
|
|
return MEM32[0] | 0;
|
2014-10-17 09:35:45 +00:00
|
|
|
}
|
|
|
|
function load4() {
|
2017-02-14 09:26:52 +00:00
|
|
|
return MEM32[4] | 0;
|
2014-10-17 09:35:45 +00:00
|
|
|
}
|
2014-10-20 06:25:41 +00:00
|
|
|
function storem4194304(v) {
|
2017-02-14 09:26:52 +00:00
|
|
|
v = v | 0;
|
|
|
|
var i = -4194304 << 2;
|
|
|
|
MEM32[i >> 2] = v;
|
2014-10-20 06:25:41 +00:00
|
|
|
}
|
|
|
|
function storem0(v) {
|
2017-02-14 09:26:52 +00:00
|
|
|
v = v | 0;
|
2014-10-20 06:25:41 +00:00
|
|
|
MEM32[-0] = v;
|
|
|
|
}
|
2014-10-17 09:35:45 +00:00
|
|
|
function store0(v) {
|
2017-02-14 09:26:52 +00:00
|
|
|
v = v | 0;
|
|
|
|
MEM32[0 >> 2] = v;
|
2014-10-17 09:35:45 +00:00
|
|
|
}
|
|
|
|
function store4(v) {
|
2017-02-14 09:26:52 +00:00
|
|
|
v = v | 0;
|
|
|
|
MEM32[(4 << 2) >> 2] = v;
|
2014-10-17 09:35:45 +00:00
|
|
|
}
|
2014-10-20 06:25:41 +00:00
|
|
|
return { loadm4194304: loadm4194304, storem4194304: storem4194304,
|
|
|
|
loadm0: loadm0, storem0: storem0, load0: load0, store0: store0,
|
|
|
|
load4: load4, store4: store4 };
|
2014-10-17 09:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var m = Module(this, {}, new ArrayBuffer(4));
|
|
|
|
|
2017-02-14 09:26:52 +00:00
|
|
|
assertEquals(0, m.loadm4194304());
|
2014-10-20 06:25:41 +00:00
|
|
|
assertEquals(0, m.loadm0());
|
2014-10-17 09:35:45 +00:00
|
|
|
assertEquals(0, m.load0());
|
2017-02-14 09:26:52 +00:00
|
|
|
assertEquals(0, m.load4());
|
2014-10-20 06:25:41 +00:00
|
|
|
m.storem4194304(123456789);
|
2017-02-14 09:26:52 +00:00
|
|
|
assertEquals(0, m.loadm4194304());
|
2014-10-20 06:25:41 +00:00
|
|
|
assertEquals(0, m.loadm0());
|
|
|
|
assertEquals(0, m.load0());
|
2017-02-14 09:26:52 +00:00
|
|
|
assertEquals(0, m.load4());
|
2014-10-20 06:25:41 +00:00
|
|
|
m.storem0(987654321);
|
2017-02-14 09:26:52 +00:00
|
|
|
assertEquals(0, m.loadm4194304());
|
2014-10-20 06:25:41 +00:00
|
|
|
assertEquals(987654321, m.loadm0());
|
|
|
|
assertEquals(987654321, m.load0());
|
2017-02-14 09:26:52 +00:00
|
|
|
assertEquals(0, m.load4());
|
2014-10-17 09:35:45 +00:00
|
|
|
m.store0(0x12345678);
|
2017-02-14 09:26:52 +00:00
|
|
|
assertEquals(0, m.loadm4194304());
|
2014-10-20 06:25:41 +00:00
|
|
|
assertEquals(0x12345678, m.loadm0());
|
2014-10-17 09:35:45 +00:00
|
|
|
assertEquals(0x12345678, m.load0());
|
2017-02-14 09:26:52 +00:00
|
|
|
assertEquals(0, m.load4());
|
2014-10-17 09:35:45 +00:00
|
|
|
m.store4(43);
|
2017-02-14 09:26:52 +00:00
|
|
|
assertEquals(0, m.loadm4194304());
|
2014-10-20 06:25:41 +00:00
|
|
|
assertEquals(0x12345678, m.loadm0());
|
2014-10-17 09:35:45 +00:00
|
|
|
assertEquals(0x12345678, m.load0());
|
2017-02-14 09:26:52 +00:00
|
|
|
assertEquals(0, m.load4());
|