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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 var kDeclFunctionTablePad = 0x0d; |
68 | 68 |
69 var kArity0 = 0; | 69 var kArity0 = 0; |
70 var kArity1 = 1; | 70 var kArity1 = 1; |
71 var kArity2 = 2; | 71 var kArity2 = 2; |
72 var kArity3 = 3; | 72 var kArity3 = 3; |
| 73 var kArity4 = 4; |
73 var kWasmFunctionTypeForm = 0x40; | 74 var kWasmFunctionTypeForm = 0x40; |
74 | 75 |
75 var section_names = [ | 76 var section_names = [ |
76 "memory", "type", "old_function", "global", "data", | 77 "memory", "type", "old_function", "global", "data", |
77 "table", "end", "start", "import", "export", | 78 "table", "end", "start", "import", "export", |
78 "function", "code", "name", "table_pad"]; | 79 "function", "code", "name", "table_pad"]; |
79 | 80 |
80 // Function declaration flags | 81 // Function declaration flags |
81 var kDeclFunctionName = 0x01; | 82 var kDeclFunctionName = 0x01; |
82 var kDeclFunctionImport = 0x02; | 83 var kDeclFunctionImport = 0x02; |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 341 } |
341 threwException = false; | 342 threwException = false; |
342 } catch (e) { | 343 } catch (e) { |
343 assertEquals("object", typeof e); | 344 assertEquals("object", typeof e); |
344 assertEquals(kTrapMsgs[trap], e.message); | 345 assertEquals(kTrapMsgs[trap], e.message); |
345 // Success. | 346 // Success. |
346 return; | 347 return; |
347 } | 348 } |
348 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); | 349 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); |
349 } | 350 } |
OLD | NEW |