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/globals.h" | 8 #include "src/globals.h" |
9 #include "src/machine-type.h" | 9 #include "src/machine-type.h" |
10 #include "src/runtime/runtime.h" | 10 #include "src/runtime/runtime.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 kLocalS1x8 = 0x79, | 26 kLocalS1x8 = 0x79, |
27 kLocalS1x16 = 0x78 | 27 kLocalS1x16 = 0x78 |
28 }; | 28 }; |
29 | 29 |
30 // Type code for multi-value block types. | 30 // Type code for multi-value block types. |
31 static const uint8_t kMultivalBlock = 0x41; | 31 static const uint8_t kMultivalBlock = 0x41; |
32 | 32 |
33 // We reuse the internal machine type to represent WebAssembly types. | 33 // We reuse the internal machine type to represent WebAssembly types. |
34 // A typedef improves readability without adding a whole new type system. | 34 // A typedef improves readability without adding a whole new type system. |
35 typedef MachineRepresentation ValueType; | 35 typedef MachineRepresentation ValueType; |
36 const ValueType kWasmStmt = MachineRepresentation::kNone; | 36 constexpr ValueType kWasmStmt = MachineRepresentation::kNone; |
37 const ValueType kWasmI32 = MachineRepresentation::kWord32; | 37 constexpr ValueType kWasmI32 = MachineRepresentation::kWord32; |
38 const ValueType kWasmI64 = MachineRepresentation::kWord64; | 38 constexpr ValueType kWasmI64 = MachineRepresentation::kWord64; |
39 const ValueType kWasmF32 = MachineRepresentation::kFloat32; | 39 constexpr ValueType kWasmF32 = MachineRepresentation::kFloat32; |
40 const ValueType kWasmF64 = MachineRepresentation::kFloat64; | 40 constexpr ValueType kWasmF64 = MachineRepresentation::kFloat64; |
41 const ValueType kWasmS128 = MachineRepresentation::kSimd128; | 41 constexpr ValueType kWasmS128 = MachineRepresentation::kSimd128; |
42 const ValueType kWasmS1x4 = MachineRepresentation::kSimd1x4; | 42 constexpr ValueType kWasmS1x4 = MachineRepresentation::kSimd1x4; |
43 const ValueType kWasmS1x8 = MachineRepresentation::kSimd1x8; | 43 constexpr ValueType kWasmS1x8 = MachineRepresentation::kSimd1x8; |
44 const ValueType kWasmS1x16 = MachineRepresentation::kSimd1x16; | 44 constexpr ValueType kWasmS1x16 = MachineRepresentation::kSimd1x16; |
45 const ValueType kWasmVar = MachineRepresentation::kTagged; | 45 constexpr ValueType kWasmVar = MachineRepresentation::kTagged; |
46 | 46 |
47 typedef Signature<ValueType> FunctionSig; | 47 typedef Signature<ValueType> FunctionSig; |
48 std::ostream& operator<<(std::ostream& os, const FunctionSig& function); | 48 std::ostream& operator<<(std::ostream& os, const FunctionSig& function); |
49 | 49 |
50 typedef Vector<const char> WasmName; | 50 typedef Vector<const char> WasmName; |
51 | 51 |
52 typedef int WasmCodePosition; | 52 typedef int WasmCodePosition; |
53 const WasmCodePosition kNoCodePosition = -1; | 53 constexpr WasmCodePosition kNoCodePosition = -1; |
54 | 54 |
55 // Control expressions and blocks. | 55 // Control expressions and blocks. |
56 #define FOREACH_CONTROL_OPCODE(V) \ | 56 #define FOREACH_CONTROL_OPCODE(V) \ |
57 V(Unreachable, 0x00, _) \ | 57 V(Unreachable, 0x00, _) \ |
58 V(Nop, 0x01, _) \ | 58 V(Nop, 0x01, _) \ |
59 V(Block, 0x02, _) \ | 59 V(Block, 0x02, _) \ |
60 V(Loop, 0x03, _) \ | 60 V(Loop, 0x03, _) \ |
61 V(If, 0x004, _) \ | 61 V(If, 0x004, _) \ |
62 V(Else, 0x05, _) \ | 62 V(Else, 0x05, _) \ |
63 V(Try, 0x06, _ /* eh_prototype */) \ | 63 V(Try, 0x06, _ /* eh_prototype */) \ |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 default: | 710 default: |
711 return "<unknown>"; | 711 return "<unknown>"; |
712 } | 712 } |
713 } | 713 } |
714 }; | 714 }; |
715 } // namespace wasm | 715 } // namespace wasm |
716 } // namespace internal | 716 } // namespace internal |
717 } // namespace v8 | 717 } // namespace v8 |
718 | 718 |
719 #endif // V8_WASM_OPCODES_H_ | 719 #endif // V8_WASM_OPCODES_H_ |
OLD | NEW |