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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 }; | 61 }; |
62 | 62 |
63 } // namespace internal | 63 } // namespace internal |
64 } // namespace v8 | 64 } // namespace v8 |
65 | 65 |
66 #else // !defined(USE_SIMULATOR) | 66 #else // !defined(USE_SIMULATOR) |
67 // Running with a simulator. | 67 // Running with a simulator. |
68 | 68 |
69 #include "src/arm/constants-arm.h" | 69 #include "src/arm/constants-arm.h" |
70 #include "src/assembler.h" | 70 #include "src/assembler.h" |
71 #include "src/hashmap.h" | 71 #include "src/base/hashmap.h" |
72 | 72 |
73 namespace v8 { | 73 namespace v8 { |
74 namespace internal { | 74 namespace internal { |
75 | 75 |
76 class CachePage { | 76 class CachePage { |
77 public: | 77 public: |
78 static const int LINE_VALID = 0; | 78 static const int LINE_VALID = 0; |
79 static const int LINE_INVALID = 1; | 79 static const int LINE_INVALID = 1; |
80 | 80 |
81 static const int kPageShift = 12; | 81 static const int kPageShift = 12; |
(...skipping 111 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(HashMap* i_cache, Redirection* first); | 203 static void TearDown(base::HashMap* 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(v8::internal::HashMap* i_cache, void* start, | 225 static void FlushICache(base::HashMap* i_cache, void* start, size_t size); |
226 size_t size); | |
227 | 226 |
228 // Returns true if pc register contains one of the 'special_values' defined | 227 // Returns true if pc register contains one of the 'special_values' defined |
229 // below (bad_lr, end_sim_pc). | 228 // below (bad_lr, end_sim_pc). |
230 bool has_bad_pc() const; | 229 bool has_bad_pc() const; |
231 | 230 |
232 // EABI variant for double arguments in use. | 231 // EABI variant for double arguments in use. |
233 bool use_eabi_hardfloat() { | 232 bool use_eabi_hardfloat() { |
234 #if USE_EABI_HARDFLOAT | 233 #if USE_EABI_HARDFLOAT |
235 return true; | 234 return true; |
236 #else | 235 #else |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 334 |
336 void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instruction* instr); | 335 void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instruction* instr); |
337 void DecodeVCMP(Instruction* instr); | 336 void DecodeVCMP(Instruction* instr); |
338 void DecodeVCVTBetweenDoubleAndSingle(Instruction* instr); | 337 void DecodeVCVTBetweenDoubleAndSingle(Instruction* instr); |
339 void DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr); | 338 void DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr); |
340 | 339 |
341 // Executes one instruction. | 340 // Executes one instruction. |
342 void InstructionDecode(Instruction* instr); | 341 void InstructionDecode(Instruction* instr); |
343 | 342 |
344 // ICache. | 343 // ICache. |
345 static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr); | 344 static void CheckICache(base::HashMap* i_cache, Instruction* instr); |
346 static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start, | 345 static void FlushOnePage(base::HashMap* i_cache, intptr_t start, int size); |
347 int size); | 346 static CachePage* GetCachePage(base::HashMap* i_cache, void* page); |
348 static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page); | |
349 | 347 |
350 // Runtime call support. | 348 // Runtime call support. |
351 static void* RedirectExternalReference( | 349 static void* RedirectExternalReference( |
352 Isolate* isolate, void* external_function, | 350 Isolate* isolate, void* external_function, |
353 v8::internal::ExternalReference::Type type); | 351 v8::internal::ExternalReference::Type type); |
354 | 352 |
355 // Handle arguments and return value for runtime FP functions. | 353 // Handle arguments and return value for runtime FP functions. |
356 void GetFpArgs(double* x, double* y, int32_t* z); | 354 void GetFpArgs(double* x, double* y, int32_t* z); |
357 void SetFpResult(const double& result); | 355 void SetFpResult(const double& result); |
358 void TrashCallerSaveRegisters(); | 356 void TrashCallerSaveRegisters(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 396 |
399 // Simulator support. | 397 // Simulator support. |
400 char* stack_; | 398 char* stack_; |
401 bool pc_modified_; | 399 bool pc_modified_; |
402 int icount_; | 400 int icount_; |
403 | 401 |
404 // Debugger input. | 402 // Debugger input. |
405 char* last_debugger_input_; | 403 char* last_debugger_input_; |
406 | 404 |
407 // Icache simulation | 405 // Icache simulation |
408 v8::internal::HashMap* i_cache_; | 406 base::HashMap* i_cache_; |
409 | 407 |
410 // Registered breakpoints. | 408 // Registered breakpoints. |
411 Instruction* break_pc_; | 409 Instruction* break_pc_; |
412 Instr break_instr_; | 410 Instr break_instr_; |
413 | 411 |
414 v8::internal::Isolate* isolate_; | 412 v8::internal::Isolate* isolate_; |
415 | 413 |
416 // A stop is watched if its code is less than kNumOfWatchedStops. | 414 // A stop is watched if its code is less than kNumOfWatchedStops. |
417 // Only watched stops support enabling/disabling and the counter feature. | 415 // Only watched stops support enabling/disabling and the counter feature. |
418 static const uint32_t kNumOfWatchedStops = 256; | 416 static const uint32_t kNumOfWatchedStops = 256; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { | 465 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { |
468 Simulator::current(isolate)->PopAddress(); | 466 Simulator::current(isolate)->PopAddress(); |
469 } | 467 } |
470 }; | 468 }; |
471 | 469 |
472 } // namespace internal | 470 } // namespace internal |
473 } // namespace v8 | 471 } // namespace v8 |
474 | 472 |
475 #endif // !defined(USE_SIMULATOR) | 473 #endif // !defined(USE_SIMULATOR) |
476 #endif // V8_ARM_SIMULATOR_ARM_H_ | 474 #endif // V8_ARM_SIMULATOR_ARM_H_ |
OLD | NEW |