OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 ARM instructions if we are not generating a native | 6 // Declares a Simulator for ARM instructions if we are not generating a native |
7 // ARM binary. This Simulator allows us to run and debug ARM code generation on | 7 // ARM binary. This Simulator allows us to run and debug ARM code generation on |
8 // regular desktop machines. | 8 // 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 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 // Accessor to the internal simulator stack area. | 194 // Accessor to the internal simulator stack area. |
195 uintptr_t StackLimit(uintptr_t c_limit) const; | 195 uintptr_t StackLimit(uintptr_t c_limit) const; |
196 | 196 |
197 // Executes ARM instructions until the PC reaches end_sim_pc. | 197 // Executes ARM instructions until the PC reaches end_sim_pc. |
198 void Execute(); | 198 void Execute(); |
199 | 199 |
200 // Call on program start. | 200 // Call on program start. |
201 static void Initialize(Isolate* isolate); | 201 static void Initialize(Isolate* isolate); |
202 | 202 |
203 static void TearDown(base::HashMap* i_cache, Redirection* first); | 203 static void TearDown(base::CustomMatcherHashMap* i_cache, Redirection* first); |
204 | 204 |
205 // V8 generally calls into generated JS code with 5 parameters and into | 205 // V8 generally calls into generated JS code with 5 parameters and into |
206 // generated RegExp code with 7 parameters. This is a convenience function, | 206 // generated RegExp code with 7 parameters. This is a convenience function, |
207 // which sets up the simulator state and grabs the result on return. | 207 // which sets up the simulator state and grabs the result on return. |
208 int32_t Call(byte* entry, int argument_count, ...); | 208 int32_t Call(byte* entry, int argument_count, ...); |
209 // Alternative: call a 2-argument double function. | 209 // Alternative: call a 2-argument double function. |
210 void CallFP(byte* entry, double d0, double d1); | 210 void CallFP(byte* entry, double d0, double d1); |
211 int32_t CallFPReturnsInt(byte* entry, double d0, double d1); | 211 int32_t CallFPReturnsInt(byte* entry, double d0, double d1); |
212 double CallFPReturnsDouble(byte* entry, double d0, double d1); | 212 double CallFPReturnsDouble(byte* entry, double d0, double d1); |
213 | 213 |
214 // Push an address onto the JS stack. | 214 // Push an address onto the JS stack. |
215 uintptr_t PushAddress(uintptr_t address); | 215 uintptr_t PushAddress(uintptr_t address); |
216 | 216 |
217 // Pop an address from the JS stack. | 217 // Pop an address from the JS stack. |
218 uintptr_t PopAddress(); | 218 uintptr_t PopAddress(); |
219 | 219 |
220 // Debugger input. | 220 // Debugger input. |
221 void set_last_debugger_input(char* input); | 221 void set_last_debugger_input(char* input); |
222 char* last_debugger_input() { return last_debugger_input_; } | 222 char* last_debugger_input() { return last_debugger_input_; } |
223 | 223 |
224 // ICache checking. | 224 // ICache checking. |
225 static void FlushICache(base::HashMap* i_cache, void* start, size_t size); | 225 static void FlushICache(base::CustomMatcherHashMap* i_cache, void* start, |
| 226 size_t size); |
226 | 227 |
227 // Returns true if pc register contains one of the 'special_values' defined | 228 // Returns true if pc register contains one of the 'special_values' defined |
228 // below (bad_lr, end_sim_pc). | 229 // below (bad_lr, end_sim_pc). |
229 bool has_bad_pc() const; | 230 bool has_bad_pc() const; |
230 | 231 |
231 // EABI variant for double arguments in use. | 232 // EABI variant for double arguments in use. |
232 bool use_eabi_hardfloat() { | 233 bool use_eabi_hardfloat() { |
233 #if USE_EABI_HARDFLOAT | 234 #if USE_EABI_HARDFLOAT |
234 return true; | 235 return true; |
235 #else | 236 #else |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 338 |
338 void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instruction* instr); | 339 void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instruction* instr); |
339 void DecodeVCMP(Instruction* instr); | 340 void DecodeVCMP(Instruction* instr); |
340 void DecodeVCVTBetweenDoubleAndSingle(Instruction* instr); | 341 void DecodeVCVTBetweenDoubleAndSingle(Instruction* instr); |
341 void DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr); | 342 void DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr); |
342 | 343 |
343 // Executes one instruction. | 344 // Executes one instruction. |
344 void InstructionDecode(Instruction* instr); | 345 void InstructionDecode(Instruction* instr); |
345 | 346 |
346 // ICache. | 347 // ICache. |
347 static void CheckICache(base::HashMap* i_cache, Instruction* instr); | 348 static void CheckICache(base::CustomMatcherHashMap* i_cache, |
348 static void FlushOnePage(base::HashMap* i_cache, intptr_t start, int size); | 349 Instruction* instr); |
349 static CachePage* GetCachePage(base::HashMap* i_cache, void* page); | 350 static void FlushOnePage(base::CustomMatcherHashMap* i_cache, intptr_t start, |
| 351 int size); |
| 352 static CachePage* GetCachePage(base::CustomMatcherHashMap* i_cache, |
| 353 void* page); |
350 | 354 |
351 // Runtime call support. | 355 // Runtime call support. |
352 static void* RedirectExternalReference( | 356 static void* RedirectExternalReference( |
353 Isolate* isolate, void* external_function, | 357 Isolate* isolate, void* external_function, |
354 v8::internal::ExternalReference::Type type); | 358 v8::internal::ExternalReference::Type type); |
355 | 359 |
356 // Handle arguments and return value for runtime FP functions. | 360 // Handle arguments and return value for runtime FP functions. |
357 void GetFpArgs(double* x, double* y, int32_t* z); | 361 void GetFpArgs(double* x, double* y, int32_t* z); |
358 void SetFpResult(const double& result); | 362 void SetFpResult(const double& result); |
359 void TrashCallerSaveRegisters(); | 363 void TrashCallerSaveRegisters(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 403 |
400 // Simulator support. | 404 // Simulator support. |
401 char* stack_; | 405 char* stack_; |
402 bool pc_modified_; | 406 bool pc_modified_; |
403 int icount_; | 407 int icount_; |
404 | 408 |
405 // Debugger input. | 409 // Debugger input. |
406 char* last_debugger_input_; | 410 char* last_debugger_input_; |
407 | 411 |
408 // Icache simulation | 412 // Icache simulation |
409 base::HashMap* i_cache_; | 413 base::CustomMatcherHashMap* i_cache_; |
410 | 414 |
411 // Registered breakpoints. | 415 // Registered breakpoints. |
412 Instruction* break_pc_; | 416 Instruction* break_pc_; |
413 Instr break_instr_; | 417 Instr break_instr_; |
414 | 418 |
415 v8::internal::Isolate* isolate_; | 419 v8::internal::Isolate* isolate_; |
416 | 420 |
417 // A stop is watched if its code is less than kNumOfWatchedStops. | 421 // A stop is watched if its code is less than kNumOfWatchedStops. |
418 // Only watched stops support enabling/disabling and the counter feature. | 422 // Only watched stops support enabling/disabling and the counter feature. |
419 static const uint32_t kNumOfWatchedStops = 256; | 423 static const uint32_t kNumOfWatchedStops = 256; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { | 472 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { |
469 Simulator::current(isolate)->PopAddress(); | 473 Simulator::current(isolate)->PopAddress(); |
470 } | 474 } |
471 }; | 475 }; |
472 | 476 |
473 } // namespace internal | 477 } // namespace internal |
474 } // namespace v8 | 478 } // namespace v8 |
475 | 479 |
476 #endif // !defined(USE_SIMULATOR) | 480 #endif // !defined(USE_SIMULATOR) |
477 #endif // V8_ARM_SIMULATOR_ARM_H_ | 481 #endif // V8_ARM_SIMULATOR_ARM_H_ |
OLD | NEW |