Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: test/mjsunit/wasm/wasm-constants.js

Issue 1763433002: [wasm] Rework encoding of local declarations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 29 matching lines...) Expand all
40 view[6] = kWasmV2; 40 view[6] = kWasmV2;
41 view[7] = kWasmV3; 41 view[7] = kWasmV3;
42 for (var i = 0; i < arguments.length; i++) { 42 for (var i = 0; i < arguments.length; i++) {
43 var val = arguments[i]; 43 var val = arguments[i];
44 if ((typeof val) == "string") val = val.charCodeAt(0); 44 if ((typeof val) == "string") val = val.charCodeAt(0);
45 view[kHeaderSize + i] = val | 0; 45 view[kHeaderSize + i] = val | 0;
46 } 46 }
47 return buffer; 47 return buffer;
48 } 48 }
49 49
50 var kDeclNoLocals = 0;
51
50 // Section declaration constants 52 // Section declaration constants
51 var kDeclMemory = 0x00; 53 var kDeclMemory = 0x00;
52 var kDeclSignatures = 0x01; 54 var kDeclSignatures = 0x01;
53 var kDeclFunctions = 0x02; 55 var kDeclFunctions = 0x02;
54 var kDeclGlobals = 0x03; 56 var kDeclGlobals = 0x03;
55 var kDeclDataSegments = 0x04; 57 var kDeclDataSegments = 0x04;
56 var kDeclFunctionTable = 0x05; 58 var kDeclFunctionTable = 0x05;
57 var kDeclStartFunction = 0x07; 59 var kDeclStartFunction = 0x07;
58 var kDeclImportTable = 0x08; 60 var kDeclImportTable = 0x08;
59 var kDeclExportTable = 0x09; 61 var kDeclExportTable = 0x09;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 } 277 }
276 threwException = false; 278 threwException = false;
277 } catch (e) { 279 } catch (e) {
278 assertEquals("string", typeof e); 280 assertEquals("string", typeof e);
279 assertEquals(kTrapMsgs[trap], e); 281 assertEquals(kTrapMsgs[trap], e);
280 // Success. 282 // Success.
281 return; 283 return;
282 } 284 }
283 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] ); 285 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] );
284 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698