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; |
67 | 68 |
68 var kArity0 = 0; | 69 var kArity0 = 0; |
69 var kArity1 = 1; | 70 var kArity1 = 1; |
70 var kArity2 = 2; | 71 var kArity2 = 2; |
71 var kArity3 = 3; | 72 var kArity3 = 3; |
72 var kWasmFunctionTypeForm = 0x40; | 73 var kWasmFunctionTypeForm = 0x40; |
73 | 74 |
74 var section_names = [ | 75 var section_names = [ |
75 "memory", "type", "old_function", "global", "data", | 76 "memory", "type", "old_function", "global", "data", |
76 "table", "end", "start", "import", "export", | 77 "table", "end", "start", "import", "export", |
77 "function", "code", "name"]; | 78 "function", "code", "name", "table_pad"]; |
78 | 79 |
79 // Function declaration flags | 80 // Function declaration flags |
80 var kDeclFunctionName = 0x01; | 81 var kDeclFunctionName = 0x01; |
81 var kDeclFunctionImport = 0x02; | 82 var kDeclFunctionImport = 0x02; |
82 var kDeclFunctionLocals = 0x04; | 83 var kDeclFunctionLocals = 0x04; |
83 var kDeclFunctionExport = 0x08; | 84 var kDeclFunctionExport = 0x08; |
84 | 85 |
85 // Local types | 86 // Local types |
86 var kAstStmt = 0; | 87 var kAstStmt = 0; |
87 var kAstI32 = 1; | 88 var kAstI32 = 1; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 334 } |
334 threwException = false; | 335 threwException = false; |
335 } catch (e) { | 336 } catch (e) { |
336 assertEquals("object", typeof e); | 337 assertEquals("object", typeof e); |
337 assertEquals(kTrapMsgs[trap], e.message); | 338 assertEquals(kTrapMsgs[trap], e.message); |
338 // Success. | 339 // Success. |
339 return; | 340 return; |
340 } | 341 } |
341 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); | 342 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); |
342 } | 343 } |
OLD | NEW |