OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 MIPS instructions if we are not generating a native | 6 // Declares a Simulator for MIPS instructions if we are not generating a native |
7 // MIPS binary. This Simulator allows us to run and debug MIPS code generation | 7 // MIPS binary. This Simulator allows us to run and debug MIPS code generation |
8 // on regular desktop machines. | 8 // on 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 }; | 329 }; |
330 | 330 |
331 // Unsupported instructions use Format to print an error and stop execution. | 331 // Unsupported instructions use Format to print an error and stop execution. |
332 void Format(Instruction* instr, const char* format); | 332 void Format(Instruction* instr, const char* format); |
333 | 333 |
334 // Helpers for data value tracing. | 334 // Helpers for data value tracing. |
335 enum TraceType { BYTE, HALF, WORD, DWORD, FLOAT, DOUBLE, FLOAT_DOUBLE }; | 335 enum TraceType { BYTE, HALF, WORD, DWORD, FLOAT, DOUBLE, FLOAT_DOUBLE }; |
336 | 336 |
337 // MSA Data Format | 337 // MSA Data Format |
338 enum MSADataFormat { MSA_VECT = 0, MSA_BYTE, MSA_HALF, MSA_WORD, MSA_DWORD }; | 338 enum MSADataFormat { MSA_VECT = 0, MSA_BYTE, MSA_HALF, MSA_WORD, MSA_DWORD }; |
| 339 typedef union { |
| 340 int8_t b[kMSALanesByte]; |
| 341 int16_t h[kMSALanesHalf]; |
| 342 int32_t w[kMSALanesWord]; |
| 343 int64_t d[kMSALanesDword]; |
| 344 } msa_reg_t; |
339 | 345 |
340 // Read and write memory. | 346 // Read and write memory. |
341 inline uint32_t ReadBU(int32_t addr); | 347 inline uint32_t ReadBU(int32_t addr); |
342 inline int32_t ReadB(int32_t addr); | 348 inline int32_t ReadB(int32_t addr); |
343 inline void WriteB(int32_t addr, uint8_t value); | 349 inline void WriteB(int32_t addr, uint8_t value); |
344 inline void WriteB(int32_t addr, int8_t value); | 350 inline void WriteB(int32_t addr, int8_t value); |
345 | 351 |
346 inline uint16_t ReadHU(int32_t addr, Instruction* instr); | 352 inline uint16_t ReadHU(int32_t addr, Instruction* instr); |
347 inline int16_t ReadH(int32_t addr, Instruction* instr); | 353 inline int16_t ReadH(int32_t addr, Instruction* instr); |
348 // Note: Overloaded on the sign of the value. | 354 // Note: Overloaded on the sign of the value. |
349 inline void WriteH(int32_t addr, uint16_t value, Instruction* instr); | 355 inline void WriteH(int32_t addr, uint16_t value, Instruction* instr); |
350 inline void WriteH(int32_t addr, int16_t value, Instruction* instr); | 356 inline void WriteH(int32_t addr, int16_t value, Instruction* instr); |
351 | 357 |
352 inline int ReadW(int32_t addr, Instruction* instr, TraceType t = WORD); | 358 inline int ReadW(int32_t addr, Instruction* instr, TraceType t = WORD); |
353 inline void WriteW(int32_t addr, int value, Instruction* instr); | 359 inline void WriteW(int32_t addr, int value, Instruction* instr); |
354 | 360 |
355 inline double ReadD(int32_t addr, Instruction* instr); | 361 inline double ReadD(int32_t addr, Instruction* instr); |
356 inline void WriteD(int32_t addr, double value, Instruction* instr); | 362 inline void WriteD(int32_t addr, double value, Instruction* instr); |
357 | 363 |
358 void TraceRegWr(int32_t value, TraceType t = WORD); | 364 void TraceRegWr(int32_t value, TraceType t = WORD); |
359 void TraceRegWr(int64_t value, TraceType t = DWORD); | 365 void TraceRegWr(int64_t value, TraceType t = DWORD); |
360 template <typename T> | 366 template <typename T> |
361 void TraceMSARegWr(T* value, TraceType t); | 367 void TraceMSARegWr(T* value, TraceType t); |
| 368 template <typename T> |
| 369 void TraceMSARegWr(T* value); |
362 void TraceMemWr(int32_t addr, int32_t value, TraceType t = WORD); | 370 void TraceMemWr(int32_t addr, int32_t value, TraceType t = WORD); |
363 void TraceMemRd(int32_t addr, int32_t value, TraceType t = WORD); | 371 void TraceMemRd(int32_t addr, int32_t value, TraceType t = WORD); |
364 void TraceMemWr(int32_t addr, int64_t value, TraceType t = DWORD); | 372 void TraceMemWr(int32_t addr, int64_t value, TraceType t = DWORD); |
365 void TraceMemRd(int32_t addr, int64_t value, TraceType t = DWORD); | 373 void TraceMemRd(int32_t addr, int64_t value, TraceType t = DWORD); |
366 EmbeddedVector<char, 128> trace_buf_; | 374 EmbeddedVector<char, 128> trace_buf_; |
367 | 375 |
368 // Operations depending on endianness. | 376 // Operations depending on endianness. |
369 // Get Double Higher / Lower word. | 377 // Get Double Higher / Lower word. |
370 inline int32_t GetDoubleHIW(double* addr); | 378 inline int32_t GetDoubleHIW(double* addr); |
371 inline int32_t GetDoubleLOW(double* addr); | 379 inline int32_t GetDoubleLOW(double* addr); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 static inline void UnregisterCTryCatch(Isolate* isolate) { | 622 static inline void UnregisterCTryCatch(Isolate* isolate) { |
615 Simulator::current(isolate)->PopAddress(); | 623 Simulator::current(isolate)->PopAddress(); |
616 } | 624 } |
617 }; | 625 }; |
618 | 626 |
619 } // namespace internal | 627 } // namespace internal |
620 } // namespace v8 | 628 } // namespace v8 |
621 | 629 |
622 #endif // !defined(USE_SIMULATOR) | 630 #endif // !defined(USE_SIMULATOR) |
623 #endif // V8_MIPS_SIMULATOR_MIPS_H_ | 631 #endif // V8_MIPS_SIMULATOR_MIPS_H_ |
OLD | NEW |