• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3// found in the LICENSE file.
4
5var stdlib = this;
6var foreign = {};
7var heap = new ArrayBuffer(64 * 1024);
8
9
10var pm1 = (function(stdlib, foreign, heap) {
11  "use asm";
12  var HEAP8 = new stdlib.Int8Array(heap);
13  const MASK1 = 1023;
14  function load1(i) {
15    i = i|0;
16    var j = 0;
17    j = HEAP8[(i & MASK1)]|0;
18    return j|0;
19  }
20  function store1(i, j) {
21    i = i|0;
22    j = j|0;
23    HEAP8[(i & MASK1)] = j;
24  }
25  return {load1: load1, store1: store1};
26})(stdlib, foreign, heap);
27
28assertEquals(0, pm1.load1(0));
29assertEquals(0, pm1.load1(1025));
30pm1.store1(0, 1);
31pm1.store1(1025, 127);
32assertEquals(1, pm1.load1(0));
33assertEquals(1, pm1.load1(1024));
34assertEquals(127, pm1.load1(1));
35assertEquals(127, pm1.load1(1025));
36