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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 var kDeclGlobals = 0x03; | 57 var kDeclGlobals = 0x03; |
58 var kDeclData = 0x04; | 58 var kDeclData = 0x04; |
59 var kDeclTable = 0x05; | 59 var kDeclTable = 0x05; |
60 var kDeclEnd = 0x06; | 60 var kDeclEnd = 0x06; |
61 var kDeclStart = 0x07; | 61 var kDeclStart = 0x07; |
62 var kDeclImports = 0x08; | 62 var kDeclImports = 0x08; |
63 var kDeclExports = 0x09; | 63 var kDeclExports = 0x09; |
64 var kDeclFunctions = 0x0a; | 64 var kDeclFunctions = 0x0a; |
65 var kDeclCode = 0x0b; | 65 var kDeclCode = 0x0b; |
66 var kDeclNames = 0x0c; | 66 var kDeclNames = 0x0c; |
67 var kDeclFunctionTablePad = 0x0d; | |
68 | 67 |
69 var kArity0 = 0; | 68 var kArity0 = 0; |
70 var kArity1 = 1; | 69 var kArity1 = 1; |
71 var kArity2 = 2; | 70 var kArity2 = 2; |
72 var kArity3 = 3; | 71 var kArity3 = 3; |
73 var kWasmFunctionTypeForm = 0x40; | 72 var kWasmFunctionTypeForm = 0x40; |
74 | 73 |
75 var section_names = [ | 74 var section_names = [ |
76 "memory", "type", "old_function", "global", "data", | 75 "memory", "type", "old_function", "global", "data", |
77 "table", "end", "start", "import", "export", | 76 "table", "end", "start", "import", "export", |
78 "function", "code", "name", "table_pad"]; | 77 "function", "code", "name"]; |
79 | 78 |
80 // Function declaration flags | 79 // Function declaration flags |
81 var kDeclFunctionName = 0x01; | 80 var kDeclFunctionName = 0x01; |
82 var kDeclFunctionImport = 0x02; | 81 var kDeclFunctionImport = 0x02; |
83 var kDeclFunctionLocals = 0x04; | 82 var kDeclFunctionLocals = 0x04; |
84 var kDeclFunctionExport = 0x08; | 83 var kDeclFunctionExport = 0x08; |
85 | 84 |
86 // Local types | 85 // Local types |
87 var kAstStmt = 0; | 86 var kAstStmt = 0; |
88 var kAstI32 = 1; | 87 var kAstI32 = 1; |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 } | 342 } |
344 threwException = false; | 343 threwException = false; |
345 } catch (e) { | 344 } catch (e) { |
346 assertEquals("object", typeof e); | 345 assertEquals("object", typeof e); |
347 assertEquals(kTrapMsgs[trap], e.message); | 346 assertEquals(kTrapMsgs[trap], e.message); |
348 // Success. | 347 // Success. |
349 return; | 348 return; |
350 } | 349 } |
351 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); | 350 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); |
352 } | 351 } |
OLD | NEW |