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 | 5 |
6 // Declares a Simulator for PPC instructions if we are not generating a native | 6 // Declares a Simulator for PPC instructions if we are not generating a native |
7 // PPC binary. This Simulator allows us to run and debug PPC code generation on | 7 // PPC binary. This Simulator allows us to run and debug PPC 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 // Accessor to the internal simulator stack area. | 211 // Accessor to the internal simulator stack area. |
212 uintptr_t StackLimit(uintptr_t c_limit) const; | 212 uintptr_t StackLimit(uintptr_t c_limit) const; |
213 | 213 |
214 // Executes PPC instructions until the PC reaches end_sim_pc. | 214 // Executes PPC instructions until the PC reaches end_sim_pc. |
215 void Execute(); | 215 void Execute(); |
216 | 216 |
217 // Call on program start. | 217 // Call on program start. |
218 static void Initialize(Isolate* isolate); | 218 static void Initialize(Isolate* isolate); |
219 | 219 |
220 static void TearDown(HashMap* i_cache, Redirection* first); | 220 static void TearDown(base::HashMap* i_cache, Redirection* first); |
221 | 221 |
222 // V8 generally calls into generated JS code with 5 parameters and into | 222 // V8 generally calls into generated JS code with 5 parameters and into |
223 // generated RegExp code with 7 parameters. This is a convenience function, | 223 // generated RegExp code with 7 parameters. This is a convenience function, |
224 // which sets up the simulator state and grabs the result on return. | 224 // which sets up the simulator state and grabs the result on return. |
225 intptr_t Call(byte* entry, int argument_count, ...); | 225 intptr_t Call(byte* entry, int argument_count, ...); |
226 // Alternative: call a 2-argument double function. | 226 // Alternative: call a 2-argument double function. |
227 void CallFP(byte* entry, double d0, double d1); | 227 void CallFP(byte* entry, double d0, double d1); |
228 int32_t CallFPReturnsInt(byte* entry, double d0, double d1); | 228 int32_t CallFPReturnsInt(byte* entry, double d0, double d1); |
229 double CallFPReturnsDouble(byte* entry, double d0, double d1); | 229 double CallFPReturnsDouble(byte* entry, double d0, double d1); |
230 | 230 |
231 // Push an address onto the JS stack. | 231 // Push an address onto the JS stack. |
232 uintptr_t PushAddress(uintptr_t address); | 232 uintptr_t PushAddress(uintptr_t address); |
233 | 233 |
234 // Pop an address from the JS stack. | 234 // Pop an address from the JS stack. |
235 uintptr_t PopAddress(); | 235 uintptr_t PopAddress(); |
236 | 236 |
237 // Debugger input. | 237 // Debugger input. |
238 void set_last_debugger_input(char* input); | 238 void set_last_debugger_input(char* input); |
239 char* last_debugger_input() { return last_debugger_input_; } | 239 char* last_debugger_input() { return last_debugger_input_; } |
240 | 240 |
241 // ICache checking. | 241 // ICache checking. |
242 static void FlushICache(v8::internal::HashMap* i_cache, void* start, | 242 static void FlushICache(base::HashMap* i_cache, void* start, size_t size); |
243 size_t size); | |
244 | 243 |
245 // Returns true if pc register contains one of the 'special_values' defined | 244 // Returns true if pc register contains one of the 'special_values' defined |
246 // below (bad_lr, end_sim_pc). | 245 // below (bad_lr, end_sim_pc). |
247 bool has_bad_pc() const; | 246 bool has_bad_pc() const; |
248 | 247 |
249 private: | 248 private: |
250 enum special_values { | 249 enum special_values { |
251 // Known bad pc value to ensure that the simulator does not execute | 250 // Known bad pc value to ensure that the simulator does not execute |
252 // without being properly setup. | 251 // without being properly setup. |
253 bad_lr = -1, | 252 bad_lr = -1, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 #endif | 322 #endif |
324 void ExecuteGeneric(Instruction* instr); | 323 void ExecuteGeneric(Instruction* instr); |
325 | 324 |
326 void SetFPSCR(int bit) { fp_condition_reg_ |= (1 << (31 - bit)); } | 325 void SetFPSCR(int bit) { fp_condition_reg_ |= (1 << (31 - bit)); } |
327 void ClearFPSCR(int bit) { fp_condition_reg_ &= ~(1 << (31 - bit)); } | 326 void ClearFPSCR(int bit) { fp_condition_reg_ &= ~(1 << (31 - bit)); } |
328 | 327 |
329 // Executes one instruction. | 328 // Executes one instruction. |
330 void ExecuteInstruction(Instruction* instr); | 329 void ExecuteInstruction(Instruction* instr); |
331 | 330 |
332 // ICache. | 331 // ICache. |
333 static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr); | 332 static void CheckICache(base::HashMap* i_cache, Instruction* instr); |
334 static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start, | 333 static void FlushOnePage(base::HashMap* i_cache, intptr_t start, int size); |
335 int size); | 334 static CachePage* GetCachePage(base::HashMap* i_cache, void* page); |
336 static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page); | |
337 | 335 |
338 // Runtime call support. | 336 // Runtime call support. |
339 static void* RedirectExternalReference( | 337 static void* RedirectExternalReference( |
340 Isolate* isolate, void* external_function, | 338 Isolate* isolate, void* external_function, |
341 v8::internal::ExternalReference::Type type); | 339 v8::internal::ExternalReference::Type type); |
342 | 340 |
343 // Handle arguments and return value for runtime FP functions. | 341 // Handle arguments and return value for runtime FP functions. |
344 void GetFpArgs(double* x, double* y, intptr_t* z); | 342 void GetFpArgs(double* x, double* y, intptr_t* z); |
345 void SetFpResult(const double& result); | 343 void SetFpResult(const double& result); |
346 void TrashCallerSaveRegisters(); | 344 void TrashCallerSaveRegisters(); |
(...skipping 17 matching lines...) Expand all Loading... |
364 // Simulator support. | 362 // Simulator support. |
365 char* stack_; | 363 char* stack_; |
366 static const size_t stack_protection_size_ = 256 * kPointerSize; | 364 static const size_t stack_protection_size_ = 256 * kPointerSize; |
367 bool pc_modified_; | 365 bool pc_modified_; |
368 int icount_; | 366 int icount_; |
369 | 367 |
370 // Debugger input. | 368 // Debugger input. |
371 char* last_debugger_input_; | 369 char* last_debugger_input_; |
372 | 370 |
373 // Icache simulation | 371 // Icache simulation |
374 v8::internal::HashMap* i_cache_; | 372 base::HashMap* i_cache_; |
375 | 373 |
376 // Registered breakpoints. | 374 // Registered breakpoints. |
377 Instruction* break_pc_; | 375 Instruction* break_pc_; |
378 Instr break_instr_; | 376 Instr break_instr_; |
379 | 377 |
380 v8::internal::Isolate* isolate_; | 378 v8::internal::Isolate* isolate_; |
381 | 379 |
382 // A stop is watched if its code is less than kNumOfWatchedStops. | 380 // A stop is watched if its code is less than kNumOfWatchedStops. |
383 // Only watched stops support enabling/disabling and the counter feature. | 381 // Only watched stops support enabling/disabling and the counter feature. |
384 static const uint32_t kNumOfWatchedStops = 256; | 382 static const uint32_t kNumOfWatchedStops = 256; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 430 |
433 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { | 431 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { |
434 Simulator::current(isolate)->PopAddress(); | 432 Simulator::current(isolate)->PopAddress(); |
435 } | 433 } |
436 }; | 434 }; |
437 } // namespace internal | 435 } // namespace internal |
438 } // namespace v8 | 436 } // namespace v8 |
439 | 437 |
440 #endif // !defined(USE_SIMULATOR) | 438 #endif // !defined(USE_SIMULATOR) |
441 #endif // V8_PPC_SIMULATOR_PPC_H_ | 439 #endif // V8_PPC_SIMULATOR_PPC_H_ |
OLD | NEW |