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,
147 num_d_registers = 32,
153 explicit Simulator(Isolate* isolate);
163 void set_register(
int reg,
int32_t value);
164 int32_t get_register(
int reg)
const;
165 double get_double_from_register_pair(
int reg);
166 void set_register_pair_from_double(
int reg,
double* value);
167 void set_dw_register(
int dreg,
const int* dbl);
170 void get_d_register(
int dreg, uint64_t* value);
171 void set_d_register(
int dreg,
const uint64_t* value);
172 void get_d_register(
int dreg, uint32_t* value);
173 void set_d_register(
int dreg,
const uint32_t* value);
174 void get_q_register(
int qreg, uint64_t* value);
175 void set_q_register(
int qreg,
const uint64_t* value);
176 void get_q_register(
int qreg, uint32_t* value);
177 void set_q_register(
int qreg,
const uint32_t* value);
179 void set_s_register(
int reg,
unsigned int value);
180 unsigned int get_s_register(
int reg)
const;
182 void set_d_register_from_double(
int dreg,
const double& dbl) {
183 SetVFPRegister<double, 2>(dreg, dbl);
186 double get_double_from_d_register(
int dreg) {
187 return GetFromVFPRegister<double, 2>(dreg);
190 void set_s_register_from_float(
int sreg,
const float flt) {
191 SetVFPRegister<float, 1>(sreg, flt);
194 float get_float_from_s_register(
int sreg) {
195 return GetFromVFPRegister<float, 1>(sreg);
198 void set_s_register_from_sinteger(
int sreg,
const int sint) {
199 SetVFPRegister<int, 1>(sreg, sint);
202 int get_sinteger_from_s_register(
int sreg) {
203 return GetFromVFPRegister<int, 1>(sreg);
211 return reinterpret_cast<Address>(
static_cast<intptr_t
>(get_register(
sp)));
215 uintptr_t StackLimit()
const;
221 static void Initialize(Isolate* isolate);
226 int32_t Call(
byte* entry,
int argument_count, ...);
228 void CallFP(
byte* entry,
double d0,
double d1);
230 double CallFPReturnsDouble(
byte* entry,
double d0,
double d1);
233 uintptr_t PushAddress(uintptr_t address);
236 uintptr_t PopAddress();
239 void set_last_debugger_input(
char* input);
240 char* last_debugger_input() {
return last_debugger_input_; }
248 bool has_bad_pc()
const;
251 bool use_eabi_hardfloat() {
252 #if USE_EABI_HARDFLOAT
260 enum special_values {
272 void Format(Instruction* instr,
const char* format);
276 inline bool ConditionallyExecute(Instruction* instr);
280 void SetCFlag(
bool val);
281 void SetVFlag(
bool val);
284 bool OverflowFrom(
int32_t alu_out,
289 inline int GetCarry() {
290 return c_flag_ ? 1 : 0;
294 void Compute_FPSCR_Flags(
double val1,
double val2);
295 void Copy_FPSCR_to_APSR();
296 inline double canonicalizeNaN(
double value);
299 int32_t GetShiftRm(Instruction* instr,
bool* carry_out);
300 int32_t GetImm(Instruction* instr,
bool* carry_out);
301 int32_t ProcessPU(Instruction* instr,
304 intptr_t* start_address,
305 intptr_t* end_address);
306 void HandleRList(Instruction* instr,
bool load);
307 void HandleVList(Instruction* inst);
308 void SoftwareInterrupt(Instruction* instr);
311 inline bool isStopInstruction(Instruction* instr);
312 inline bool isWatchedStop(uint32_t bkpt_code);
313 inline bool isEnabledStop(uint32_t bkpt_code);
314 inline void EnableStop(uint32_t bkpt_code);
315 inline void DisableStop(uint32_t bkpt_code);
316 inline void IncreaseStopCounter(uint32_t bkpt_code);
317 void PrintStopInfo(uint32_t
code);
320 inline uint8_t ReadBU(
int32_t addr);
321 inline int8_t ReadB(
int32_t addr);
322 inline void WriteB(
int32_t addr, uint8_t value);
323 inline void WriteB(
int32_t addr, int8_t value);
329 inline void WriteH(
int32_t addr,
int16_t value, Instruction* instr);
331 inline int ReadW(
int32_t addr, Instruction* instr);
332 inline void WriteW(
int32_t addr,
int value, Instruction* instr);
339 void DecodeType01(Instruction* instr);
340 void DecodeType2(Instruction* instr);
341 void DecodeType3(Instruction* instr);
342 void DecodeType4(Instruction* instr);
343 void DecodeType5(Instruction* instr);
344 void DecodeType6(Instruction* instr);
345 void DecodeType7(Instruction* instr);
348 void DecodeTypeVFP(Instruction* instr);
349 void DecodeType6CoprocessorIns(Instruction* instr);
350 void DecodeSpecialCondition(Instruction* instr);
352 void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instruction* instr);
353 void DecodeVCMP(Instruction* instr);
354 void DecodeVCVTBetweenDoubleAndSingle(Instruction* instr);
355 void DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr);
358 void InstructionDecode(Instruction* instr);
367 static void* RedirectExternalReference(
368 void* external_function,
372 void GetFpArgs(
double* x,
double* y,
int32_t* z);
373 void SetFpResult(
const double& result);
374 void TrashCallerSaveRegisters();
376 template<
class ReturnType,
int register_size>
377 ReturnType GetFromVFPRegister(
int reg_index);
379 template<
class InputType,
int register_size>
380 void SetVFPRegister(
int reg_index,
const InputType& value);
382 void CallInternal(
byte* entry);
395 unsigned int vfp_registers_[num_d_registers * 2];
403 bool FPSCR_default_NaN_mode_;
406 bool inv_op_vfp_flag_;
407 bool div_zero_vfp_flag_;
408 bool overflow_vfp_flag_;
409 bool underflow_vfp_flag_;
410 bool inexact_vfp_flag_;
418 char* last_debugger_input_;
424 Instruction* break_pc_;
431 static const uint32_t kNumOfWatchedStops = 256;
434 static const uint32_t kStopDisabledBit = 1 << 31;
440 struct StopCountAndDesc {
444 StopCountAndDesc watched_stops_[kNumOfWatchedStops];
450 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
451 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \
452 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4))
454 #define CALL_GENERATED_FP_INT(entry, p0, p1) \
455 Simulator::current(Isolate::Current())->CallFPReturnsInt( \
456 FUNCTION_ADDR(entry), p0, p1)
458 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
459 Simulator::current(Isolate::Current())->Call( \
460 entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)
462 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
463 try_catch_address == NULL ? \
464 NULL : *(reinterpret_cast<TryCatch**>(try_catch_address))
476 return Simulator::current(isolate)->StackLimit();
480 Simulator* sim = Simulator::current(Isolate::Current());
481 return sim->PushAddress(try_catch_address);
485 Simulator::current(Isolate::Current())->PopAddress();
491 #endif // !defined(USE_SIMULATOR)
492 #endif // V8_ARM_SIMULATOR_ARM_H_
const LowDwVfpRegister d11
const LowDwVfpRegister d0
TypeImpl< ZoneTypeConfig > Type
const LowDwVfpRegister d15
const LowDwVfpRegister d3
static void UnregisterCTryCatch()
const LowDwVfpRegister d10
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object size
const LowDwVfpRegister d14
const LowDwVfpRegister d7
const LowDwVfpRegister d4
const LowDwVfpRegister d13
const LowDwVfpRegister d6
static uintptr_t JsLimitFromCLimit(v8::internal::Isolate *isolate, uintptr_t c_limit)
const LowDwVfpRegister d5
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
const LowDwVfpRegister d9
const LowDwVfpRegister d2
const LowDwVfpRegister d12
const LowDwVfpRegister d1
static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address)
const LowDwVfpRegister d8
int(* arm_regexp_matcher)(String *, int, const byte *, const byte *, void *, int *, int, Address, int, Isolate *)