| OLD | NEW | 
|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 // Flags: --harmony-sharedarraybuffer | 5 // Flags: --harmony-sharedarraybuffer | 
| 6 | 6 | 
| 7 function Module(stdlib, foreign, heap, offset) { | 7 function Module(stdlib, foreign, heap, offset) { | 
| 8   "use asm"; | 8   "use asm"; | 
| 9   var MEM8 = new stdlib.Int8Array(heap, offset); | 9   var MEM8 = new stdlib.Int8Array(heap, offset); | 
| 10   var MEM16 = new stdlib.Int16Array(heap, offset); | 10   var MEM16 = new stdlib.Int16Array(heap, offset); | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 72   clearArray(); | 72   clearArray(); | 
| 73 | 73 | 
| 74   var ta = new taConstr(sab, offset); | 74   var ta = new taConstr(sab, offset); | 
| 75   var name = Object.prototype.toString.call(ta); | 75   var name = Object.prototype.toString.call(ta); | 
| 76   ta[0] = 30; | 76   ta[0] = 30; | 
| 77   assertEquals(30, f(0, 10), name); | 77   assertEquals(30, f(0, 10), name); | 
| 78   assertEquals(20, ta[0]); | 78   assertEquals(20, ta[0]); | 
| 79   assertEquals(20, f(0, 10), name); | 79   assertEquals(20, f(0, 10), name); | 
| 80   assertEquals(10, ta[0]); | 80   assertEquals(10, ta[0]); | 
| 81   // out of bounds | 81   // out of bounds | 
| 82   assertEquals(0, f(-1, 0), name); | 82   assertThrows(function() { f(-1, 0); }); | 
| 83   assertEquals(0, f(ta.length, 0), name); | 83   assertThrows(function() { f(ta.length, 0); }); | 
| 84 } | 84 } | 
| 85 | 85 | 
| 86 function testElement(m, offset) { | 86 function testElement(m, offset) { | 
| 87   testElementType(Int8Array, m.subi8, offset); | 87   testElementType(Int8Array, m.subi8, offset); | 
| 88   testElementType(Int16Array, m.subi16, offset); | 88   testElementType(Int16Array, m.subi16, offset); | 
| 89   testElementType(Int32Array, m.subi32, offset); | 89   testElementType(Int32Array, m.subi32, offset); | 
| 90   testElementType(Uint8Array, m.subu8, offset); | 90   testElementType(Uint8Array, m.subu8, offset); | 
| 91   testElementType(Uint16Array, m.subu16, offset); | 91   testElementType(Uint16Array, m.subu16, offset); | 
| 92   testElementType(Uint32Array, m.subu32, offset); | 92   testElementType(Uint32Array, m.subu32, offset); | 
| 93 } | 93 } | 
| 94 | 94 | 
| 95 var offset = 0; | 95 var offset = 0; | 
| 96 var sab = new SharedArrayBuffer(16); | 96 var sab = new SharedArrayBuffer(16); | 
| 97 var m1 = Module(this, {}, sab, offset); | 97 var m1 = Module(this, {}, sab, offset); | 
| 98 testElement(m1, offset); | 98 testElement(m1, offset); | 
| 99 | 99 | 
| 100 offset = 32; | 100 offset = 32; | 
| 101 sab = new SharedArrayBuffer(64); | 101 sab = new SharedArrayBuffer(64); | 
| 102 var m2 = Module(this, {}, sab, offset); | 102 var m2 = Module(this, {}, sab, offset); | 
| 103 testElement(m2, offset); | 103 testElement(m2, offset); | 
| OLD | NEW | 
|---|