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

Side by Side Diff: src/wasm/wasm-opcodes.h

Issue 1830663002: [wasm] Binary 11: AST changes. (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 #ifndef V8_WASM_OPCODES_H_ 5 #ifndef V8_WASM_OPCODES_H_
6 #define V8_WASM_OPCODES_H_ 6 #define V8_WASM_OPCODES_H_
7 7
8 #include "src/machine-type.h" 8 #include "src/machine-type.h"
9 #include "src/signature.h" 9 #include "src/signature.h"
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 }; 55 };
56 56
57 // TODO(titzer): Renumber all the opcodes to fill in holes. 57 // TODO(titzer): Renumber all the opcodes to fill in holes.
58 58
59 // Control expressions and blocks. 59 // Control expressions and blocks.
60 #define FOREACH_CONTROL_OPCODE(V) \ 60 #define FOREACH_CONTROL_OPCODE(V) \
61 V(Nop, 0x00, _) \ 61 V(Nop, 0x00, _) \
62 V(Block, 0x01, _) \ 62 V(Block, 0x01, _) \
63 V(Loop, 0x02, _) \ 63 V(Loop, 0x02, _) \
64 V(If, 0x03, _) \ 64 V(If, 0x03, _) \
65 V(IfElse, 0x04, _) \ 65 V(Else, 0x04, _) \
66 V(Select, 0x05, _) \ 66 V(Select, 0x05, _) \
67 V(Br, 0x06, _) \ 67 V(Br, 0x06, _) \
68 V(BrIf, 0x07, _) \ 68 V(BrIf, 0x07, _) \
69 V(BrTable, 0x08, _) \ 69 V(BrTable, 0x08, _) \
70 V(Return, 0x14, _) \ 70 V(Return, 0x14, _) \
71 V(Unreachable, 0x15, _) 71 V(Unreachable, 0x15, _) \
72 V(Next, 0x16, _) \
73 V(End, 0x17, _)
72 74
73 // Constants, locals, globals, and calls. 75 // Constants, locals, globals, and calls.
74 #define FOREACH_MISC_OPCODE(V) \ 76 #define FOREACH_MISC_OPCODE(V) \
75 V(I8Const, 0x09, _) \ 77 V(I8Const, 0x09, _) \
76 V(I32Const, 0x0a, _) \ 78 V(I32Const, 0x0a, _) \
77 V(I64Const, 0x0b, _) \ 79 V(I64Const, 0x0b, _) \
78 V(F64Const, 0x0c, _) \ 80 V(F64Const, 0x0c, _) \
79 V(F32Const, 0x0d, _) \ 81 V(F32Const, 0x0d, _) \
80 V(GetLocal, 0x0e, _) \ 82 V(GetLocal, 0x0e, _) \
81 V(SetLocal, 0x0f, _) \ 83 V(SetLocal, 0x0f, _) \
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 #define DECLARE_NAMED_ENUM(name, opcode, sig) kExpr##name = opcode, 307 #define DECLARE_NAMED_ENUM(name, opcode, sig) kExpr##name = opcode,
306 FOREACH_OPCODE(DECLARE_NAMED_ENUM) 308 FOREACH_OPCODE(DECLARE_NAMED_ENUM)
307 #undef DECLARE_NAMED_ENUM 309 #undef DECLARE_NAMED_ENUM
308 }; 310 };
309 311
310 // A collection of opcode-related static methods. 312 // A collection of opcode-related static methods.
311 class WasmOpcodes { 313 class WasmOpcodes {
312 public: 314 public:
313 static bool IsSupported(WasmOpcode opcode); 315 static bool IsSupported(WasmOpcode opcode);
314 static const char* OpcodeName(WasmOpcode opcode); 316 static const char* OpcodeName(WasmOpcode opcode);
317 static const char* ShortOpcodeName(WasmOpcode opcode);
315 static FunctionSig* Signature(WasmOpcode opcode); 318 static FunctionSig* Signature(WasmOpcode opcode);
316 319
317 static byte MemSize(MachineType type) { 320 static byte MemSize(MachineType type) {
318 return 1 << ElementSizeLog2Of(type.representation()); 321 return 1 << ElementSizeLog2Of(type.representation());
319 } 322 }
320 323
321 static LocalTypeCode LocalTypeCodeFor(LocalType type) { 324 static LocalTypeCode LocalTypeCodeFor(LocalType type) {
322 switch (type) { 325 switch (type) {
323 case kAstI32: 326 case kAstI32:
324 return kLocalI32; 327 return kLocalI32;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 default: 475 default:
473 return "<unknown>"; 476 return "<unknown>";
474 } 477 }
475 } 478 }
476 }; 479 };
477 } // namespace wasm 480 } // namespace wasm
478 } // namespace internal 481 } // namespace internal
479 } // namespace v8 482 } // namespace v8
480 483
481 #endif // V8_WASM_OPCODES_H_ 484 #endif // V8_WASM_OPCODES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698