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++) { |
11 var val = arguments[i]; | 11 var val = arguments[i]; |
12 if ((typeof val) == "string") val = val.charCodeAt(0); | 12 if ((typeof val) == "string") val = val.charCodeAt(0); |
13 view[i] = val | 0; | 13 view[i] = val | 0; |
14 } | 14 } |
15 return buffer; | 15 return buffer; |
16 } | 16 } |
17 | 17 |
18 // Section declaration constants | 18 // Section declaration constants |
19 var kDeclMemory = 0x00; | 19 var kDeclMemory = 0x00; |
20 var kDeclSignatures = 0x01; | 20 var kDeclSignatures = 0x01; |
21 var kDeclFunctions = 0x02; | 21 var kDeclFunctions = 0x02; |
22 var kDeclGlobals = 0x03; | 22 var kDeclGlobals = 0x03; |
23 var kDeclDataSegments = 0x04; | 23 var kDeclDataSegments = 0x04; |
24 var kDeclFunctionTable = 0x05; | 24 var kDeclFunctionTable = 0x05; |
| 25 var kDeclStartFunction = 0x07; |
25 var kDeclEnd = 0x06; | 26 var kDeclEnd = 0x06; |
26 | 27 |
27 // Function declaration flags | 28 // Function declaration flags |
28 var kDeclFunctionName = 0x01; | 29 var kDeclFunctionName = 0x01; |
29 var kDeclFunctionImport = 0x02; | 30 var kDeclFunctionImport = 0x02; |
30 var kDeclFunctionLocals = 0x04; | 31 var kDeclFunctionLocals = 0x04; |
31 var kDeclFunctionExport = 0x08; | 32 var kDeclFunctionExport = 0x08; |
32 | 33 |
33 // Local types | 34 // Local types |
34 var kAstStmt = 0; | 35 var kAstStmt = 0; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 240 } |
240 threwException = false; | 241 threwException = false; |
241 } catch (e) { | 242 } catch (e) { |
242 assertEquals("string", typeof e); | 243 assertEquals("string", typeof e); |
243 assertEquals(kTrapMsgs[trap], e); | 244 assertEquals(kTrapMsgs[trap], e); |
244 // Success. | 245 // Success. |
245 return; | 246 return; |
246 } | 247 } |
247 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); | 248 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); |
248 } | 249 } |
OLD | NEW |