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

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

Issue 1830663002: [wasm] Binary 11: AST changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « test/mjsunit/wasm/verify-function-simple.js ('k') | test/mjsunit/wasm/wasm-object-api.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 var kDeclDataSegments = 0x04; 58 var kDeclDataSegments = 0x04;
59 var kDeclFunctionTable = 0x05; 59 var kDeclFunctionTable = 0x05;
60 var kDeclEnd = 0x06; 60 var kDeclEnd = 0x06;
61 var kDeclStartFunction = 0x07; 61 var kDeclStartFunction = 0x07;
62 var kDeclImportTable = 0x08; 62 var kDeclImportTable = 0x08;
63 var kDeclExportTable = 0x09; 63 var kDeclExportTable = 0x09;
64 var kDeclFunctionSignatures = 0x0a; 64 var kDeclFunctionSignatures = 0x0a;
65 var kDeclFunctionBodies = 0x0b; 65 var kDeclFunctionBodies = 0x0b;
66 var kDeclNames = 0x0c; 66 var kDeclNames = 0x0c;
67 67
68 var kArity0 = 0;
69 var kArity1 = 1;
70 var kArity2 = 2;
71 var kArity3 = 3;
72
68 var section_names = [ 73 var section_names = [
69 "memory", "signatures", "functions", "globals", "data_segments", 74 "memory", "signatures", "functions", "globals", "data_segments",
70 "function_table", "end", "start_function", "import_table", "export_table", 75 "function_table", "end", "start_function", "import_table", "export_table",
71 "function_signatures", "function_bodies", "names"]; 76 "function_signatures", "function_bodies", "names"];
72 77
73 // Function declaration flags 78 // Function declaration flags
74 var kDeclFunctionName = 0x01; 79 var kDeclFunctionName = 0x01;
75 var kDeclFunctionImport = 0x02; 80 var kDeclFunctionImport = 0x02;
76 var kDeclFunctionLocals = 0x04; 81 var kDeclFunctionLocals = 0x04;
77 var kDeclFunctionExport = 0x08; 82 var kDeclFunctionExport = 0x08;
78 83
79 // Local types 84 // Local types
80 var kAstStmt = 0; 85 var kAstStmt = 0;
81 var kAstI32 = 1; 86 var kAstI32 = 1;
82 var kAstI64 = 2; 87 var kAstI64 = 2;
83 var kAstF32 = 3; 88 var kAstF32 = 3;
84 var kAstF64 = 4; 89 var kAstF64 = 4;
85 90
86 // Opcodes 91 // Opcodes
87 var kExprNop = 0x00; 92 var kExprNop = 0x00;
88 var kExprBlock = 0x01; 93 var kExprBlock = 0x01;
89 var kExprLoop = 0x02; 94 var kExprLoop = 0x02;
90 var kExprIf = 0x03; 95 var kExprIf = 0x03;
91 var kExprIfElse = 0x04; 96 var kExprElse = 0x04;
92 var kExprSelect = 0x05; 97 var kExprSelect = 0x05;
93 var kExprBr = 0x06; 98 var kExprBr = 0x06;
94 var kExprBrIf = 0x07; 99 var kExprBrIf = 0x07;
95 var kExprTableSwitch = 0x08; 100 var kExprBrTable = 0x08;
96 var kExprReturn = 0x14; 101 var kExprReturn = 0x09;
97 var kExprUnreachable = 0x15; 102 var kExprUnreachable = 0x0a;
103 var kExprEnd = 0x0f;
98 104
99 var kExprI8Const = 0x09; 105 var kExprI32Const = 0x10;
100 var kExprI32Const = 0x0a; 106 var kExprI64Const = 0x11;
101 var kExprI64Const = 0x0b; 107 var kExprF64Const = 0x12;
102 var kExprF64Const = 0x0c; 108 var kExprF32Const = 0x13;
103 var kExprF32Const = 0x0d; 109 var kExprGetLocal = 0x14;
104 var kExprGetLocal = 0x0e; 110 var kExprSetLocal = 0x15;
105 var kExprSetLocal = 0x0f; 111 var kExprCallFunction = 0x16;
106 var kExprLoadGlobal = 0x10; 112 var kExprCallIndirect = 0x17;
107 var kExprStoreGlobal = 0x11; 113 var kExprCallImport = 0x18;
108 var kExprCallFunction = 0x12; 114 var kExprI8Const = 0xcb;
109 var kExprCallIndirect = 0x13; 115 var kExprLoadGlobal = 0xcc;
110 var kExprCallImport = 0x1F; 116 var kExprStoreGlobal = 0xcd;
111 117
112 var kExprI32LoadMem8S = 0x20; 118 var kExprI32LoadMem8S = 0x20;
113 var kExprI32LoadMem8U = 0x21; 119 var kExprI32LoadMem8U = 0x21;
114 var kExprI32LoadMem16S = 0x22; 120 var kExprI32LoadMem16S = 0x22;
115 var kExprI32LoadMem16U = 0x23; 121 var kExprI32LoadMem16U = 0x23;
116 var kExprI64LoadMem8S = 0x24; 122 var kExprI64LoadMem8S = 0x24;
117 var kExprI64LoadMem8U = 0x25; 123 var kExprI64LoadMem8U = 0x25;
118 var kExprI64LoadMem16S = 0x26; 124 var kExprI64LoadMem16S = 0x26;
119 var kExprI64LoadMem16U = 0x27; 125 var kExprI64LoadMem16U = 0x27;
120 var kExprI64LoadMem32S = 0x28; 126 var kExprI64LoadMem32S = 0x28;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 296 }
291 threwException = false; 297 threwException = false;
292 } catch (e) { 298 } catch (e) {
293 assertEquals("object", typeof e); 299 assertEquals("object", typeof e);
294 assertEquals(kTrapMsgs[trap], e.message); 300 assertEquals(kTrapMsgs[trap], e.message);
295 // Success. 301 // Success.
296 return; 302 return;
297 } 303 }
298 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] ); 304 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap] );
299 } 305 }
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/verify-function-simple.js ('k') | test/mjsunit/wasm/wasm-object-api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698