Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ | 5 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ |
| 6 #define V8_ARM64_SIMULATOR_ARM64_H_ | 6 #define V8_ARM64_SIMULATOR_ARM64_H_ |
| 7 | 7 |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 | 65 |
| 66 static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { | 66 static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) { |
| 67 return try_catch_address; | 67 return try_catch_address; |
| 68 } | 68 } |
| 69 | 69 |
| 70 static void UnregisterCTryCatch() { } | 70 static void UnregisterCTryCatch() { } |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 #else // !defined(USE_SIMULATOR) | 73 #else // !defined(USE_SIMULATOR) |
| 74 | 74 |
| 75 | |
| 76 template<typename T> | |
|
Fritz
2014/05/20 19:44:24
utils-arm64.h or utils.h?
jbramley
2014/05/21 08:02:30
It's not ARM64-specific, so I'd say utils.h, but t
Fritz
2014/05/21 16:38:56
Done.
| |
| 77 struct make_unsigned { | |
| 78 typedef T type; | |
| 79 }; | |
| 80 | |
| 81 | |
| 75 enum ReverseByteMode { | 82 enum ReverseByteMode { |
| 76 Reverse16 = 0, | 83 Reverse16 = 0, |
| 77 Reverse32 = 1, | 84 Reverse32 = 1, |
| 78 Reverse64 = 2 | 85 Reverse64 = 2 |
| 79 }; | 86 }; |
| 80 | 87 |
| 81 | 88 |
| 82 // The proper way to initialize a simulated system register (such as NZCV) is as | 89 // The proper way to initialize a simulated system register (such as NZCV) is as |
| 83 // follows: | 90 // follows: |
| 84 // SimSystemRegister nzcv = SimSystemRegister::DefaultValueFor(NZCV); | 91 // SimSystemRegister nzcv = SimSystemRegister::DefaultValueFor(NZCV); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 // describes the bits which are not modifiable. | 133 // describes the bits which are not modifiable. |
| 127 SimSystemRegister(uint32_t value, uint32_t write_ignore_mask) | 134 SimSystemRegister(uint32_t value, uint32_t write_ignore_mask) |
| 128 : value_(value), write_ignore_mask_(write_ignore_mask) { } | 135 : value_(value), write_ignore_mask_(write_ignore_mask) { } |
| 129 | 136 |
| 130 uint32_t value_; | 137 uint32_t value_; |
| 131 uint32_t write_ignore_mask_; | 138 uint32_t write_ignore_mask_; |
| 132 }; | 139 }; |
| 133 | 140 |
| 134 | 141 |
| 135 // Represent a register (r0-r31, v0-v31). | 142 // Represent a register (r0-r31, v0-v31). |
| 136 template<int kSizeInBytes> | |
| 137 class SimRegisterBase { | 143 class SimRegisterBase { |
| 138 public: | 144 public: |
| 139 template<typename T> | 145 template<typename T> |
| 140 void Set(T new_value, unsigned size = sizeof(T)) { | 146 void Set(T new_value) { |
| 141 ASSERT(size <= kSizeInBytes); | 147 value_ = 0; |
| 142 ASSERT(size <= sizeof(new_value)); | 148 memcpy(&value_, &new_value, sizeof(T)); |
| 143 // All AArch64 registers are zero-extending; Writing a W register clears the | |
| 144 // top bits of the corresponding X register. | |
| 145 memset(value_, 0, kSizeInBytes); | |
| 146 memcpy(value_, &new_value, size); | |
| 147 } | 149 } |
| 148 | 150 |
| 149 // Copy 'size' bytes of the register to the result, and zero-extend to fill | |
| 150 // the result. | |
| 151 template<typename T> | 151 template<typename T> |
| 152 T Get(unsigned size = sizeof(T)) const { | 152 T Get() const { |
| 153 ASSERT(size <= kSizeInBytes); | |
| 154 T result; | 153 T result; |
| 155 memset(&result, 0, sizeof(result)); | 154 memcpy(&result, &value_, sizeof(T)); |
| 156 memcpy(&result, value_, size); | |
| 157 return result; | 155 return result; |
| 158 } | 156 } |
| 159 | 157 |
| 160 protected: | 158 protected: |
| 161 uint8_t value_[kSizeInBytes]; | 159 int64_t value_; |
|
Fritz
2014/05/20 19:44:24
for the SIMD registers I considered templating thi
jbramley
2014/05/21 08:02:30
I don't think we can assume that uint128_t is avai
| |
| 162 }; | 160 }; |
| 163 typedef SimRegisterBase<kXRegSize> SimRegister; // r0-r31 | 161 |
| 164 typedef SimRegisterBase<kDRegSize> SimFPRegister; // v0-v31 | 162 STATIC_ASSERT(kXRegSize == kDRegSize); |
| 163 typedef SimRegisterBase SimRegister; // r0-r31 | |
| 164 typedef SimRegisterBase SimFPRegister; // v0-v31 | |
| 165 | 165 |
| 166 | 166 |
| 167 class Simulator : public DecoderVisitor { | 167 class Simulator : public DecoderVisitor { |
| 168 public: | 168 public: |
| 169 explicit Simulator(Decoder<DispatchingDecoderVisitor>* decoder, | 169 explicit Simulator(Decoder<DispatchingDecoderVisitor>* decoder, |
| 170 Isolate* isolate = NULL, | 170 Isolate* isolate = NULL, |
| 171 FILE* stream = stderr); | 171 FILE* stream = stderr); |
| 172 Simulator(); | 172 Simulator(); |
| 173 ~Simulator(); | 173 ~Simulator(); |
| 174 | 174 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 LogProcessorState(); | 321 LogProcessorState(); |
| 322 increment_pc(); | 322 increment_pc(); |
| 323 CheckBreakpoints(); | 323 CheckBreakpoints(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 // Declare all Visitor functions. | 326 // Declare all Visitor functions. |
| 327 #define DECLARE(A) void Visit##A(Instruction* instr); | 327 #define DECLARE(A) void Visit##A(Instruction* instr); |
| 328 VISITOR_LIST(DECLARE) | 328 VISITOR_LIST(DECLARE) |
| 329 #undef DECLARE | 329 #undef DECLARE |
| 330 | 330 |
| 331 bool IsZeroRegister(unsigned code, Reg31Mode r31mode) const { | |
| 332 return ((code == 31) && (r31mode == Reg31IsZeroRegister)); | |
| 333 } | |
| 334 | |
| 331 // Register accessors. | 335 // Register accessors. |
| 332 | |
| 333 // Return 'size' bits of the value of an integer register, as the specified | 336 // Return 'size' bits of the value of an integer register, as the specified |
| 334 // type. The value is zero-extended to fill the result. | 337 // type. The value is zero-extended to fill the result. |
| 335 // | 338 // |
| 336 // The only supported values of 'size' are kXRegSizeInBits and | |
| 337 // kWRegSizeInBits. | |
| 338 template<typename T> | |
| 339 T reg(unsigned size, unsigned code, | |
| 340 Reg31Mode r31mode = Reg31IsZeroRegister) const { | |
| 341 unsigned size_in_bytes = size / 8; | |
| 342 ASSERT(size_in_bytes <= sizeof(T)); | |
| 343 ASSERT((size == kXRegSizeInBits) || (size == kWRegSizeInBits)); | |
| 344 ASSERT(code < kNumberOfRegisters); | |
| 345 | |
| 346 if ((code == 31) && (r31mode == Reg31IsZeroRegister)) { | |
| 347 T result; | |
| 348 memset(&result, 0, sizeof(result)); | |
| 349 return result; | |
| 350 } | |
| 351 return registers_[code].Get<T>(size_in_bytes); | |
| 352 } | |
| 353 | |
| 354 // Like reg(), but infer the access size from the template type. | |
| 355 template<typename T> | 339 template<typename T> |
| 356 T reg(unsigned code, Reg31Mode r31mode = Reg31IsZeroRegister) const { | 340 T reg(unsigned code, Reg31Mode r31mode = Reg31IsZeroRegister) const { |
| 357 return reg<T>(sizeof(T) * 8, code, r31mode); | 341 ASSERT(code < kNumberOfRegisters); |
| 342 if (IsZeroRegister(code, r31mode)) { | |
| 343 return 0; | |
| 344 } | |
| 345 return registers_[code].Get<T>(); | |
| 358 } | 346 } |
| 359 | 347 |
| 360 // Common specialized accessors for the reg() template. | 348 // Common specialized accessors for the reg() template. |
| 361 int32_t wreg(unsigned code, | 349 int32_t wreg(unsigned code, Reg31Mode r31mode = Reg31IsZeroRegister) const { |
| 362 Reg31Mode r31mode = Reg31IsZeroRegister) const { | |
| 363 return reg<int32_t>(code, r31mode); | 350 return reg<int32_t>(code, r31mode); |
| 364 } | 351 } |
| 365 | 352 |
| 366 int64_t xreg(unsigned code, | 353 int64_t xreg(unsigned code, Reg31Mode r31mode = Reg31IsZeroRegister) const { |
| 367 Reg31Mode r31mode = Reg31IsZeroRegister) const { | |
| 368 return reg<int64_t>(code, r31mode); | 354 return reg<int64_t>(code, r31mode); |
| 369 } | 355 } |
| 370 | 356 |
| 371 int64_t reg(unsigned size, unsigned code, | |
| 372 Reg31Mode r31mode = Reg31IsZeroRegister) const { | |
| 373 return reg<int64_t>(size, code, r31mode); | |
| 374 } | |
| 375 | |
| 376 // Write 'size' bits of 'value' into an integer register. The value is | 357 // Write 'size' bits of 'value' into an integer register. The value is |
| 377 // zero-extended. This behaviour matches AArch64 register writes. | 358 // zero-extended. This behaviour matches AArch64 register writes. |
| 378 // | |
| 379 // The only supported values of 'size' are kXRegSizeInBits and | |
| 380 // kWRegSizeInBits. | |
| 381 template<typename T> | |
| 382 void set_reg(unsigned size, unsigned code, T value, | |
| 383 Reg31Mode r31mode = Reg31IsZeroRegister) { | |
| 384 unsigned size_in_bytes = size / 8; | |
| 385 ASSERT(size_in_bytes <= sizeof(T)); | |
| 386 ASSERT((size == kXRegSizeInBits) || (size == kWRegSizeInBits)); | |
| 387 ASSERT(code < kNumberOfRegisters); | |
| 388 | |
| 389 if ((code == 31) && (r31mode == Reg31IsZeroRegister)) { | |
| 390 return; | |
| 391 } | |
| 392 return registers_[code].Set(value, size_in_bytes); | |
| 393 } | |
| 394 | 359 |
| 395 // Like set_reg(), but infer the access size from the template type. | 360 // Like set_reg(), but infer the access size from the template type. |
| 396 template<typename T> | 361 template<typename T> |
| 397 void set_reg(unsigned code, T value, | 362 void set_reg(unsigned code, T value, |
| 398 Reg31Mode r31mode = Reg31IsZeroRegister) { | 363 Reg31Mode r31mode = Reg31IsZeroRegister) { |
| 399 set_reg(sizeof(value) * 8, code, value, r31mode); | 364 ASSERT(code < kNumberOfRegisters); |
| 365 if (!IsZeroRegister(code, r31mode)) | |
| 366 registers_[code].Set(value); | |
| 400 } | 367 } |
| 401 | 368 |
| 402 // Common specialized accessors for the set_reg() template. | 369 // Common specialized accessors for the set_reg() template. |
| 403 void set_wreg(unsigned code, int32_t value, | 370 void set_wreg(unsigned code, int32_t value, |
| 404 Reg31Mode r31mode = Reg31IsZeroRegister) { | 371 Reg31Mode r31mode = Reg31IsZeroRegister) { |
| 405 set_reg(kWRegSizeInBits, code, value, r31mode); | 372 set_reg(code, value, r31mode); |
| 406 } | 373 } |
| 407 | 374 |
| 408 void set_xreg(unsigned code, int64_t value, | 375 void set_xreg(unsigned code, int64_t value, |
| 409 Reg31Mode r31mode = Reg31IsZeroRegister) { | 376 Reg31Mode r31mode = Reg31IsZeroRegister) { |
| 410 set_reg(kXRegSizeInBits, code, value, r31mode); | 377 set_reg(code, value, r31mode); |
| 411 } | 378 } |
| 412 | 379 |
| 413 // Commonly-used special cases. | 380 // Commonly-used special cases. |
| 414 template<typename T> | 381 template<typename T> |
| 415 void set_lr(T value) { | 382 void set_lr(T value) { |
| 416 ASSERT(sizeof(T) == kPointerSize); | 383 ASSERT(sizeof(T) == kPointerSize); |
| 417 set_reg(kLinkRegCode, value); | 384 set_reg(kLinkRegCode, value); |
| 418 } | 385 } |
| 419 | 386 |
| 420 template<typename T> | 387 template<typename T> |
| 421 void set_sp(T value) { | 388 void set_sp(T value) { |
| 422 ASSERT(sizeof(T) == kPointerSize); | 389 ASSERT(sizeof(T) == kPointerSize); |
| 423 set_reg(31, value, Reg31IsStackPointer); | 390 set_reg(31, value, Reg31IsStackPointer); |
| 424 } | 391 } |
| 425 | 392 |
| 426 int64_t sp() { return xreg(31, Reg31IsStackPointer); } | 393 int64_t sp() { return xreg(31, Reg31IsStackPointer); } |
| 427 int64_t jssp() { return xreg(kJSSPCode, Reg31IsStackPointer); } | 394 int64_t jssp() { return xreg(kJSSPCode, Reg31IsStackPointer); } |
| 428 int64_t fp() { | 395 int64_t fp() { |
| 429 return xreg(kFramePointerRegCode, Reg31IsStackPointer); | 396 return xreg(kFramePointerRegCode, Reg31IsStackPointer); |
| 430 } | 397 } |
| 431 Instruction* lr() { return reg<Instruction*>(kLinkRegCode); } | 398 Instruction* lr() { return reg<Instruction*>(kLinkRegCode); } |
| 432 | 399 |
| 433 Address get_sp() { return reg<Address>(31, Reg31IsStackPointer); } | 400 Address get_sp() { return reg<Address>(31, Reg31IsStackPointer); } |
| 434 | 401 |
| 435 // Return 'size' bits of the value of a floating-point register, as the | |
| 436 // specified type. The value is zero-extended to fill the result. | |
| 437 // | |
| 438 // The only supported values of 'size' are kDRegSizeInBits and | |
| 439 // kSRegSizeInBits. | |
| 440 template<typename T> | |
| 441 T fpreg(unsigned size, unsigned code) const { | |
| 442 unsigned size_in_bytes = size / 8; | |
| 443 ASSERT(size_in_bytes <= sizeof(T)); | |
| 444 ASSERT((size == kDRegSizeInBits) || (size == kSRegSizeInBits)); | |
| 445 ASSERT(code < kNumberOfFPRegisters); | |
| 446 return fpregisters_[code].Get<T>(size_in_bytes); | |
| 447 } | |
| 448 | |
| 449 // Like fpreg(), but infer the access size from the template type. | |
| 450 template<typename T> | 402 template<typename T> |
| 451 T fpreg(unsigned code) const { | 403 T fpreg(unsigned code) const { |
| 452 return fpreg<T>(sizeof(T) * 8, code); | 404 ASSERT(code < kNumberOfRegisters); |
| 405 return fpregisters_[code].Get<T>(); | |
| 453 } | 406 } |
| 454 | 407 |
| 455 // Common specialized accessors for the fpreg() template. | 408 // Common specialized accessors for the fpreg() template. |
| 456 float sreg(unsigned code) const { | 409 float sreg(unsigned code) const { |
| 457 return fpreg<float>(code); | 410 return fpreg<float>(code); |
| 458 } | 411 } |
| 459 | 412 |
| 460 uint32_t sreg_bits(unsigned code) const { | 413 uint32_t sreg_bits(unsigned code) const { |
| 461 return fpreg<uint32_t>(code); | 414 return fpreg<uint32_t>(code); |
| 462 } | 415 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 478 return 0.0; | 431 return 0.0; |
| 479 } | 432 } |
| 480 } | 433 } |
| 481 | 434 |
| 482 // Write 'value' into a floating-point register. The value is zero-extended. | 435 // Write 'value' into a floating-point register. The value is zero-extended. |
| 483 // This behaviour matches AArch64 register writes. | 436 // This behaviour matches AArch64 register writes. |
| 484 template<typename T> | 437 template<typename T> |
| 485 void set_fpreg(unsigned code, T value) { | 438 void set_fpreg(unsigned code, T value) { |
| 486 ASSERT((sizeof(value) == kDRegSize) || (sizeof(value) == kSRegSize)); | 439 ASSERT((sizeof(value) == kDRegSize) || (sizeof(value) == kSRegSize)); |
| 487 ASSERT(code < kNumberOfFPRegisters); | 440 ASSERT(code < kNumberOfFPRegisters); |
| 488 fpregisters_[code].Set(value, sizeof(value)); | 441 fpregisters_[code].Set(value); |
| 489 } | 442 } |
| 490 | 443 |
| 491 // Common specialized accessors for the set_fpreg() template. | 444 // Common specialized accessors for the set_fpreg() template. |
| 492 void set_sreg(unsigned code, float value) { | 445 void set_sreg(unsigned code, float value) { |
| 493 set_fpreg(code, value); | 446 set_fpreg(code, value); |
| 494 } | 447 } |
| 495 | 448 |
| 496 void set_sreg_bits(unsigned code, uint32_t value) { | 449 void set_sreg_bits(unsigned code, uint32_t value) { |
| 497 set_fpreg(code, value); | 450 set_fpreg(code, value); |
| 498 } | 451 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 618 default: | 571 default: |
| 619 UNREACHABLE(); | 572 UNREACHABLE(); |
| 620 return false; | 573 return false; |
| 621 } | 574 } |
| 622 } | 575 } |
| 623 | 576 |
| 624 bool ConditionFailed(Condition cond) { | 577 bool ConditionFailed(Condition cond) { |
| 625 return !ConditionPassed(cond); | 578 return !ConditionPassed(cond); |
| 626 } | 579 } |
| 627 | 580 |
| 628 void AddSubHelper(Instruction* instr, int64_t op2); | 581 template<typename T> |
| 629 int64_t AddWithCarry(unsigned reg_size, | 582 void AddSubHelper(Instruction* instr, T op2); |
| 630 bool set_flags, | 583 template<typename T> |
| 631 int64_t src1, | 584 T AddWithCarry(bool set_flags, |
| 632 int64_t src2, | 585 T src1, |
| 633 int64_t carry_in = 0); | 586 T src2, |
| 634 void LogicalHelper(Instruction* instr, int64_t op2); | 587 T carry_in = 0); |
| 635 void ConditionalCompareHelper(Instruction* instr, int64_t op2); | 588 template<typename T> |
| 589 void AddSubWithCarry(Instruction* instr); | |
| 590 template<typename T> | |
| 591 void LogicalHelper(Instruction* instr, T op2); | |
| 592 template<typename T> | |
| 593 void ConditionalCompareHelper(Instruction* instr, T op2); | |
| 636 void LoadStoreHelper(Instruction* instr, | 594 void LoadStoreHelper(Instruction* instr, |
| 637 int64_t offset, | 595 int64_t offset, |
| 638 AddrMode addrmode); | 596 AddrMode addrmode); |
| 639 void LoadStorePairHelper(Instruction* instr, AddrMode addrmode); | 597 void LoadStorePairHelper(Instruction* instr, AddrMode addrmode); |
| 640 uint8_t* LoadStoreAddress(unsigned addr_reg, | 598 uint8_t* LoadStoreAddress(unsigned addr_reg, |
| 641 int64_t offset, | 599 int64_t offset, |
| 642 AddrMode addrmode); | 600 AddrMode addrmode); |
| 643 void LoadStoreWriteBack(unsigned addr_reg, | 601 void LoadStoreWriteBack(unsigned addr_reg, |
| 644 int64_t offset, | 602 int64_t offset, |
| 645 AddrMode addrmode); | 603 AddrMode addrmode); |
| 646 void CheckMemoryAccess(uint8_t* address, uint8_t* stack); | 604 void CheckMemoryAccess(uint8_t* address, uint8_t* stack); |
| 647 | 605 |
| 648 uint64_t MemoryRead(uint8_t* address, unsigned num_bytes); | 606 uint64_t MemoryRead(uint8_t* address, unsigned num_bytes); |
| 649 uint8_t MemoryRead8(uint8_t* address); | 607 uint8_t MemoryRead8(uint8_t* address); |
| 650 uint16_t MemoryRead16(uint8_t* address); | 608 uint16_t MemoryRead16(uint8_t* address); |
| 651 uint32_t MemoryRead32(uint8_t* address); | 609 uint32_t MemoryRead32(uint8_t* address); |
| 652 float MemoryReadFP32(uint8_t* address); | 610 float MemoryReadFP32(uint8_t* address); |
| 653 uint64_t MemoryRead64(uint8_t* address); | 611 uint64_t MemoryRead64(uint8_t* address); |
| 654 double MemoryReadFP64(uint8_t* address); | 612 double MemoryReadFP64(uint8_t* address); |
| 655 | 613 |
| 656 void MemoryWrite(uint8_t* address, uint64_t value, unsigned num_bytes); | 614 void MemoryWrite(uint8_t* address, uint64_t value, unsigned num_bytes); |
| 657 void MemoryWrite32(uint8_t* address, uint32_t value); | 615 void MemoryWrite32(uint8_t* address, uint32_t value); |
| 658 void MemoryWriteFP32(uint8_t* address, float value); | 616 void MemoryWriteFP32(uint8_t* address, float value); |
| 659 void MemoryWrite64(uint8_t* address, uint64_t value); | 617 void MemoryWrite64(uint8_t* address, uint64_t value); |
| 660 void MemoryWriteFP64(uint8_t* address, double value); | 618 void MemoryWriteFP64(uint8_t* address, double value); |
| 661 | 619 |
| 662 int64_t ShiftOperand(unsigned reg_size, | 620 |
| 663 int64_t value, | 621 template <typename T> |
| 664 Shift shift_type, | 622 T ShiftOperand(T value, |
| 665 unsigned amount); | |
| 666 int64_t Rotate(unsigned reg_width, | |
| 667 int64_t value, | |
| 668 Shift shift_type, | 623 Shift shift_type, |
| 669 unsigned amount); | 624 unsigned amount); |
| 670 int64_t ExtendValue(unsigned reg_width, | 625 template <typename T> |
| 671 int64_t value, | 626 T ExtendValue(T value, |
| 672 Extend extend_type, | 627 Extend extend_type, |
| 673 unsigned left_shift = 0); | 628 unsigned left_shift = 0); |
| 629 template <typename T> | |
| 630 void Extract(Instruction* instr); | |
| 631 template <typename T> | |
| 632 void DataProcessing2Source(Instruction* instr); | |
| 633 template <typename T> | |
| 634 void BitfieldHelper(Instruction* instr); | |
| 674 | 635 |
| 675 uint64_t ReverseBits(uint64_t value, unsigned num_bits); | 636 uint64_t ReverseBits(uint64_t value, unsigned num_bits); |
| 676 uint64_t ReverseBytes(uint64_t value, ReverseByteMode mode); | 637 uint64_t ReverseBytes(uint64_t value, ReverseByteMode mode); |
| 677 | 638 |
| 678 template <typename T> | 639 template <typename T> |
| 679 T FPDefaultNaN() const; | 640 T FPDefaultNaN() const; |
| 680 | 641 |
| 681 void FPCompare(double val0, double val1); | 642 void FPCompare(double val0, double val1); |
| 682 double FPRoundInt(double value, FPRounding round_mode); | 643 double FPRoundInt(double value, FPRounding round_mode); |
| 683 double FPToDouble(float value); | 644 double FPToDouble(float value); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 789 // functions, or to save and restore it when entering and leaving generated | 750 // functions, or to save and restore it when entering and leaving generated |
| 790 // code. | 751 // code. |
| 791 void AssertSupportedFPCR() { | 752 void AssertSupportedFPCR() { |
| 792 ASSERT(fpcr().FZ() == 0); // No flush-to-zero support. | 753 ASSERT(fpcr().FZ() == 0); // No flush-to-zero support. |
| 793 ASSERT(fpcr().RMode() == FPTieEven); // Ties-to-even rounding only. | 754 ASSERT(fpcr().RMode() == FPTieEven); // Ties-to-even rounding only. |
| 794 | 755 |
| 795 // The simulator does not support half-precision operations so fpcr().AHP() | 756 // The simulator does not support half-precision operations so fpcr().AHP() |
| 796 // is irrelevant, and is not checked here. | 757 // is irrelevant, and is not checked here. |
| 797 } | 758 } |
| 798 | 759 |
| 799 static int CalcNFlag(uint64_t result, unsigned reg_size) { | 760 template <typename T> |
| 800 return (result >> (reg_size - 1)) & 1; | 761 static int CalcNFlag(T result) { |
| 762 return (result >> (sizeof(T) * 8 - 1)) & 1; | |
| 801 } | 763 } |
| 802 | 764 |
| 803 static int CalcZFlag(uint64_t result) { | 765 static int CalcZFlag(uint64_t result) { |
| 804 return result == 0; | 766 return result == 0; |
| 805 } | 767 } |
| 806 | 768 |
| 807 static const uint32_t kConditionFlagsMask = 0xf0000000; | 769 static const uint32_t kConditionFlagsMask = 0xf0000000; |
| 808 | 770 |
| 809 // Stack | 771 // Stack |
| 810 byte* stack_; | 772 byte* stack_; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 873 static void UnregisterCTryCatch() { | 835 static void UnregisterCTryCatch() { |
| 874 Simulator::current(Isolate::Current())->PopAddress(); | 836 Simulator::current(Isolate::Current())->PopAddress(); |
| 875 } | 837 } |
| 876 }; | 838 }; |
| 877 | 839 |
| 878 #endif // !defined(USE_SIMULATOR) | 840 #endif // !defined(USE_SIMULATOR) |
| 879 | 841 |
| 880 } } // namespace v8::internal | 842 } } // namespace v8::internal |
| 881 | 843 |
| 882 #endif // V8_ARM64_SIMULATOR_ARM64_H_ | 844 #endif // V8_ARM64_SIMULATOR_ARM64_H_ |
| OLD | NEW |