OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 // Declares a Simulator for S390 instructions if we are not generating a native | 5 // Declares a Simulator for S390 instructions if we are not generating a native |
6 // S390 binary. This Simulator allows us to run and debug S390 code generation | 6 // S390 binary. This Simulator allows us to run and debug S390 code generation |
7 // on regular desktop machines. | 7 // on regular desktop machines. |
8 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, | 8 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, |
9 // which will start execution in the Simulator or forwards to the real entry | 9 // which will start execution in the Simulator or forwards to the real entry |
10 // on a S390 hardware platform. | 10 // on a S390 hardware platform. |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 // Accessor to the internal simulator stack area. | 205 // Accessor to the internal simulator stack area. |
206 uintptr_t StackLimit(uintptr_t c_limit) const; | 206 uintptr_t StackLimit(uintptr_t c_limit) const; |
207 | 207 |
208 // Executes S390 instructions until the PC reaches end_sim_pc. | 208 // Executes S390 instructions until the PC reaches end_sim_pc. |
209 void Execute(); | 209 void Execute(); |
210 | 210 |
211 // Call on program start. | 211 // Call on program start. |
212 static void Initialize(Isolate* isolate); | 212 static void Initialize(Isolate* isolate); |
213 | 213 |
214 static void TearDown(HashMap* i_cache, Redirection* first); | 214 static void TearDown(base::HashMap* i_cache, Redirection* first); |
215 | 215 |
216 // V8 generally calls into generated JS code with 5 parameters and into | 216 // V8 generally calls into generated JS code with 5 parameters and into |
217 // generated RegExp code with 7 parameters. This is a convenience function, | 217 // generated RegExp code with 7 parameters. This is a convenience function, |
218 // which sets up the simulator state and grabs the result on return. | 218 // which sets up the simulator state and grabs the result on return. |
219 intptr_t Call(byte* entry, int argument_count, ...); | 219 intptr_t Call(byte* entry, int argument_count, ...); |
220 // Alternative: call a 2-argument double function. | 220 // Alternative: call a 2-argument double function. |
221 void CallFP(byte* entry, double d0, double d1); | 221 void CallFP(byte* entry, double d0, double d1); |
222 int32_t CallFPReturnsInt(byte* entry, double d0, double d1); | 222 int32_t CallFPReturnsInt(byte* entry, double d0, double d1); |
223 double CallFPReturnsDouble(byte* entry, double d0, double d1); | 223 double CallFPReturnsDouble(byte* entry, double d0, double d1); |
224 | 224 |
225 // Push an address onto the JS stack. | 225 // Push an address onto the JS stack. |
226 uintptr_t PushAddress(uintptr_t address); | 226 uintptr_t PushAddress(uintptr_t address); |
227 | 227 |
228 // Pop an address from the JS stack. | 228 // Pop an address from the JS stack. |
229 uintptr_t PopAddress(); | 229 uintptr_t PopAddress(); |
230 | 230 |
231 // Debugger input. | 231 // Debugger input. |
232 void set_last_debugger_input(char* input); | 232 void set_last_debugger_input(char* input); |
233 char* last_debugger_input() { return last_debugger_input_; } | 233 char* last_debugger_input() { return last_debugger_input_; } |
234 | 234 |
235 // ICache checking. | 235 // ICache checking. |
236 static void FlushICache(v8::internal::HashMap* i_cache, void* start, | 236 static void FlushICache(base::HashMap* i_cache, void* start, |
237 size_t size); | 237 size_t size); |
238 | 238 |
239 // Returns true if pc register contains one of the 'special_values' defined | 239 // Returns true if pc register contains one of the 'special_values' defined |
240 // below (bad_lr, end_sim_pc). | 240 // below (bad_lr, end_sim_pc). |
241 bool has_bad_pc() const; | 241 bool has_bad_pc() const; |
242 | 242 |
243 private: | 243 private: |
244 enum special_values { | 244 enum special_values { |
245 // Known bad pc value to ensure that the simulator does not execute | 245 // Known bad pc value to ensure that the simulator does not execute |
246 // without being properly setup. | 246 // without being properly setup. |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 // Check for unconditional branch | 437 // Check for unconditional branch |
438 if (mask == 0xf) return true; | 438 if (mask == 0xf) return true; |
439 | 439 |
440 return (condition_reg_ & mask) != 0; | 440 return (condition_reg_ & mask) != 0; |
441 } | 441 } |
442 | 442 |
443 // Executes one instruction. | 443 // Executes one instruction. |
444 void ExecuteInstruction(Instruction* instr, bool auto_incr_pc = true); | 444 void ExecuteInstruction(Instruction* instr, bool auto_incr_pc = true); |
445 | 445 |
446 // ICache. | 446 // ICache. |
447 static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr); | 447 static void CheckICache(base::HashMap* i_cache, Instruction* instr); |
448 static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start, | 448 static void FlushOnePage(base::HashMap* i_cache, intptr_t start, |
449 int size); | 449 int size); |
450 static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page); | 450 static CachePage* GetCachePage(base::HashMap* i_cache, void* page); |
451 | 451 |
452 // Runtime call support. | 452 // Runtime call support. |
453 static void* RedirectExternalReference( | 453 static void* RedirectExternalReference( |
454 Isolate* isolate, void* external_function, | 454 Isolate* isolate, void* external_function, |
455 v8::internal::ExternalReference::Type type); | 455 v8::internal::ExternalReference::Type type); |
456 | 456 |
457 // Handle arguments and return value for runtime FP functions. | 457 // Handle arguments and return value for runtime FP functions. |
458 void GetFpArgs(double* x, double* y, intptr_t* z); | 458 void GetFpArgs(double* x, double* y, intptr_t* z); |
459 void SetFpResult(const double& result); | 459 void SetFpResult(const double& result); |
460 void TrashCallerSaveRegisters(); | 460 void TrashCallerSaveRegisters(); |
(...skipping 14 matching lines...) Expand all Loading... |
475 // Simulator support. | 475 // Simulator support. |
476 char* stack_; | 476 char* stack_; |
477 static const size_t stack_protection_size_ = 256 * kPointerSize; | 477 static const size_t stack_protection_size_ = 256 * kPointerSize; |
478 bool pc_modified_; | 478 bool pc_modified_; |
479 int64_t icount_; | 479 int64_t icount_; |
480 | 480 |
481 // Debugger input. | 481 // Debugger input. |
482 char* last_debugger_input_; | 482 char* last_debugger_input_; |
483 | 483 |
484 // Icache simulation | 484 // Icache simulation |
485 v8::internal::HashMap* i_cache_; | 485 base::HashMap* i_cache_; |
486 | 486 |
487 // Registered breakpoints. | 487 // Registered breakpoints. |
488 Instruction* break_pc_; | 488 Instruction* break_pc_; |
489 Instr break_instr_; | 489 Instr break_instr_; |
490 | 490 |
491 v8::internal::Isolate* isolate_; | 491 v8::internal::Isolate* isolate_; |
492 | 492 |
493 // A stop is watched if its code is less than kNumOfWatchedStops. | 493 // A stop is watched if its code is less than kNumOfWatchedStops. |
494 // Only watched stops support enabling/disabling and the counter feature. | 494 // Only watched stops support enabling/disabling and the counter feature. |
495 static const uint32_t kNumOfWatchedStops = 256; | 495 static const uint32_t kNumOfWatchedStops = 256; |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { | 1279 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { |
1280 Simulator::current(isolate)->PopAddress(); | 1280 Simulator::current(isolate)->PopAddress(); |
1281 } | 1281 } |
1282 }; | 1282 }; |
1283 | 1283 |
1284 } // namespace internal | 1284 } // namespace internal |
1285 } // namespace v8 | 1285 } // namespace v8 |
1286 | 1286 |
1287 #endif // !defined(USE_SIMULATOR) | 1287 #endif // !defined(USE_SIMULATOR) |
1288 #endif // V8_S390_SIMULATOR_S390_H_ | 1288 #endif // V8_S390_SIMULATOR_S390_H_ |
OLD | NEW |