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 #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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 V(I32StoreMem8, 0x2e, i_ii) \ | 109 V(I32StoreMem8, 0x2e, i_ii) \ |
110 V(I32StoreMem16, 0x2f, i_ii) \ | 110 V(I32StoreMem16, 0x2f, i_ii) \ |
111 V(I64StoreMem8, 0x30, l_il) \ | 111 V(I64StoreMem8, 0x30, l_il) \ |
112 V(I64StoreMem16, 0x31, l_il) \ | 112 V(I64StoreMem16, 0x31, l_il) \ |
113 V(I64StoreMem32, 0x32, l_il) \ | 113 V(I64StoreMem32, 0x32, l_il) \ |
114 V(I32StoreMem, 0x33, i_ii) \ | 114 V(I32StoreMem, 0x33, i_ii) \ |
115 V(I64StoreMem, 0x34, l_il) \ | 115 V(I64StoreMem, 0x34, l_il) \ |
116 V(F32StoreMem, 0x35, f_if) \ | 116 V(F32StoreMem, 0x35, f_if) \ |
117 V(F64StoreMem, 0x36, d_id) | 117 V(F64StoreMem, 0x36, d_id) |
118 | 118 |
| 119 #define FOREACH_SIMPLE_MEM_OPCODE(V) V(GrowMemory, 0x39, i_i) |
| 120 |
119 // Load memory expressions. | 121 // Load memory expressions. |
120 #define FOREACH_MISC_MEM_OPCODE(V) \ | 122 #define FOREACH_MISC_MEM_OPCODE(V) \ |
121 V(GrowMemory, 0x39, i_i) \ | |
122 V(MemorySize, 0x3b, i_v) | 123 V(MemorySize, 0x3b, i_v) |
123 | 124 |
124 // Expressions with signatures. | 125 // Expressions with signatures. |
125 #define FOREACH_SIMPLE_OPCODE(V) \ | 126 #define FOREACH_SIMPLE_OPCODE(V) \ |
126 V(I32Add, 0x40, i_ii) \ | 127 V(I32Add, 0x40, i_ii) \ |
127 V(I32Sub, 0x41, i_ii) \ | 128 V(I32Sub, 0x41, i_ii) \ |
128 V(I32Mul, 0x42, i_ii) \ | 129 V(I32Mul, 0x42, i_ii) \ |
129 V(I32DivS, 0x43, i_ii) \ | 130 V(I32DivS, 0x43, i_ii) \ |
130 V(I32DivU, 0x44, i_ii) \ | 131 V(I32DivU, 0x44, i_ii) \ |
131 V(I32RemS, 0x45, i_ii) \ | 132 V(I32RemS, 0x45, i_ii) \ |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 V(S128And, 0xe576, s_ss) \ | 404 V(S128And, 0xe576, s_ss) \ |
404 V(S128Ior, 0xe577, s_ss) \ | 405 V(S128Ior, 0xe577, s_ss) \ |
405 V(S128Xor, 0xe578, s_ss) \ | 406 V(S128Xor, 0xe578, s_ss) \ |
406 V(S128Not, 0xe579, s_s) | 407 V(S128Not, 0xe579, s_s) |
407 | 408 |
408 // All opcodes. | 409 // All opcodes. |
409 #define FOREACH_OPCODE(V) \ | 410 #define FOREACH_OPCODE(V) \ |
410 FOREACH_CONTROL_OPCODE(V) \ | 411 FOREACH_CONTROL_OPCODE(V) \ |
411 FOREACH_MISC_OPCODE(V) \ | 412 FOREACH_MISC_OPCODE(V) \ |
412 FOREACH_SIMPLE_OPCODE(V) \ | 413 FOREACH_SIMPLE_OPCODE(V) \ |
| 414 FOREACH_SIMPLE_MEM_OPCODE(V) \ |
413 FOREACH_STORE_MEM_OPCODE(V) \ | 415 FOREACH_STORE_MEM_OPCODE(V) \ |
414 FOREACH_LOAD_MEM_OPCODE(V) \ | 416 FOREACH_LOAD_MEM_OPCODE(V) \ |
415 FOREACH_MISC_MEM_OPCODE(V) \ | 417 FOREACH_MISC_MEM_OPCODE(V) \ |
416 FOREACH_ASMJS_COMPAT_OPCODE(V) \ | 418 FOREACH_ASMJS_COMPAT_OPCODE(V) \ |
417 FOREACH_SIMD_OPCODE(V) | 419 FOREACH_SIMD_OPCODE(V) |
418 | 420 |
419 // All signatures. | 421 // All signatures. |
420 #define FOREACH_SIGNATURE(V) \ | 422 #define FOREACH_SIGNATURE(V) \ |
421 FOREACH_SIMD_SIGNATURE(V) \ | 423 FOREACH_SIMD_SIGNATURE(V) \ |
422 V(i_ii, kAstI32, kAstI32, kAstI32) \ | 424 V(i_ii, kAstI32, kAstI32, kAstI32) \ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 | 463 |
462 enum WasmOpcode { | 464 enum WasmOpcode { |
463 // Declare expression opcodes. | 465 // Declare expression opcodes. |
464 #define DECLARE_NAMED_ENUM(name, opcode, sig) kExpr##name = opcode, | 466 #define DECLARE_NAMED_ENUM(name, opcode, sig) kExpr##name = opcode, |
465 FOREACH_OPCODE(DECLARE_NAMED_ENUM) | 467 FOREACH_OPCODE(DECLARE_NAMED_ENUM) |
466 #undef DECLARE_NAMED_ENUM | 468 #undef DECLARE_NAMED_ENUM |
467 }; | 469 }; |
468 | 470 |
469 // The reason for a trap. | 471 // The reason for a trap. |
470 #define FOREACH_WASM_TRAPREASON(V) \ | 472 #define FOREACH_WASM_TRAPREASON(V) \ |
471 V(TrapUnreachable) \ | 473 V(TrapUnreachable) \ |
472 V(TrapMemOutOfBounds) \ | 474 V(TrapMemOutOfBounds) \ |
473 V(TrapDivByZero) \ | 475 V(TrapDivByZero) \ |
474 V(TrapDivUnrepresentable) \ | 476 V(TrapDivUnrepresentable) \ |
475 V(TrapRemByZero) \ | 477 V(TrapRemByZero) \ |
476 V(TrapFloatUnrepresentable) \ | 478 V(TrapFloatUnrepresentable) \ |
477 V(TrapFuncInvalid) \ | 479 V(TrapFuncInvalid) \ |
478 V(TrapFuncSigMismatch) | 480 V(TrapFuncSigMismatch) \ |
| 481 V(TrapMemAllocationFail) |
479 | 482 |
480 enum TrapReason { | 483 enum TrapReason { |
481 #define DECLARE_ENUM(name) k##name, | 484 #define DECLARE_ENUM(name) k##name, |
482 FOREACH_WASM_TRAPREASON(DECLARE_ENUM) | 485 FOREACH_WASM_TRAPREASON(DECLARE_ENUM) |
483 kTrapCount | 486 kTrapCount |
484 #undef DECLARE_ENUM | 487 #undef DECLARE_ENUM |
485 }; | 488 }; |
486 | 489 |
487 // A collection of opcode-related static methods. | 490 // A collection of opcode-related static methods. |
488 class WasmOpcodes { | 491 class WasmOpcodes { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 default: | 667 default: |
665 return "<unknown>"; | 668 return "<unknown>"; |
666 } | 669 } |
667 } | 670 } |
668 }; | 671 }; |
669 } // namespace wasm | 672 } // namespace wasm |
670 } // namespace internal | 673 } // namespace internal |
671 } // namespace v8 | 674 } // namespace v8 |
672 | 675 |
673 #endif // V8_WASM_OPCODES_H_ | 676 #endif // V8_WASM_OPCODES_H_ |
OLD | NEW |