| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 | 5 |
| 6 // Declares a Simulator for MIPS instructions if we are not generating a native | 6 // Declares a Simulator for MIPS instructions if we are not generating a native |
| 7 // MIPS binary. This Simulator allows us to run and debug MIPS code generation | 7 // MIPS binary. This Simulator allows us to run and debug MIPS code generation |
| 8 // on regular desktop machines. | 8 // on regular desktop machines. |
| 9 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, | 9 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, |
| 10 // which will start execution in the Simulator or forwards to the real entry | 10 // which will start execution in the Simulator or forwards to the real entry |
| 11 // on a MIPS HW platform. | 11 // on a MIPS HW platform. |
| 12 | 12 |
| 13 #ifndef V8_MIPS_SIMULATOR_MIPS_H_ | 13 #ifndef V8_MIPS_SIMULATOR_MIPS_H_ |
| 14 #define V8_MIPS_SIMULATOR_MIPS_H_ | 14 #define V8_MIPS_SIMULATOR_MIPS_H_ |
| 15 | 15 |
| 16 #include "src/allocation.h" | 16 #include "src/allocation.h" |
| 17 #include "src/mips/constants-mips.h" | 17 #include "src/mips64/constants-mips64.h" |
| 18 | 18 |
| 19 #if !defined(USE_SIMULATOR) | 19 #if !defined(USE_SIMULATOR) |
| 20 // Running without a simulator on a native mips platform. | 20 // Running without a simulator on a native mips platform. |
| 21 | 21 |
| 22 namespace v8 { | 22 namespace v8 { |
| 23 namespace internal { | 23 namespace internal { |
| 24 | 24 |
| 25 // When running without a simulator we call the entry directly. | 25 // When running without a simulator we call the entry directly. |
| 26 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ | 26 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ |
| 27 entry(p0, p1, p2, p3, p4) | 27 entry(p0, p1, p2, p3, p4) |
| 28 | 28 |
| 29 typedef int (*mips_regexp_matcher)(String*, int, const byte*, const byte*, | |
| 30 void*, int*, int, Address, int, Isolate*); | |
| 31 | |
| 32 | 29 |
| 33 // Call the generated regexp code directly. The code at the entry address | 30 // Call the generated regexp code directly. The code at the entry address |
| 34 // should act as a function matching the type arm_regexp_matcher. | 31 // should act as a function matching the type arm_regexp_matcher. |
| 35 // The fifth argument is a dummy that reserves the space used for | 32 // The fifth (or ninth) argument is a dummy that reserves the space used for |
| 36 // the return address added by the ExitFrame in native calls. | 33 // the return address added by the ExitFrame in native calls. |
| 34 #ifdef MIPS_ABI_N64 |
| 35 typedef int (*mips_regexp_matcher)(String* input, |
| 36 int64_t start_offset, |
| 37 const byte* input_start, |
| 38 const byte* input_end, |
| 39 int* output, |
| 40 int64_t output_size, |
| 41 Address stack_base, |
| 42 int64_t direct_call, |
| 43 void* return_address, |
| 44 Isolate* isolate); |
| 45 |
| 46 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ |
| 47 (FUNCTION_CAST<mips_regexp_matcher>(entry)( \ |
| 48 p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8)) |
| 49 |
| 50 #else // O32 Abi. |
| 51 |
| 52 typedef int (*mips_regexp_matcher)(String* input, |
| 53 int32_t start_offset, |
| 54 const byte* input_start, |
| 55 const byte* input_end, |
| 56 void* return_address, |
| 57 int* output, |
| 58 int32_t output_size, |
| 59 Address stack_base, |
| 60 int32_t direct_call, |
| 61 Isolate* isolate); |
| 62 |
| 37 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ | 63 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ |
| 38 (FUNCTION_CAST<mips_regexp_matcher>(entry)( \ | 64 (FUNCTION_CAST<mips_regexp_matcher>(entry)( \ |
| 39 p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)) | 65 p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)) |
| 40 | 66 |
| 67 #endif // MIPS_ABI_N64 |
| 68 |
| 69 |
| 41 // The stack limit beyond which we will throw stack overflow errors in | 70 // The stack limit beyond which we will throw stack overflow errors in |
| 42 // generated code. Because generated code on mips uses the C stack, we | 71 // generated code. Because generated code on mips uses the C stack, we |
| 43 // just use the C stack limit. | 72 // just use the C stack limit. |
| 44 class SimulatorStack : public v8::internal::AllStatic { | 73 class SimulatorStack : public v8::internal::AllStatic { |
| 45 public: | 74 public: |
| 46 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate, | 75 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate, |
| 47 uintptr_t c_limit) { | 76 uintptr_t c_limit) { |
| 48 return c_limit; | 77 return c_limit; |
| 49 } | 78 } |
| 50 | 79 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 class Simulator { | 141 class Simulator { |
| 113 public: | 142 public: |
| 114 friend class MipsDebugger; | 143 friend class MipsDebugger; |
| 115 | 144 |
| 116 // Registers are declared in order. See SMRL chapter 2. | 145 // Registers are declared in order. See SMRL chapter 2. |
| 117 enum Register { | 146 enum Register { |
| 118 no_reg = -1, | 147 no_reg = -1, |
| 119 zero_reg = 0, | 148 zero_reg = 0, |
| 120 at, | 149 at, |
| 121 v0, v1, | 150 v0, v1, |
| 122 a0, a1, a2, a3, | 151 a0, a1, a2, a3, a4, a5, a6, a7, |
| 123 t0, t1, t2, t3, t4, t5, t6, t7, | 152 t0, t1, t2, t3, |
| 124 s0, s1, s2, s3, s4, s5, s6, s7, | 153 s0, s1, s2, s3, s4, s5, s6, s7, |
| 125 t8, t9, | 154 t8, t9, |
| 126 k0, k1, | 155 k0, k1, |
| 127 gp, | 156 gp, |
| 128 sp, | 157 sp, |
| 129 s8, | 158 s8, |
| 130 ra, | 159 ra, |
| 131 // LO, HI, and pc. | 160 // LO, HI, and pc. |
| 132 LO, | 161 LO, |
| 133 HI, | 162 HI, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 150 explicit Simulator(Isolate* isolate); | 179 explicit Simulator(Isolate* isolate); |
| 151 ~Simulator(); | 180 ~Simulator(); |
| 152 | 181 |
| 153 // The currently executing Simulator instance. Potentially there can be one | 182 // The currently executing Simulator instance. Potentially there can be one |
| 154 // for each native thread. | 183 // for each native thread. |
| 155 static Simulator* current(v8::internal::Isolate* isolate); | 184 static Simulator* current(v8::internal::Isolate* isolate); |
| 156 | 185 |
| 157 // Accessors for register state. Reading the pc value adheres to the MIPS | 186 // Accessors for register state. Reading the pc value adheres to the MIPS |
| 158 // architecture specification and is off by a 8 from the currently executing | 187 // architecture specification and is off by a 8 from the currently executing |
| 159 // instruction. | 188 // instruction. |
| 160 void set_register(int reg, int32_t value); | 189 void set_register(int reg, int64_t value); |
| 190 void set_register_word(int reg, int32_t value); |
| 161 void set_dw_register(int dreg, const int* dbl); | 191 void set_dw_register(int dreg, const int* dbl); |
| 162 int32_t get_register(int reg) const; | 192 int64_t get_register(int reg) const; |
| 163 double get_double_from_register_pair(int reg); | 193 double get_double_from_register_pair(int reg); |
| 164 // Same for FPURegisters. | 194 // Same for FPURegisters. |
| 165 void set_fpu_register(int fpureg, int32_t value); | 195 void set_fpu_register(int fpureg, int64_t value); |
| 196 void set_fpu_register_word(int fpureg, int32_t value); |
| 197 void set_fpu_register_hi_word(int fpureg, int32_t value); |
| 166 void set_fpu_register_float(int fpureg, float value); | 198 void set_fpu_register_float(int fpureg, float value); |
| 167 void set_fpu_register_double(int fpureg, double value); | 199 void set_fpu_register_double(int fpureg, double value); |
| 168 int32_t get_fpu_register(int fpureg) const; | 200 int64_t get_fpu_register(int fpureg) const; |
| 169 int64_t get_fpu_register_long(int fpureg) const; | 201 int32_t get_fpu_register_word(int fpureg) const; |
| 202 int32_t get_fpu_register_signed_word(int fpureg) const; |
| 203 uint32_t get_fpu_register_hi_word(int fpureg) const; |
| 170 float get_fpu_register_float(int fpureg) const; | 204 float get_fpu_register_float(int fpureg) const; |
| 171 double get_fpu_register_double(int fpureg) const; | 205 double get_fpu_register_double(int fpureg) const; |
| 172 void set_fcsr_bit(uint32_t cc, bool value); | 206 void set_fcsr_bit(uint32_t cc, bool value); |
| 173 bool test_fcsr_bit(uint32_t cc); | 207 bool test_fcsr_bit(uint32_t cc); |
| 174 bool set_fcsr_round_error(double original, double rounded); | 208 bool set_fcsr_round_error(double original, double rounded); |
| 209 bool set_fcsr_round64_error(double original, double rounded); |
| 175 | 210 |
| 176 // Special case of set_register and get_register to access the raw PC value. | 211 // Special case of set_register and get_register to access the raw PC value. |
| 177 void set_pc(int32_t value); | 212 void set_pc(int64_t value); |
| 178 int32_t get_pc() const; | 213 int64_t get_pc() const; |
| 179 | 214 |
| 180 Address get_sp() { | 215 Address get_sp() { |
| 181 return reinterpret_cast<Address>(static_cast<intptr_t>(get_register(sp))); | 216 return reinterpret_cast<Address>(static_cast<intptr_t>(get_register(sp))); |
| 182 } | 217 } |
| 183 | 218 |
| 184 // Accessor to the internal simulator stack area. | 219 // Accessor to the internal simulator stack area. |
| 185 uintptr_t StackLimit() const; | 220 uintptr_t StackLimit() const; |
| 186 | 221 |
| 187 // Executes MIPS instructions until the PC reaches end_sim_pc. | 222 // Executes MIPS instructions until the PC reaches end_sim_pc. |
| 188 void Execute(); | 223 void Execute(); |
| 189 | 224 |
| 190 // Call on program start. | 225 // Call on program start. |
| 191 static void Initialize(Isolate* isolate); | 226 static void Initialize(Isolate* isolate); |
| 192 | 227 |
| 193 // V8 generally calls into generated JS code with 5 parameters and into | 228 // V8 generally calls into generated JS code with 5 parameters and into |
| 194 // generated RegExp code with 7 parameters. This is a convenience function, | 229 // generated RegExp code with 7 parameters. This is a convenience function, |
| 195 // which sets up the simulator state and grabs the result on return. | 230 // which sets up the simulator state and grabs the result on return. |
| 196 int32_t Call(byte* entry, int argument_count, ...); | 231 int64_t Call(byte* entry, int argument_count, ...); |
| 197 // Alternative: call a 2-argument double function. | 232 // Alternative: call a 2-argument double function. |
| 198 double CallFP(byte* entry, double d0, double d1); | 233 double CallFP(byte* entry, double d0, double d1); |
| 199 | 234 |
| 200 // Push an address onto the JS stack. | 235 // Push an address onto the JS stack. |
| 201 uintptr_t PushAddress(uintptr_t address); | 236 uintptr_t PushAddress(uintptr_t address); |
| 202 | 237 |
| 203 // Pop an address from the JS stack. | 238 // Pop an address from the JS stack. |
| 204 uintptr_t PopAddress(); | 239 uintptr_t PopAddress(); |
| 205 | 240 |
| 206 // Debugger input. | 241 // Debugger input. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 226 // C code. | 261 // C code. |
| 227 end_sim_pc = -2, | 262 end_sim_pc = -2, |
| 228 // Unpredictable value. | 263 // Unpredictable value. |
| 229 Unpredictable = 0xbadbeaf | 264 Unpredictable = 0xbadbeaf |
| 230 }; | 265 }; |
| 231 | 266 |
| 232 // Unsupported instructions use Format to print an error and stop execution. | 267 // Unsupported instructions use Format to print an error and stop execution. |
| 233 void Format(Instruction* instr, const char* format); | 268 void Format(Instruction* instr, const char* format); |
| 234 | 269 |
| 235 // Read and write memory. | 270 // Read and write memory. |
| 236 inline uint32_t ReadBU(int32_t addr); | 271 inline uint32_t ReadBU(int64_t addr); |
| 237 inline int32_t ReadB(int32_t addr); | 272 inline int32_t ReadB(int64_t addr); |
| 238 inline void WriteB(int32_t addr, uint8_t value); | 273 inline void WriteB(int64_t addr, uint8_t value); |
| 239 inline void WriteB(int32_t addr, int8_t value); | 274 inline void WriteB(int64_t addr, int8_t value); |
| 240 | 275 |
| 241 inline uint16_t ReadHU(int32_t addr, Instruction* instr); | 276 inline uint16_t ReadHU(int64_t addr, Instruction* instr); |
| 242 inline int16_t ReadH(int32_t addr, Instruction* instr); | 277 inline int16_t ReadH(int64_t addr, Instruction* instr); |
| 243 // Note: Overloaded on the sign of the value. | 278 // Note: Overloaded on the sign of the value. |
| 244 inline void WriteH(int32_t addr, uint16_t value, Instruction* instr); | 279 inline void WriteH(int64_t addr, uint16_t value, Instruction* instr); |
| 245 inline void WriteH(int32_t addr, int16_t value, Instruction* instr); | 280 inline void WriteH(int64_t addr, int16_t value, Instruction* instr); |
| 246 | 281 |
| 247 inline int ReadW(int32_t addr, Instruction* instr); | 282 inline uint32_t ReadWU(int64_t addr, Instruction* instr); |
| 248 inline void WriteW(int32_t addr, int value, Instruction* instr); | 283 inline int32_t ReadW(int64_t addr, Instruction* instr); |
| 284 inline void WriteW(int64_t addr, int32_t value, Instruction* instr); |
| 285 inline int64_t Read2W(int64_t addr, Instruction* instr); |
| 286 inline void Write2W(int64_t addr, int64_t value, Instruction* instr); |
| 249 | 287 |
| 250 inline double ReadD(int32_t addr, Instruction* instr); | 288 inline double ReadD(int64_t addr, Instruction* instr); |
| 251 inline void WriteD(int32_t addr, double value, Instruction* instr); | 289 inline void WriteD(int64_t addr, double value, Instruction* instr); |
| 290 |
| 291 // Helper for debugging memory access. |
| 292 inline void DieOrDebug(); |
| 293 |
| 294 // Helpers for data value tracing. |
| 295 enum TraceType { |
| 296 BYTE, |
| 297 HALF, |
| 298 WORD, |
| 299 DWORD |
| 300 // DFLOAT - Floats may have printing issues due to paired lwc1's |
| 301 }; |
| 302 |
| 303 void TraceRegWr(int64_t value); |
| 304 void TraceMemWr(int64_t addr, int64_t value, TraceType t); |
| 305 void TraceMemRd(int64_t addr, int64_t value); |
| 252 | 306 |
| 253 // Operations depending on endianness. | 307 // Operations depending on endianness. |
| 254 // Get Double Higher / Lower word. | 308 // Get Double Higher / Lower word. |
| 255 inline int32_t GetDoubleHIW(double* addr); | 309 inline int32_t GetDoubleHIW(double* addr); |
| 256 inline int32_t GetDoubleLOW(double* addr); | 310 inline int32_t GetDoubleLOW(double* addr); |
| 257 // Set Double Higher / Lower word. | 311 // Set Double Higher / Lower word. |
| 258 inline int32_t SetDoubleHIW(double* addr); | 312 inline int32_t SetDoubleHIW(double* addr); |
| 259 inline int32_t SetDoubleLOW(double* addr); | 313 inline int32_t SetDoubleLOW(double* addr); |
| 260 | 314 |
| 261 // Executing is handled based on the instruction type. | 315 // Executing is handled based on the instruction type. |
| 262 void DecodeTypeRegister(Instruction* instr); | 316 void DecodeTypeRegister(Instruction* instr); |
| 263 | 317 |
| 264 // Helper function for DecodeTypeRegister. | 318 // Helper function for DecodeTypeRegister. |
| 265 void ConfigureTypeRegister(Instruction* instr, | 319 void ConfigureTypeRegister(Instruction* instr, |
| 266 int32_t* alu_out, | 320 int64_t* alu_out, |
| 267 int64_t* i64hilo, | 321 int64_t* i64hilo, |
| 268 uint64_t* u64hilo, | 322 uint64_t* u64hilo, |
| 269 int32_t* next_pc, | 323 int64_t* next_pc, |
| 270 int32_t* return_addr_reg, | 324 int64_t* return_addr_reg, |
| 271 bool* do_interrupt); | 325 bool* do_interrupt, |
| 326 int64_t* result128H, |
| 327 int64_t* result128L); |
| 272 | 328 |
| 273 void DecodeTypeImmediate(Instruction* instr); | 329 void DecodeTypeImmediate(Instruction* instr); |
| 274 void DecodeTypeJump(Instruction* instr); | 330 void DecodeTypeJump(Instruction* instr); |
| 275 | 331 |
| 276 // Used for breakpoints and traps. | 332 // Used for breakpoints and traps. |
| 277 void SoftwareInterrupt(Instruction* instr); | 333 void SoftwareInterrupt(Instruction* instr); |
| 278 | 334 |
| 279 // Stop helper functions. | 335 // Stop helper functions. |
| 280 bool IsWatchpoint(uint32_t code); | 336 bool IsWatchpoint(uint64_t code); |
| 281 void PrintWatchpoint(uint32_t code); | 337 void PrintWatchpoint(uint64_t code); |
| 282 void HandleStop(uint32_t code, Instruction* instr); | 338 void HandleStop(uint64_t code, Instruction* instr); |
| 283 bool IsStopInstruction(Instruction* instr); | 339 bool IsStopInstruction(Instruction* instr); |
| 284 bool IsEnabledStop(uint32_t code); | 340 bool IsEnabledStop(uint64_t code); |
| 285 void EnableStop(uint32_t code); | 341 void EnableStop(uint64_t code); |
| 286 void DisableStop(uint32_t code); | 342 void DisableStop(uint64_t code); |
| 287 void IncreaseStopCounter(uint32_t code); | 343 void IncreaseStopCounter(uint64_t code); |
| 288 void PrintStopInfo(uint32_t code); | 344 void PrintStopInfo(uint64_t code); |
| 289 | 345 |
| 290 | 346 |
| 291 // Executes one instruction. | 347 // Executes one instruction. |
| 292 void InstructionDecode(Instruction* instr); | 348 void InstructionDecode(Instruction* instr); |
| 293 // Execute one instruction placed in a branch delay slot. | 349 // Execute one instruction placed in a branch delay slot. |
| 294 void BranchDelayInstructionDecode(Instruction* instr) { | 350 void BranchDelayInstructionDecode(Instruction* instr) { |
| 295 if (instr->InstructionBits() == nopInstr) { | 351 if (instr->InstructionBits() == nopInstr) { |
| 296 // Short-cut generic nop instructions. They are always valid and they | 352 // Short-cut generic nop instructions. They are always valid and they |
| 297 // never change the simulator state. | 353 // never change the simulator state. |
| 298 return; | 354 return; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 329 ExternalReference::Type type); | 385 ExternalReference::Type type); |
| 330 | 386 |
| 331 // Handle arguments and return value for runtime FP functions. | 387 // Handle arguments and return value for runtime FP functions. |
| 332 void GetFpArgs(double* x, double* y, int32_t* z); | 388 void GetFpArgs(double* x, double* y, int32_t* z); |
| 333 void SetFpResult(const double& result); | 389 void SetFpResult(const double& result); |
| 334 | 390 |
| 335 void CallInternal(byte* entry); | 391 void CallInternal(byte* entry); |
| 336 | 392 |
| 337 // Architecture state. | 393 // Architecture state. |
| 338 // Registers. | 394 // Registers. |
| 339 int32_t registers_[kNumSimuRegisters]; | 395 int64_t registers_[kNumSimuRegisters]; |
| 340 // Coprocessor Registers. | 396 // Coprocessor Registers. |
| 341 int32_t FPUregisters_[kNumFPURegisters]; | 397 int64_t FPUregisters_[kNumFPURegisters]; |
| 342 // FPU control register. | 398 // FPU control register. |
| 343 uint32_t FCSR_; | 399 uint32_t FCSR_; |
| 344 | 400 |
| 345 // Simulator support. | 401 // Simulator support. |
| 346 // Allocate 1MB for stack. | 402 // Allocate 1MB for stack. |
| 347 static const size_t stack_size_ = 1 * 1024*1024; | 403 size_t stack_size_; |
| 348 char* stack_; | 404 char* stack_; |
| 349 bool pc_modified_; | 405 bool pc_modified_; |
| 350 int icount_; | 406 int64_t icount_; |
| 351 int break_count_; | 407 int break_count_; |
| 408 EmbeddedVector<char, 128> trace_buf_; |
| 352 | 409 |
| 353 // Debugger input. | 410 // Debugger input. |
| 354 char* last_debugger_input_; | 411 char* last_debugger_input_; |
| 355 | 412 |
| 356 // Icache simulation. | 413 // Icache simulation. |
| 357 v8::internal::HashMap* i_cache_; | 414 v8::internal::HashMap* i_cache_; |
| 358 | 415 |
| 359 v8::internal::Isolate* isolate_; | 416 v8::internal::Isolate* isolate_; |
| 360 | 417 |
| 361 // Registered breakpoints. | 418 // Registered breakpoints. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 376 StopCountAndDesc watched_stops_[kMaxStopCode + 1]; | 433 StopCountAndDesc watched_stops_[kMaxStopCode + 1]; |
| 377 }; | 434 }; |
| 378 | 435 |
| 379 | 436 |
| 380 // When running with the simulator transition into simulated execution at this | 437 // When running with the simulator transition into simulated execution at this |
| 381 // point. | 438 // point. |
| 382 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ | 439 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ |
| 383 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \ | 440 reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \ |
| 384 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4)) | 441 FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4)) |
| 385 | 442 |
| 443 #ifdef MIPS_ABI_N64 |
| 444 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ |
| 445 Simulator::current(Isolate::Current())->Call( \ |
| 446 entry, 10, p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8) |
| 447 #else // Must be O32 Abi. |
| 386 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ | 448 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ |
| 387 Simulator::current(Isolate::Current())->Call( \ | 449 Simulator::current(Isolate::Current())->Call( \ |
| 388 entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8) | 450 entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8) |
| 451 #endif // MIPS_ABI_N64 |
| 389 | 452 |
| 390 | 453 |
| 391 // The simulator has its own stack. Thus it has a different stack limit from | 454 // The simulator has its own stack. Thus it has a different stack limit from |
| 392 // the C-based native code. Setting the c_limit to indicate a very small | 455 // the C-based native code. Setting the c_limit to indicate a very small |
| 393 // stack cause stack overflow errors, since the simulator ignores the input. | 456 // stack cause stack overflow errors, since the simulator ignores the input. |
| 394 // This is unlikely to be an issue in practice, though it might cause testing | 457 // This is unlikely to be an issue in practice, though it might cause testing |
| 395 // trouble down the line. | 458 // trouble down the line. |
| 396 class SimulatorStack : public v8::internal::AllStatic { | 459 class SimulatorStack : public v8::internal::AllStatic { |
| 397 public: | 460 public: |
| 398 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate, | 461 static inline uintptr_t JsLimitFromCLimit(Isolate* isolate, |
| 399 uintptr_t c_limit) { | 462 uintptr_t c_limit) { |
| 400 return Simulator::current(isolate)->StackLimit(); | 463 return Simulator::current(isolate)->StackLimit(); |
| 401 } | 464 } |
| 402 | 465 |
| 403 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { | 466 static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { |
| 404 Simulator* sim = Simulator::current(Isolate::Current()); | 467 Simulator* sim = Simulator::current(Isolate::Current()); |
| 405 return sim->PushAddress(try_catch_address); | 468 return sim->PushAddress(try_catch_address); |
| 406 } | 469 } |
| 407 | 470 |
| 408 static inline void UnregisterCTryCatch() { | 471 static inline void UnregisterCTryCatch() { |
| 409 Simulator::current(Isolate::Current())->PopAddress(); | 472 Simulator::current(Isolate::Current())->PopAddress(); |
| 410 } | 473 } |
| 411 }; | 474 }; |
| 412 | 475 |
| 413 } } // namespace v8::internal | 476 } } // namespace v8::internal |
| 414 | 477 |
| 415 #endif // !defined(USE_SIMULATOR) | 478 #endif // !defined(USE_SIMULATOR) |
| 416 #endif // V8_MIPS_SIMULATOR_MIPS_H_ | 479 #endif // V8_MIPS_SIMULATOR_MIPS_H_ |
| OLD | NEW |