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; | |
74 var kWasmFunctionTypeForm = 0x40; | 73 var kWasmFunctionTypeForm = 0x40; |
75 | 74 |
76 var section_names = [ | 75 var section_names = [ |
77 "memory", "type", "old_function", "global", "data", | 76 "memory", "type", "old_function", "global", "data", |
78 "table", "end", "start", "import", "export", | 77 "table", "end", "start", "import", "export", |
79 "function", "code", "name", "table_pad"]; | 78 "function", "code", "name", "table_pad"]; |
80 | 79 |
81 // Function declaration flags | 80 // Function declaration flags |
82 var kDeclFunctionName = 0x01; | 81 var kDeclFunctionName = 0x01; |
83 var kDeclFunctionImport = 0x02; | 82 var kDeclFunctionImport = 0x02; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 } | 343 } |
345 threwException = false; | 344 threwException = false; |
346 } catch (e) { | 345 } catch (e) { |
347 assertEquals("object", typeof e); | 346 assertEquals("object", typeof e); |
348 assertEquals(kTrapMsgs[trap], e.message); | 347 assertEquals(kTrapMsgs[trap], e.message); |
349 // Success. | 348 // Success. |
350 return; | 349 return; |
351 } | 350 } |
352 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); | 351 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); |
353 } | 352 } |
OLD | NEW |