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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // We reuse the internal machine type to represent WebAssembly types. | 30 // We reuse the internal machine type to represent WebAssembly types. |
31 // A typedef improves readability without adding a whole new type system. | 31 // A typedef improves readability without adding a whole new type system. |
32 typedef MachineRepresentation ValueType; | 32 typedef MachineRepresentation ValueType; |
33 const ValueType kWasmStmt = MachineRepresentation::kNone; | 33 const ValueType kWasmStmt = MachineRepresentation::kNone; |
34 const ValueType kWasmI32 = MachineRepresentation::kWord32; | 34 const ValueType kWasmI32 = MachineRepresentation::kWord32; |
35 const ValueType kWasmI64 = MachineRepresentation::kWord64; | 35 const ValueType kWasmI64 = MachineRepresentation::kWord64; |
36 const ValueType kWasmF32 = MachineRepresentation::kFloat32; | 36 const ValueType kWasmF32 = MachineRepresentation::kFloat32; |
37 const ValueType kWasmF64 = MachineRepresentation::kFloat64; | 37 const ValueType kWasmF64 = MachineRepresentation::kFloat64; |
38 const ValueType kWasmS128 = MachineRepresentation::kSimd128; | 38 const ValueType kWasmS128 = MachineRepresentation::kSimd128; |
39 // We use kTagged here because kNone is already used by kWasmStmt. | 39 const ValueType kWasmVar = MachineRepresentation::kTagged; |
40 const ValueType kWasmEnd = MachineRepresentation::kTagged; | |
41 | 40 |
42 typedef Signature<ValueType> FunctionSig; | 41 typedef Signature<ValueType> FunctionSig; |
43 std::ostream& operator<<(std::ostream& os, const FunctionSig& function); | 42 std::ostream& operator<<(std::ostream& os, const FunctionSig& function); |
44 | 43 |
45 typedef Vector<const char> WasmName; | 44 typedef Vector<const char> WasmName; |
46 | 45 |
47 typedef int WasmCodePosition; | 46 typedef int WasmCodePosition; |
48 const WasmCodePosition kNoCodePosition = -1; | 47 const WasmCodePosition kNoCodePosition = -1; |
49 | 48 |
50 // Control expressions and blocks. | 49 // Control expressions and blocks. |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 case kWasmI64: | 641 case kWasmI64: |
643 return 'l'; | 642 return 'l'; |
644 case kWasmF32: | 643 case kWasmF32: |
645 return 'f'; | 644 return 'f'; |
646 case kWasmF64: | 645 case kWasmF64: |
647 return 'd'; | 646 return 'd'; |
648 case kWasmS128: | 647 case kWasmS128: |
649 return 's'; | 648 return 's'; |
650 case kWasmStmt: | 649 case kWasmStmt: |
651 return 'v'; | 650 return 'v'; |
652 case kWasmEnd: | 651 case kWasmVar: |
653 return 'x'; | 652 return '*'; |
654 default: | 653 default: |
655 UNREACHABLE(); | |
656 return '?'; | 654 return '?'; |
657 } | 655 } |
658 } | 656 } |
659 | 657 |
660 static const char* TypeName(ValueType type) { | 658 static const char* TypeName(ValueType type) { |
661 switch (type) { | 659 switch (type) { |
662 case kWasmI32: | 660 case kWasmI32: |
663 return "i32"; | 661 return "i32"; |
664 case kWasmI64: | 662 case kWasmI64: |
665 return "i64"; | 663 return "i64"; |
666 case kWasmF32: | 664 case kWasmF32: |
667 return "f32"; | 665 return "f32"; |
668 case kWasmF64: | 666 case kWasmF64: |
669 return "f64"; | 667 return "f64"; |
670 case kWasmS128: | 668 case kWasmS128: |
671 return "s128"; | 669 return "s128"; |
672 case kWasmStmt: | 670 case kWasmStmt: |
673 return "<stmt>"; | 671 return "<stmt>"; |
674 case kWasmEnd: | 672 case kWasmVar: |
675 return "<end>"; | 673 return "<var>"; |
676 default: | 674 default: |
677 return "<unknown>"; | 675 return "<unknown>"; |
678 } | 676 } |
679 } | 677 } |
680 }; | 678 }; |
681 } // namespace wasm | 679 } // namespace wasm |
682 } // namespace internal | 680 } // namespace internal |
683 } // namespace v8 | 681 } // namespace v8 |
684 | 682 |
685 #endif // V8_WASM_OPCODES_H_ | 683 #endif // V8_WASM_OPCODES_H_ |
OLD | NEW |