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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 var kDeclNoLocals = 0; | 51 var kDeclNoLocals = 0; |
52 | 52 |
53 // Section declaration constants | 53 // Section declaration constants |
54 var kDeclMemory = 0x00; | 54 var kDeclMemory = 0x00; |
55 var kDeclSignatures = 0x01; | 55 var kDeclSignatures = 0x01; |
56 var kDeclFunctions = 0x02; | 56 var kDeclFunctions = 0x02; |
57 var kDeclGlobals = 0x03; | 57 var kDeclGlobals = 0x03; |
58 var kDeclDataSegments = 0x04; | 58 var kDeclDataSegments = 0x04; |
59 var kDeclFunctionTable = 0x05; | 59 var kDeclFunctionTable = 0x05; |
| 60 var kDeclEnd = 0x06; |
60 var kDeclStartFunction = 0x07; | 61 var kDeclStartFunction = 0x07; |
61 var kDeclImportTable = 0x08; | 62 var kDeclImportTable = 0x08; |
62 var kDeclExportTable = 0x09; | 63 var kDeclExportTable = 0x09; |
63 var kDeclEnd = 0x06; | |
64 var kDeclFunctionSignatures = 0x0a; | 64 var kDeclFunctionSignatures = 0x0a; |
65 var kDeclFunctionBodies = 0x0b; | 65 var kDeclFunctionBodies = 0x0b; |
66 var kDeclNames = 0x0c; | 66 var kDeclNames = 0x0c; |
67 | 67 |
| 68 var section_names = [ |
| 69 "memory", "signatures", "functions", "globals", "data_segments", |
| 70 "function_table", "end", "start_function", "import_table", "export_table", |
| 71 "function_signatures", "function_bodies", "names"]; |
| 72 |
68 // Function declaration flags | 73 // Function declaration flags |
69 var kDeclFunctionName = 0x01; | 74 var kDeclFunctionName = 0x01; |
70 var kDeclFunctionImport = 0x02; | 75 var kDeclFunctionImport = 0x02; |
71 var kDeclFunctionLocals = 0x04; | 76 var kDeclFunctionLocals = 0x04; |
72 var kDeclFunctionExport = 0x08; | 77 var kDeclFunctionExport = 0x08; |
73 | 78 |
74 // Local types | 79 // Local types |
75 var kAstStmt = 0; | 80 var kAstStmt = 0; |
76 var kAstI32 = 1; | 81 var kAstI32 = 1; |
77 var kAstI64 = 2; | 82 var kAstI64 = 2; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 } | 290 } |
286 threwException = false; | 291 threwException = false; |
287 } catch (e) { | 292 } catch (e) { |
288 assertEquals("string", typeof e); | 293 assertEquals("string", typeof e); |
289 assertEquals(kTrapMsgs[trap], e); | 294 assertEquals(kTrapMsgs[trap], e); |
290 // Success. | 295 // Success. |
291 return; | 296 return; |
292 } | 297 } |
293 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); | 298 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); |
294 } | 299 } |
OLD | NEW |