OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64_SIMULATOR_ARM64_H_ | 5 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ |
6 #define V8_ARM64_SIMULATOR_ARM64_H_ | 6 #define V8_ARM64_SIMULATOR_ARM64_H_ |
7 | 7 |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { | 66 static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { |
67 return try_catch_address; | 67 return try_catch_address; |
68 } | 68 } |
69 | 69 |
70 static void UnregisterCTryCatch() { } | 70 static void UnregisterCTryCatch() { } |
71 }; | 71 }; |
72 | 72 |
73 #else // !defined(USE_SIMULATOR) | 73 #else // !defined(USE_SIMULATOR) |
74 | 74 |
75 enum ReverseByteMode { | |
76 Reverse16 = 0, | |
77 Reverse32 = 1, | |
78 Reverse64 = 2 | |
79 }; | |
80 | |
81 | 75 |
82 // The proper way to initialize a simulated system register (such as NZCV) is as | 76 // The proper way to initialize a simulated system register (such as NZCV) is as |
83 // follows: | 77 // follows: |
84 // SimSystemRegister nzcv = SimSystemRegister::DefaultValueFor(NZCV); | 78 // SimSystemRegister nzcv = SimSystemRegister::DefaultValueFor(NZCV); |
85 class SimSystemRegister { | 79 class SimSystemRegister { |
86 public: | 80 public: |
87 // The default constructor represents a register which has no writable bits. | 81 // The default constructor represents a register which has no writable bits. |
88 // It is not possible to set its value to anything other than 0. | 82 // It is not possible to set its value to anything other than 0. |
89 SimSystemRegister() : value_(0), write_ignore_mask_(0xffffffff) { } | 83 SimSystemRegister() : value_(0), write_ignore_mask_(0xffffffff) { } |
90 | 84 |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 T ExtendValue(T value, | 693 T ExtendValue(T value, |
700 Extend extend_type, | 694 Extend extend_type, |
701 unsigned left_shift = 0); | 695 unsigned left_shift = 0); |
702 template <typename T> | 696 template <typename T> |
703 void Extract(Instruction* instr); | 697 void Extract(Instruction* instr); |
704 template <typename T> | 698 template <typename T> |
705 void DataProcessing2Source(Instruction* instr); | 699 void DataProcessing2Source(Instruction* instr); |
706 template <typename T> | 700 template <typename T> |
707 void BitfieldHelper(Instruction* instr); | 701 void BitfieldHelper(Instruction* instr); |
708 | 702 |
709 uint64_t ReverseBits(uint64_t value, unsigned num_bits); | |
710 uint64_t ReverseBytes(uint64_t value, ReverseByteMode mode); | |
711 | |
712 template <typename T> | 703 template <typename T> |
713 T FPDefaultNaN() const; | 704 T FPDefaultNaN() const; |
714 | 705 |
715 void FPCompare(double val0, double val1); | 706 void FPCompare(double val0, double val1); |
716 double FPRoundInt(double value, FPRounding round_mode); | 707 double FPRoundInt(double value, FPRounding round_mode); |
717 double FPToDouble(float value); | 708 double FPToDouble(float value); |
718 float FPToFloat(double value, FPRounding round_mode); | 709 float FPToFloat(double value, FPRounding round_mode); |
719 double FixedToDouble(int64_t src, int fbits, FPRounding round_mode); | 710 double FixedToDouble(int64_t src, int fbits, FPRounding round_mode); |
720 double UFixedToDouble(uint64_t src, int fbits, FPRounding round_mode); | 711 double UFixedToDouble(uint64_t src, int fbits, FPRounding round_mode); |
721 float FixedToFloat(int64_t src, int fbits, FPRounding round_mode); | 712 float FixedToFloat(int64_t src, int fbits, FPRounding round_mode); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 }; | 868 }; |
878 | 869 |
879 | 870 |
880 // When running with the simulator transition into simulated execution at this | 871 // When running with the simulator transition into simulated execution at this |
881 // point. | 872 // point. |
882 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ | 873 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ |
883 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->CallJS( \ | 874 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->CallJS( \ |
884 FUNCTION_ADDR(entry), \ | 875 FUNCTION_ADDR(entry), \ |
885 p0, p1, p2, p3, p4)) | 876 p0, p1, p2, p3, p4)) |
886 | 877 |
887 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ | 878 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ |
888 Simulator::current(Isolate::Current())->CallRegExp( \ | 879 static_cast<int>( \ |
889 entry, \ | 880 Simulator::current(Isolate::Current()) \ |
890 p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8) | 881 ->CallRegExp(entry, p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8)) |
891 | 882 |
892 | 883 |
893 // The simulator has its own stack. Thus it has a different stack limit from | 884 // The simulator has its own stack. Thus it has a different stack limit from |
894 // the C-based native code. | 885 // the C-based native code. |
895 // See also 'class SimulatorStack' in arm/simulator-arm.h. | 886 // See also 'class SimulatorStack' in arm/simulator-arm.h. |
896 class SimulatorStack : public v8::internal::AllStatic { | 887 class SimulatorStack : public v8::internal::AllStatic { |
897 public: | 888 public: |
898 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, | 889 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, |
899 uintptr_t c_limit) { | 890 uintptr_t c_limit) { |
900 return Simulator::current(isolate)->StackLimit(); | 891 return Simulator::current(isolate)->StackLimit(); |
901 } | 892 } |
902 | 893 |
903 static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { | 894 static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { |
904 Simulator* sim = Simulator::current(Isolate::Current()); | 895 Simulator* sim = Simulator::current(Isolate::Current()); |
905 return sim->PushAddress(try_catch_address); | 896 return sim->PushAddress(try_catch_address); |
906 } | 897 } |
907 | 898 |
908 static void UnregisterCTryCatch() { | 899 static void UnregisterCTryCatch() { |
909 Simulator::current(Isolate::Current())->PopAddress(); | 900 Simulator::current(Isolate::Current())->PopAddress(); |
910 } | 901 } |
911 }; | 902 }; |
912 | 903 |
913 #endif // !defined(USE_SIMULATOR) | 904 #endif // !defined(USE_SIMULATOR) |
914 | 905 |
915 } } // namespace v8::internal | 906 } } // namespace v8::internal |
916 | 907 |
917 #endif // V8_ARM64_SIMULATOR_ARM64_H_ | 908 #endif // V8_ARM64_SIMULATOR_ARM64_H_ |
OLD | NEW |