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(base::HashMap* i_cache, Redirection* first); | 214 static void TearDown(base::CustomMatcherHashMap* 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(base::HashMap* i_cache, void* start, size_t size); | 236 static void FlushICache(base::CustomMatcherHashMap* i_cache, void* start, |
| 237 size_t size); |
237 | 238 |
238 // 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 |
239 // below (bad_lr, end_sim_pc). | 240 // below (bad_lr, end_sim_pc). |
240 bool has_bad_pc() const; | 241 bool has_bad_pc() const; |
241 | 242 |
242 private: | 243 private: |
243 enum special_values { | 244 enum special_values { |
244 // 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 |
245 // without being properly setup. | 246 // without being properly setup. |
246 bad_lr = -1, | 247 bad_lr = -1, |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 // Check for unconditional branch | 439 // Check for unconditional branch |
439 if (mask == 0xf) return true; | 440 if (mask == 0xf) return true; |
440 | 441 |
441 return (condition_reg_ & mask) != 0; | 442 return (condition_reg_ & mask) != 0; |
442 } | 443 } |
443 | 444 |
444 // Executes one instruction. | 445 // Executes one instruction. |
445 void ExecuteInstruction(Instruction* instr, bool auto_incr_pc = true); | 446 void ExecuteInstruction(Instruction* instr, bool auto_incr_pc = true); |
446 | 447 |
447 // ICache. | 448 // ICache. |
448 static void CheckICache(base::HashMap* i_cache, Instruction* instr); | 449 static void CheckICache(base::CustomMatcherHashMap* i_cache, |
449 static void FlushOnePage(base::HashMap* i_cache, intptr_t start, int size); | 450 Instruction* instr); |
450 static CachePage* GetCachePage(base::HashMap* i_cache, void* page); | 451 static void FlushOnePage(base::CustomMatcherHashMap* i_cache, intptr_t start, |
| 452 int size); |
| 453 static CachePage* GetCachePage(base::CustomMatcherHashMap* i_cache, |
| 454 void* page); |
451 | 455 |
452 // Runtime call support. | 456 // Runtime call support. |
453 static void* RedirectExternalReference( | 457 static void* RedirectExternalReference( |
454 Isolate* isolate, void* external_function, | 458 Isolate* isolate, void* external_function, |
455 v8::internal::ExternalReference::Type type); | 459 v8::internal::ExternalReference::Type type); |
456 | 460 |
457 // Handle arguments and return value for runtime FP functions. | 461 // Handle arguments and return value for runtime FP functions. |
458 void GetFpArgs(double* x, double* y, intptr_t* z); | 462 void GetFpArgs(double* x, double* y, intptr_t* z); |
459 void SetFpResult(const double& result); | 463 void SetFpResult(const double& result); |
460 void TrashCallerSaveRegisters(); | 464 void TrashCallerSaveRegisters(); |
(...skipping 14 matching lines...) Expand all Loading... |
475 // Simulator support. | 479 // Simulator support. |
476 char* stack_; | 480 char* stack_; |
477 static const size_t stack_protection_size_ = 256 * kPointerSize; | 481 static const size_t stack_protection_size_ = 256 * kPointerSize; |
478 bool pc_modified_; | 482 bool pc_modified_; |
479 int64_t icount_; | 483 int64_t icount_; |
480 | 484 |
481 // Debugger input. | 485 // Debugger input. |
482 char* last_debugger_input_; | 486 char* last_debugger_input_; |
483 | 487 |
484 // Icache simulation | 488 // Icache simulation |
485 base::HashMap* i_cache_; | 489 base::CustomMatcherHashMap* i_cache_; |
486 | 490 |
487 // Registered breakpoints. | 491 // Registered breakpoints. |
488 Instruction* break_pc_; | 492 Instruction* break_pc_; |
489 Instr break_instr_; | 493 Instr break_instr_; |
490 | 494 |
491 v8::internal::Isolate* isolate_; | 495 v8::internal::Isolate* isolate_; |
492 | 496 |
493 // A stop is watched if its code is less than kNumOfWatchedStops. | 497 // A stop is watched if its code is less than kNumOfWatchedStops. |
494 // Only watched stops support enabling/disabling and the counter feature. | 498 // Only watched stops support enabling/disabling and the counter feature. |
495 static const uint32_t kNumOfWatchedStops = 256; | 499 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) { | 1283 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { |
1280 Simulator::current(isolate)->PopAddress(); | 1284 Simulator::current(isolate)->PopAddress(); |
1281 } | 1285 } |
1282 }; | 1286 }; |
1283 | 1287 |
1284 } // namespace internal | 1288 } // namespace internal |
1285 } // namespace v8 | 1289 } // namespace v8 |
1286 | 1290 |
1287 #endif // !defined(USE_SIMULATOR) | 1291 #endif // !defined(USE_SIMULATOR) |
1288 #endif // V8_S390_SIMULATOR_S390_H_ | 1292 #endif // V8_S390_SIMULATOR_S390_H_ |
OLD | NEW |