| 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 case kWasmI64: | 642 case kWasmI64: |
| 644 return 'l'; | 643 return 'l'; |
| 645 case kWasmF32: | 644 case kWasmF32: |
| 646 return 'f'; | 645 return 'f'; |
| 647 case kWasmF64: | 646 case kWasmF64: |
| 648 return 'd'; | 647 return 'd'; |
| 649 case kWasmS128: | 648 case kWasmS128: |
| 650 return 's'; | 649 return 's'; |
| 651 case kWasmStmt: | 650 case kWasmStmt: |
| 652 return 'v'; | 651 return 'v'; |
| 653 case kWasmEnd: | 652 case kWasmVar: |
| 654 return 'x'; | 653 return '*'; |
| 655 default: | 654 default: |
| 656 UNREACHABLE(); | |
| 657 return '?'; | 655 return '?'; |
| 658 } | 656 } |
| 659 } | 657 } |
| 660 | 658 |
| 661 static const char* TypeName(ValueType type) { | 659 static const char* TypeName(ValueType type) { |
| 662 switch (type) { | 660 switch (type) { |
| 663 case kWasmI32: | 661 case kWasmI32: |
| 664 return "i32"; | 662 return "i32"; |
| 665 case kWasmI64: | 663 case kWasmI64: |
| 666 return "i64"; | 664 return "i64"; |
| 667 case kWasmF32: | 665 case kWasmF32: |
| 668 return "f32"; | 666 return "f32"; |
| 669 case kWasmF64: | 667 case kWasmF64: |
| 670 return "f64"; | 668 return "f64"; |
| 671 case kWasmS128: | 669 case kWasmS128: |
| 672 return "s128"; | 670 return "s128"; |
| 673 case kWasmStmt: | 671 case kWasmStmt: |
| 674 return "<stmt>"; | 672 return "<stmt>"; |
| 675 case kWasmEnd: | 673 case kWasmVar: |
| 676 return "<end>"; | 674 return "<var>"; |
| 677 default: | 675 default: |
| 678 return "<unknown>"; | 676 return "<unknown>"; |
| 679 } | 677 } |
| 680 } | 678 } |
| 681 }; | 679 }; |
| 682 } // namespace wasm | 680 } // namespace wasm |
| 683 } // namespace internal | 681 } // namespace internal |
| 684 } // namespace v8 | 682 } // namespace v8 |
| 685 | 683 |
| 686 #endif // V8_WASM_OPCODES_H_ | 684 #endif // V8_WASM_OPCODES_H_ |
| OLD | NEW |