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: --expose-wasm | 5 // Flags: --expose-wasm |
6 | 6 |
7 function bytes() { | 7 function bytes() { |
8 var buffer = new ArrayBuffer(arguments.length); | 8 var buffer = new ArrayBuffer(arguments.length); |
9 var view = new Uint8Array(buffer); | 9 var view = new Uint8Array(buffer); |
10 for (var i = 0; i < arguments.length; i++) { | 10 for (var i = 0; i < arguments.length; i++) { |
(...skipping 30 matching lines...) Expand all Loading... |
41 view[6] = kWasmV2; | 41 view[6] = kWasmV2; |
42 view[7] = kWasmV3; | 42 view[7] = kWasmV3; |
43 for (var i = 0; i < arguments.length; i++) { | 43 for (var i = 0; i < arguments.length; i++) { |
44 var val = arguments[i]; | 44 var val = arguments[i]; |
45 if ((typeof val) == "string") val = val.charCodeAt(0); | 45 if ((typeof val) == "string") val = val.charCodeAt(0); |
46 view[kHeaderSize + i] = val | 0; | 46 view[kHeaderSize + i] = val | 0; |
47 } | 47 } |
48 return buffer; | 48 return buffer; |
49 } | 49 } |
50 | 50 |
| 51 var kDeclNoLocals = 0; |
| 52 |
51 // Section declaration constants | 53 // Section declaration constants |
52 var kDeclMemory = 0x00; | 54 var kDeclMemory = 0x00; |
53 var kDeclSignatures = 0x01; | 55 var kDeclSignatures = 0x01; |
54 var kDeclFunctions = 0x02; | 56 var kDeclFunctions = 0x02; |
55 var kDeclGlobals = 0x03; | 57 var kDeclGlobals = 0x03; |
56 var kDeclDataSegments = 0x04; | 58 var kDeclDataSegments = 0x04; |
57 var kDeclFunctionTable = 0x05; | 59 var kDeclFunctionTable = 0x05; |
58 var kDeclStartFunction = 0x07; | 60 var kDeclStartFunction = 0x07; |
59 var kDeclImportTable = 0x08; | 61 var kDeclImportTable = 0x08; |
60 var kDeclExportTable = 0x09; | 62 var kDeclExportTable = 0x09; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 } | 282 } |
281 threwException = false; | 283 threwException = false; |
282 } catch (e) { | 284 } catch (e) { |
283 assertEquals("string", typeof e); | 285 assertEquals("string", typeof e); |
284 assertEquals(kTrapMsgs[trap], e); | 286 assertEquals(kTrapMsgs[trap], e); |
285 // Success. | 287 // Success. |
286 return; | 288 return; |
287 } | 289 } |
288 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); | 290 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); |
289 } | 291 } |
OLD | NEW |