diff options
Diffstat (limited to 'deps/v8/src/arm/simulator-arm.h')
-rw-r--r-- | deps/v8/src/arm/simulator-arm.h | 79 |
1 files changed, 74 insertions, 5 deletions
diff --git a/deps/v8/src/arm/simulator-arm.h b/deps/v8/src/arm/simulator-arm.h index ff6bbf4302..3a4bb311be 100644 --- a/deps/v8/src/arm/simulator-arm.h +++ b/deps/v8/src/arm/simulator-arm.h @@ -52,6 +52,12 @@ class SimulatorStack : public v8::internal::AllStatic { static inline uintptr_t JsLimitFromCLimit(uintptr_t c_limit) { return c_limit; } + + static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { + return try_catch_address; + } + + static inline void UnregisterCTryCatch() { } }; @@ -60,6 +66,10 @@ class SimulatorStack : public v8::internal::AllStatic { #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \ entry(p0, p1, p2, p3, p4, p5, p6) +#define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ + reinterpret_cast<TryCatch*>(try_catch_address) + + #else // defined(__arm__) // When running with the simulator transition into simulated execution at this @@ -73,6 +83,11 @@ class SimulatorStack : public v8::internal::AllStatic { assembler::arm::Simulator::current()->Call( \ FUNCTION_ADDR(entry), 7, p0, p1, p2, p3, p4, p5, p6) +#define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ + try_catch_address == NULL ? \ + NULL : *(reinterpret_cast<TryCatch**>(try_catch_address)) + + #include "constants-arm.h" @@ -82,7 +97,6 @@ namespace arm { class Simulator { public: friend class Debugger; - enum Register { no_reg = -1, r0 = 0, r1, r2, r3, r4, r5, r6, r7, @@ -90,7 +104,15 @@ class Simulator { num_registers, sp = 13, lr = 14, - pc = 15 + pc = 15, + s0 = 0, s1, s2, s3, s4, s5, s6, s7, + s8, s9, s10, s11, s12, s13, s14, s15, + s16, s17, s18, s19, s20, s21, s22, s23, + s24, s25, s26, s27, s28, s29, s30, s31, + num_s_registers = 32, + d0 = 0, d1, d2, d3, d4, d5, d6, d7, + d8, d9, d10, d11, d12, d13, d14, d15, + num_d_registers = 16 }; Simulator(); @@ -106,6 +128,16 @@ class Simulator { void set_register(int reg, int32_t value); int32_t get_register(int reg) const; + // Support for VFP. + void set_s_register(int reg, unsigned int value); + unsigned int get_s_register(int reg) const; + void set_d_register_from_double(int dreg, const double& dbl); + double get_double_from_d_register(int dreg); + void set_s_register_from_float(int sreg, const float dbl); + float get_float_from_s_register(int sreg); + void set_s_register_from_sinteger(int reg, const int value); + int get_sinteger_from_s_register(int reg); + // Special case of set_register and get_register to access the raw PC value. void set_pc(int32_t value); int32_t get_pc() const; @@ -124,6 +156,12 @@ class Simulator { // which sets up the simulator state and grabs the result on return. int32_t Call(byte* entry, int argument_count, ...); + // Push an address onto the JS stack. + uintptr_t PushAddress(uintptr_t address); + + // Pop an address from the JS stack. + uintptr_t PopAddress(); + private: enum special_values { // Known bad pc value to ensure that the simulator does not execute @@ -154,6 +192,10 @@ class Simulator { int32_t right, bool addition); + // Support for VFP. + void Compute_FPSCR_Flags(double val1, double val2); + void Copy_FPSCR_to_APSR(); + // Helper functions to decode common "addressing" modes int32_t GetShiftRm(Instr* instr, bool* carry_out); int32_t GetImm(Instr* instr, bool* carry_out); @@ -185,6 +227,10 @@ class Simulator { void DecodeType7(Instr* instr); void DecodeUnconditional(Instr* instr); + // Support for VFP. + void DecodeTypeVFP(Instr* instr); + void DecodeType6CoprocessorIns(Instr* instr); + // Executes one instruction. void InstructionDecode(Instr* instr); @@ -198,20 +244,34 @@ class Simulator { void SetFpResult(const double& result); void TrashCallerSaveRegisters(); - // architecture state + // Architecture state. int32_t registers_[16]; bool n_flag_; bool z_flag_; bool c_flag_; bool v_flag_; - // simulator support + // VFP architecture state. + unsigned int vfp_register[num_s_registers]; + bool n_flag_FPSCR_; + bool z_flag_FPSCR_; + bool c_flag_FPSCR_; + bool v_flag_FPSCR_; + + // VFP FP exception flags architecture state. + bool inv_op_vfp_flag_; + bool div_zero_vfp_flag_; + bool overflow_vfp_flag_; + bool underflow_vfp_flag_; + bool inexact_vfp_flag_; + + // Simulator support. char* stack_; bool pc_modified_; int icount_; static bool initialized_; - // registered breakpoints + // Registered breakpoints. Instr* break_pc_; instr_t break_instr_; }; @@ -229,6 +289,15 @@ class SimulatorStack : public v8::internal::AllStatic { static inline uintptr_t JsLimitFromCLimit(uintptr_t c_limit) { return assembler::arm::Simulator::current()->StackLimit(); } + + static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { + assembler::arm::Simulator* sim = assembler::arm::Simulator::current(); + return sim->PushAddress(try_catch_address); + } + + static inline void UnregisterCTryCatch() { + assembler::arm::Simulator::current()->PopAddress(); + } }; |