36 #ifndef V8_MIPS_SIMULATOR_MIPS_H_
37 #define V8_MIPS_SIMULATOR_MIPS_H_
42 #if !defined(USE_SIMULATOR)
49 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
50 entry(p0, p1, p2, p3, p4)
60 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
61 (FUNCTION_CAST<mips_regexp_matcher>(entry)( \
62 p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8))
64 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
65 reinterpret_cast<TryCatch*>(try_catch_address)
78 return try_catch_address;
92 #define GENERATED_CODE_STACK_LIMIT(limit) \
93 (reinterpret_cast<uintptr_t>(this) >= limit ? \
94 reinterpret_cast<uintptr_t>(this) - limit : 0)
96 #else // !defined(USE_SIMULATOR)
110 static const int LINE_VALID = 0;
111 static const int LINE_INVALID = 1;
113 static const int kPageShift = 12;
114 static const int kPageSize = 1 << kPageShift;
115 static const int kPageMask = kPageSize - 1;
116 static const int kLineShift = 2;
117 static const int kLineLength = 1 << kLineShift;
118 static const int kLineMask = kLineLength - 1;
121 memset(&validity_map_, LINE_INVALID,
sizeof(validity_map_));
124 char* ValidityByte(
int offset) {
125 return &validity_map_[offset >> kLineShift];
128 char* CachedData(
int offset) {
129 return &data_[offset];
133 char data_[kPageSize];
134 static const int kValidityMapSize = kPageSize >> kLineShift;
135 char validity_map_[kValidityMapSize];
140 friend class MipsDebugger;
149 t0, t1, t2, t3, t4, t5, t6, t7,
169 f0,
f1,
f2,
f3,
f4,
f5,
f6,
f7,
f8,
f9,
f10,
f11,
171 f16,
f17,
f18,
f19,
f20,
f21,
f22,
f23,
f24,
f25,
176 explicit Simulator(Isolate* isolate);
186 void set_register(
int reg,
int32_t value);
187 void set_dw_register(
int dreg,
const int* dbl);
188 int32_t get_register(
int reg)
const;
189 double get_double_from_register_pair(
int reg);
191 void set_fpu_register(
int fpureg,
int32_t value);
192 void set_fpu_register_float(
int fpureg,
float value);
193 void set_fpu_register_double(
int fpureg,
double value);
194 int32_t get_fpu_register(
int fpureg)
const;
195 int64_t get_fpu_register_long(
int fpureg)
const;
196 float get_fpu_register_float(
int fpureg)
const;
197 double get_fpu_register_double(
int fpureg)
const;
198 void set_fcsr_bit(uint32_t
cc,
bool value);
199 bool test_fcsr_bit(uint32_t cc);
200 bool set_fcsr_round_error(
double original,
double rounded);
207 return reinterpret_cast<Address>(
static_cast<intptr_t
>(get_register(
sp)));
211 uintptr_t StackLimit()
const;
217 static void Initialize(Isolate* isolate);
222 int32_t Call(
byte* entry,
int argument_count, ...);
224 double CallFP(
byte* entry,
double d0,
double d1);
227 uintptr_t PushAddress(uintptr_t address);
230 uintptr_t PopAddress();
233 void set_last_debugger_input(
char* input);
234 char* last_debugger_input() {
return last_debugger_input_; }
242 bool has_bad_pc()
const;
245 enum special_values {
255 Unpredictable = 0xbadbeaf
259 void Format(Instruction* instr,
const char* format);
262 inline uint32_t ReadBU(
int32_t addr);
264 inline void WriteB(
int32_t addr, uint8_t value);
265 inline void WriteB(
int32_t addr, int8_t value);
271 inline void WriteH(
int32_t addr,
int16_t value, Instruction* instr);
273 inline int ReadW(
int32_t addr, Instruction* instr);
274 inline void WriteW(
int32_t addr,
int value, Instruction* instr);
276 inline double ReadD(
int32_t addr, Instruction* instr);
277 inline void WriteD(
int32_t addr,
double value, Instruction* instr);
281 inline int32_t GetDoubleHIW(
double* addr);
282 inline int32_t GetDoubleLOW(
double* addr);
284 inline int32_t SetDoubleHIW(
double* addr);
285 inline int32_t SetDoubleLOW(
double* addr);
288 void DecodeTypeRegister(Instruction* instr);
291 void ConfigureTypeRegister(Instruction* instr,
299 void DecodeTypeImmediate(Instruction* instr);
300 void DecodeTypeJump(Instruction* instr);
303 void SoftwareInterrupt(Instruction* instr);
306 bool IsWatchpoint(uint32_t
code);
307 void PrintWatchpoint(uint32_t code);
308 void HandleStop(uint32_t code, Instruction* instr);
309 bool IsStopInstruction(Instruction* instr);
310 bool IsEnabledStop(uint32_t code);
311 void EnableStop(uint32_t code);
312 void DisableStop(uint32_t code);
313 void IncreaseStopCounter(uint32_t code);
314 void PrintStopInfo(uint32_t code);
318 void InstructionDecode(Instruction* instr);
320 void BranchDelayInstructionDecode(Instruction* instr) {
321 if (instr->InstructionBits() ==
nopInstr) {
327 if (instr->IsForbiddenInBranchDelay()) {
329 "Eror:Unexpected %i opcode in a branch delay slot.",
330 instr->OpcodeValue());
332 InstructionDecode(instr);
348 int16_t exceptions[kNumExceptions];
351 void SignalExceptions();
354 static void* RedirectExternalReference(
void* external_function,
358 void GetFpArgs(
double* x,
double* y,
int32_t* z);
359 void SetFpResult(
const double& result);
361 void CallInternal(
byte* entry);
373 static const size_t stack_size_ = 1 * 1024*1024;
380 char* last_debugger_input_;
388 Instruction* break_pc_;
392 static const uint32_t kStopDisabledBit = 1 << 31;
398 struct StopCountAndDesc {
408 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
409 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \
410 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4))
412 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
413 Simulator::current(Isolate::Current())->Call( \
414 entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)
416 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
417 try_catch_address == NULL ? \
418 NULL : *(reinterpret_cast<TryCatch**>(try_catch_address))
430 return Simulator::current(isolate)->StackLimit();
434 Simulator* sim = Simulator::current(Isolate::Current());
435 return sim->PushAddress(try_catch_address);
439 Simulator::current(Isolate::Current())->PopAddress();
445 #endif // !defined(USE_SIMULATOR)
446 #endif // V8_MIPS_SIMULATOR_MIPS_H_
const LowDwVfpRegister d0
static uintptr_t JsLimitFromCLimit(Isolate *isolate, uintptr_t c_limit)
const int kNumSimuRegisters
int(* mips_regexp_matcher)(String *, int, const byte *, const byte *, void *, int *, int, Address, int, Isolate *)
TypeImpl< ZoneTypeConfig > Type
const uint32_t kMaxStopCode
static void UnregisterCTryCatch()
const int kNumFPURegisters
void V8_Fatal(const char *file, int line, const char *format,...)
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
static uintptr_t JsLimitFromCLimit(v8::internal::Isolate *isolate, uintptr_t c_limit)
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 d1
static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address)