36 #ifndef V8_ARM_SIMULATOR_ARM_H_
37 #define V8_ARM_SIMULATOR_ARM_H_
41 #if !defined(USE_SIMULATOR)
48 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
49 (entry(p0, p1, p2, p3, p4))
59 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
60 (FUNCTION_CAST<arm_regexp_matcher>(entry)( \
61 p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8))
63 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
64 reinterpret_cast<TryCatch*>(try_catch_address)
78 return try_catch_address;
86 #else // !defined(USE_SIMULATOR)
98 static const int LINE_VALID = 0;
99 static const int LINE_INVALID = 1;
101 static const int kPageShift = 12;
102 static const int kPageSize = 1 << kPageShift;
103 static const int kPageMask = kPageSize - 1;
104 static const int kLineShift = 2;
105 static const int kLineLength = 1 << kLineShift;
106 static const int kLineMask = kLineLength - 1;
109 memset(&validity_map_, LINE_INVALID,
sizeof(validity_map_));
112 char* ValidityByte(
int offset) {
113 return &validity_map_[offset >> kLineShift];
116 char* CachedData(
int offset) {
117 return &data_[offset];
121 char data_[kPageSize];
122 static const int kValidityMapSize = kPageSize >> kLineShift;
123 char validity_map_[kValidityMapSize];
129 friend class ArmDebugger;
142 num_s_registers = 32,
148 explicit Simulator(Isolate* isolate);
158 void set_register(
int reg,
int32_t value);
159 int32_t get_register(
int reg)
const;
160 double get_double_from_register_pair(
int reg);
161 void set_dw_register(
int dreg,
const int* dbl);
164 void set_s_register(
int reg,
unsigned int value);
165 unsigned int get_s_register(
int reg)
const;
167 void set_d_register_from_double(
int dreg,
const double& dbl) {
168 SetVFPRegister<double, 2>(dreg, dbl);
171 double get_double_from_d_register(
int dreg) {
172 return GetFromVFPRegister<double, 2>(dreg);
175 void set_s_register_from_float(
int sreg,
const float flt) {
176 SetVFPRegister<float, 1>(sreg, flt);
179 float get_float_from_s_register(
int sreg) {
180 return GetFromVFPRegister<float, 1>(sreg);
183 void set_s_register_from_sinteger(
int sreg,
const int sint) {
184 SetVFPRegister<int, 1>(sreg, sint);
187 int get_sinteger_from_s_register(
int sreg) {
188 return GetFromVFPRegister<int, 1>(sreg);
196 uintptr_t StackLimit()
const;
202 static void Initialize(Isolate* isolate);
207 int32_t Call(
byte* entry,
int argument_count, ...);
210 uintptr_t PushAddress(uintptr_t address);
213 uintptr_t PopAddress();
216 void set_last_debugger_input(
char* input);
217 char* last_debugger_input() {
return last_debugger_input_; }
225 bool has_bad_pc()
const;
228 bool use_eabi_hardfloat() {
229 #if USE_EABI_HARDFLOAT
237 enum special_values {
249 void Format(Instruction* instr,
const char* format);
253 bool ConditionallyExecute(Instruction* instr);
257 void SetCFlag(
bool val);
258 void SetVFlag(
bool val);
261 bool OverflowFrom(
int32_t alu_out,
266 inline int GetCarry() {
267 return c_flag_ ? 1 : 0;
271 void Compute_FPSCR_Flags(
double val1,
double val2);
272 void Copy_FPSCR_to_APSR();
275 int32_t GetShiftRm(Instruction* instr,
bool* carry_out);
276 int32_t GetImm(Instruction* instr,
bool* carry_out);
277 void ProcessPUW(Instruction* instr,
280 intptr_t* start_address,
281 intptr_t* end_address);
282 void HandleRList(Instruction* instr,
bool load);
283 void HandleVList(Instruction* inst);
284 void SoftwareInterrupt(Instruction* instr);
287 inline bool isStopInstruction(Instruction* instr);
288 inline bool isWatchedStop(uint32_t bkpt_code);
289 inline bool isEnabledStop(uint32_t bkpt_code);
290 inline void EnableStop(uint32_t bkpt_code);
291 inline void DisableStop(uint32_t bkpt_code);
292 inline void IncreaseStopCounter(uint32_t bkpt_code);
293 void PrintStopInfo(uint32_t
code);
296 inline uint8_t ReadBU(
int32_t addr);
297 inline int8_t ReadB(
int32_t addr);
298 inline void WriteB(
int32_t addr, uint8_t value);
299 inline void WriteB(
int32_t addr, int8_t value);
305 inline void WriteH(
int32_t addr,
int16_t value, Instruction* instr);
307 inline int ReadW(
int32_t addr, Instruction* instr);
308 inline void WriteW(
int32_t addr,
int value, Instruction* instr);
315 void DecodeType01(Instruction* instr);
316 void DecodeType2(Instruction* instr);
317 void DecodeType3(Instruction* instr);
318 void DecodeType4(Instruction* instr);
319 void DecodeType5(Instruction* instr);
320 void DecodeType6(Instruction* instr);
321 void DecodeType7(Instruction* instr);
324 void DecodeTypeVFP(Instruction* instr);
325 void DecodeType6CoprocessorIns(Instruction* instr);
327 void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instruction* instr);
328 void DecodeVCMP(Instruction* instr);
329 void DecodeVCVTBetweenDoubleAndSingle(Instruction* instr);
330 void DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr);
333 void InstructionDecode(Instruction* instr);
342 static void* RedirectExternalReference(
343 void* external_function,
344 v8::internal::ExternalReference::Type type);
347 void GetFpArgs(
double* x,
double* y);
348 void GetFpArgs(
double* x);
349 void GetFpArgs(
double* x,
int32_t* y);
350 void SetFpResult(
const double& result);
351 void TrashCallerSaveRegisters();
353 template<
class ReturnType,
int register_size>
354 ReturnType GetFromVFPRegister(
int reg_index);
356 template<
class InputType,
int register_size>
357 void SetVFPRegister(
int reg_index,
const InputType& value);
370 unsigned int vfp_register[num_s_registers];
380 bool inv_op_vfp_flag_;
381 bool div_zero_vfp_flag_;
382 bool overflow_vfp_flag_;
383 bool underflow_vfp_flag_;
384 bool inexact_vfp_flag_;
392 char* last_debugger_input_;
398 Instruction* break_pc_;
405 static const uint32_t kNumOfWatchedStops = 256;
408 static const uint32_t kStopDisabledBit = 1 << 31;
414 struct StopCountAndDesc {
418 StopCountAndDesc watched_stops[kNumOfWatchedStops];
424 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
425 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \
426 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4))
428 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
429 Simulator::current(Isolate::Current())->Call( \
430 entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)
432 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
433 try_catch_address == NULL ? \
434 NULL : *(reinterpret_cast<TryCatch**>(try_catch_address))
446 return Simulator::current(isolate)->StackLimit();
450 Simulator* sim = Simulator::current(Isolate::Current());
451 return sim->PushAddress(try_catch_address);
455 Simulator::current(Isolate::Current())->PopAddress();
461 #endif // !defined(USE_SIMULATOR)
462 #endif // V8_ARM_SIMULATOR_ARM_H_
static void UnregisterCTryCatch()
static uintptr_t JsLimitFromCLimit(v8::internal::Isolate *isolate, uintptr_t c_limit)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address)
int(* arm_regexp_matcher)(String *, int, const byte *, const byte *, void *, int *, int, Address, int, Isolate *)