Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Side by Side Diff: src/mips64/simulator-mips64.h

Issue 2603083002: MIPS[64]: Add support for FPR content in simulator trace. (Closed)
Patch Set: Using Set*Result functions. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/simulator-mips.cc ('k') | src/mips64/simulator-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 // simulated execution, so that the simulator can "return" to the native 296 // simulated execution, so that the simulator can "return" to the native
297 // C code. 297 // C code.
298 end_sim_pc = -2, 298 end_sim_pc = -2,
299 // Unpredictable value. 299 // Unpredictable value.
300 Unpredictable = 0xbadbeaf 300 Unpredictable = 0xbadbeaf
301 }; 301 };
302 302
303 // Unsupported instructions use Format to print an error and stop execution. 303 // Unsupported instructions use Format to print an error and stop execution.
304 void Format(Instruction* instr, const char* format); 304 void Format(Instruction* instr, const char* format);
305 305
306 // Helpers for data value tracing.
307 enum TraceType {
308 BYTE,
309 HALF,
310 WORD,
311 DWORD,
312 FLOAT,
313 DOUBLE,
314 FLOAT_DOUBLE,
315 WORD_DWORD
316 };
317
306 // Read and write memory. 318 // Read and write memory.
307 inline uint32_t ReadBU(int64_t addr); 319 inline uint32_t ReadBU(int64_t addr);
308 inline int32_t ReadB(int64_t addr); 320 inline int32_t ReadB(int64_t addr);
309 inline void WriteB(int64_t addr, uint8_t value); 321 inline void WriteB(int64_t addr, uint8_t value);
310 inline void WriteB(int64_t addr, int8_t value); 322 inline void WriteB(int64_t addr, int8_t value);
311 323
312 inline uint16_t ReadHU(int64_t addr, Instruction* instr); 324 inline uint16_t ReadHU(int64_t addr, Instruction* instr);
313 inline int16_t ReadH(int64_t addr, Instruction* instr); 325 inline int16_t ReadH(int64_t addr, Instruction* instr);
314 // Note: Overloaded on the sign of the value. 326 // Note: Overloaded on the sign of the value.
315 inline void WriteH(int64_t addr, uint16_t value, Instruction* instr); 327 inline void WriteH(int64_t addr, uint16_t value, Instruction* instr);
316 inline void WriteH(int64_t addr, int16_t value, Instruction* instr); 328 inline void WriteH(int64_t addr, int16_t value, Instruction* instr);
317 329
318 inline uint32_t ReadWU(int64_t addr, Instruction* instr); 330 inline uint32_t ReadWU(int64_t addr, Instruction* instr);
319 inline int32_t ReadW(int64_t addr, Instruction* instr); 331 inline int32_t ReadW(int64_t addr, Instruction* instr, TraceType t = WORD);
320 inline void WriteW(int64_t addr, int32_t value, Instruction* instr); 332 inline void WriteW(int64_t addr, int32_t value, Instruction* instr);
321 inline int64_t Read2W(int64_t addr, Instruction* instr); 333 inline int64_t Read2W(int64_t addr, Instruction* instr);
322 inline void Write2W(int64_t addr, int64_t value, Instruction* instr); 334 inline void Write2W(int64_t addr, int64_t value, Instruction* instr);
323 335
324 inline double ReadD(int64_t addr, Instruction* instr); 336 inline double ReadD(int64_t addr, Instruction* instr);
325 inline void WriteD(int64_t addr, double value, Instruction* instr); 337 inline void WriteD(int64_t addr, double value, Instruction* instr);
326 338
327 // Helper for debugging memory access. 339 // Helper for debugging memory access.
328 inline void DieOrDebug(); 340 inline void DieOrDebug();
329 341
330 // Helpers for data value tracing. 342 void TraceRegWr(int64_t value, TraceType t = DWORD);
331 enum TraceType {
332 BYTE,
333 HALF,
334 WORD,
335 DWORD
336 // DFLOAT - Floats may have printing issues due to paired lwc1's
337 };
338
339 void TraceRegWr(int64_t value);
340 void TraceMemWr(int64_t addr, int64_t value, TraceType t); 343 void TraceMemWr(int64_t addr, int64_t value, TraceType t);
341 void TraceMemRd(int64_t addr, int64_t value); 344 void TraceMemRd(int64_t addr, int64_t value, TraceType t = DWORD);
342 345
343 // Operations depending on endianness. 346 // Operations depending on endianness.
344 // Get Double Higher / Lower word. 347 // Get Double Higher / Lower word.
345 inline int32_t GetDoubleHIW(double* addr); 348 inline int32_t GetDoubleHIW(double* addr);
346 inline int32_t GetDoubleLOW(double* addr); 349 inline int32_t GetDoubleLOW(double* addr);
347 // Set Double Higher / Lower word. 350 // Set Double Higher / Lower word.
348 inline int32_t SetDoubleHIW(double* addr); 351 inline int32_t SetDoubleHIW(double* addr);
349 inline int32_t SetDoubleLOW(double* addr); 352 inline int32_t SetDoubleLOW(double* addr);
350 353
351 SimInstruction instr_; 354 SimInstruction instr_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 inline int32_t ft_reg() const { return instr_.FtValue(); } 392 inline int32_t ft_reg() const { return instr_.FtValue(); }
390 inline int32_t fd_reg() const { return instr_.FdValue(); } 393 inline int32_t fd_reg() const { return instr_.FdValue(); }
391 inline int32_t sa() const { return instr_.SaValue(); } 394 inline int32_t sa() const { return instr_.SaValue(); }
392 inline int32_t lsa_sa() const { return instr_.LsaSaValue(); } 395 inline int32_t lsa_sa() const { return instr_.LsaSaValue(); }
393 396
394 inline void SetResult(const int32_t rd_reg, const int64_t alu_out) { 397 inline void SetResult(const int32_t rd_reg, const int64_t alu_out) {
395 set_register(rd_reg, alu_out); 398 set_register(rd_reg, alu_out);
396 TraceRegWr(alu_out); 399 TraceRegWr(alu_out);
397 } 400 }
398 401
402 inline void SetFPUWordResult(int32_t fd_reg, int32_t alu_out) {
403 set_fpu_register_word(fd_reg, alu_out);
404 TraceRegWr(get_fpu_register(fd_reg), WORD);
405 }
406
407 inline void SetFPUWordResult2(int32_t fd_reg, int32_t alu_out) {
408 set_fpu_register_word(fd_reg, alu_out);
409 TraceRegWr(get_fpu_register(fd_reg));
410 }
411
412 inline void SetFPUResult(int32_t fd_reg, int64_t alu_out) {
413 set_fpu_register(fd_reg, alu_out);
414 TraceRegWr(get_fpu_register(fd_reg));
415 }
416
417 inline void SetFPUResult2(int32_t fd_reg, int64_t alu_out) {
418 set_fpu_register(fd_reg, alu_out);
419 TraceRegWr(get_fpu_register(fd_reg), DOUBLE);
420 }
421
422 inline void SetFPUFloatResult(int32_t fd_reg, float alu_out) {
423 set_fpu_register_float(fd_reg, alu_out);
424 TraceRegWr(get_fpu_register(fd_reg), FLOAT);
425 }
426
427 inline void SetFPUDoubleResult(int32_t fd_reg, double alu_out) {
428 set_fpu_register_double(fd_reg, alu_out);
429 TraceRegWr(get_fpu_register(fd_reg), DOUBLE);
430 }
431
399 void DecodeTypeImmediate(); 432 void DecodeTypeImmediate();
400 void DecodeTypeJump(); 433 void DecodeTypeJump();
401 434
402 // Used for breakpoints and traps. 435 // Used for breakpoints and traps.
403 void SoftwareInterrupt(); 436 void SoftwareInterrupt();
404 437
405 // Compact branch guard. 438 // Compact branch guard.
406 void CheckForbiddenSlot(int64_t current_pc) { 439 void CheckForbiddenSlot(int64_t current_pc) {
407 Instruction* instr_after_compact_branch = 440 Instruction* instr_after_compact_branch =
408 reinterpret_cast<Instruction*>(current_pc + Instruction::kInstrSize); 441 reinterpret_cast<Instruction*>(current_pc + Instruction::kInstrSize);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 static inline void UnregisterCTryCatch(Isolate* isolate) { 588 static inline void UnregisterCTryCatch(Isolate* isolate) {
556 Simulator::current(isolate)->PopAddress(); 589 Simulator::current(isolate)->PopAddress();
557 } 590 }
558 }; 591 };
559 592
560 } // namespace internal 593 } // namespace internal
561 } // namespace v8 594 } // namespace v8
562 595
563 #endif // !defined(USE_SIMULATOR) 596 #endif // !defined(USE_SIMULATOR)
564 #endif // V8_MIPS_SIMULATOR_MIPS_H_ 597 #endif // V8_MIPS_SIMULATOR_MIPS_H_
OLDNEW
« no previous file with comments | « src/mips/simulator-mips.cc ('k') | src/mips64/simulator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698