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_ASSEMBLER_ARM64_H_ | 5 #ifndef V8_ARM64_ASSEMBLER_ARM64_H_ |
6 #define V8_ARM64_ASSEMBLER_ARM64_H_ | 6 #define V8_ARM64_ASSEMBLER_ARM64_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 Shift shift = LSL, | 543 Shift shift = LSL, |
544 unsigned shift_amount = 0); // NOLINT(runtime/explicit) | 544 unsigned shift_amount = 0); // NOLINT(runtime/explicit) |
545 | 545 |
546 // rm, <extend> {#<shift_amount>} | 546 // rm, <extend> {#<shift_amount>} |
547 // where <extend> is one of {UXTB, UXTH, UXTW, UXTX, SXTB, SXTH, SXTW, SXTX}. | 547 // where <extend> is one of {UXTB, UXTH, UXTW, UXTX, SXTB, SXTH, SXTW, SXTX}. |
548 // <shift_amount> is uint2_t. | 548 // <shift_amount> is uint2_t. |
549 inline Operand(Register reg, | 549 inline Operand(Register reg, |
550 Extend extend, | 550 Extend extend, |
551 unsigned shift_amount = 0); | 551 unsigned shift_amount = 0); |
552 | 552 |
| 553 static Operand EmbeddedNumber(double value); // Smi or HeapNumber. |
| 554 |
| 555 bool is_heap_number() const { |
| 556 DCHECK_IMPLIES(is_heap_number_, reg_.Is(NoReg)); |
| 557 DCHECK_IMPLIES(is_heap_number_, |
| 558 immediate_.rmode() == RelocInfo::EMBEDDED_OBJECT); |
| 559 return is_heap_number_; |
| 560 } |
| 561 |
| 562 double heap_number() const { |
| 563 DCHECK(is_heap_number()); |
| 564 return bit_cast<double>(immediate_.value()); |
| 565 } |
| 566 |
553 template<typename T> | 567 template<typename T> |
554 inline explicit Operand(Handle<T> handle); | 568 inline explicit Operand(Handle<T> handle); |
555 | 569 |
556 // Implicit constructor for all int types, ExternalReference, and Smi. | 570 // Implicit constructor for all int types, ExternalReference, and Smi. |
557 template<typename T> | 571 template<typename T> |
558 inline Operand(T t); // NOLINT(runtime/explicit) | 572 inline Operand(T t); // NOLINT(runtime/explicit) |
559 | 573 |
560 // Implicit constructor for int types. | 574 // Implicit constructor for int types. |
561 template<typename T> | 575 template<typename T> |
562 inline Operand(T t, RelocInfo::Mode rmode); | 576 inline Operand(T t, RelocInfo::Mode rmode); |
(...skipping 20 matching lines...) Expand all Loading... |
583 // Helpers | 597 // Helpers |
584 inline static Operand UntagSmi(Register smi); | 598 inline static Operand UntagSmi(Register smi); |
585 inline static Operand UntagSmiAndScale(Register smi, int scale); | 599 inline static Operand UntagSmiAndScale(Register smi, int scale); |
586 | 600 |
587 private: | 601 private: |
588 Immediate immediate_; | 602 Immediate immediate_; |
589 Register reg_; | 603 Register reg_; |
590 Shift shift_; | 604 Shift shift_; |
591 Extend extend_; | 605 Extend extend_; |
592 unsigned shift_amount_; | 606 unsigned shift_amount_; |
| 607 bool is_heap_number_ = false; |
593 }; | 608 }; |
594 | 609 |
595 | 610 |
596 // MemOperand represents a memory operand in a load or store instruction. | 611 // MemOperand represents a memory operand in a load or store instruction. |
597 class MemOperand { | 612 class MemOperand { |
598 public: | 613 public: |
599 inline MemOperand(); | 614 inline MemOperand(); |
600 inline explicit MemOperand(Register base, | 615 inline explicit MemOperand(Register base, |
601 int64_t offset = 0, | 616 int64_t offset = 0, |
602 AddrMode addrmode = Offset); | 617 AddrMode addrmode = Offset); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 // In order to avoid any accidental transfer of state, Reset DCHECKs that the | 748 // In order to avoid any accidental transfer of state, Reset DCHECKs that the |
734 // constant pool is not blocked. | 749 // constant pool is not blocked. |
735 void Reset(); | 750 void Reset(); |
736 | 751 |
737 // GetCode emits any pending (non-emitted) code and fills the descriptor | 752 // GetCode emits any pending (non-emitted) code and fills the descriptor |
738 // desc. GetCode() is idempotent; it returns the same result if no other | 753 // desc. GetCode() is idempotent; it returns the same result if no other |
739 // Assembler functions are invoked in between GetCode() calls. | 754 // Assembler functions are invoked in between GetCode() calls. |
740 // | 755 // |
741 // The descriptor (desc) can be NULL. In that case, the code is finalized as | 756 // The descriptor (desc) can be NULL. In that case, the code is finalized as |
742 // usual, but the descriptor is not populated. | 757 // usual, but the descriptor is not populated. |
743 void GetCode(CodeDesc* desc); | 758 void GetCode(Isolate* isolate, CodeDesc* desc); |
744 | 759 |
745 // Insert the smallest number of nop instructions | 760 // Insert the smallest number of nop instructions |
746 // possible to align the pc offset to a multiple | 761 // possible to align the pc offset to a multiple |
747 // of m. m must be a power of 2 (>= 4). | 762 // of m. m must be a power of 2 (>= 4). |
748 void Align(int m); | 763 void Align(int m); |
749 // Insert the smallest number of zero bytes possible to align the pc offset | 764 // Insert the smallest number of zero bytes possible to align the pc offset |
750 // to a mulitple of m. m must be a power of 2 (>= 2). | 765 // to a mulitple of m. m must be a power of 2 (>= 2). |
751 void DataAlign(int m); | 766 void DataAlign(int m); |
752 | 767 |
753 inline void Unreachable(); | 768 inline void Unreachable(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 // and cause the version of the code with debugger support to have pools | 932 // and cause the version of the code with debugger support to have pools |
918 // generated in different places. | 933 // generated in different places. |
919 // Recording the position and size of emitted pools allows to correctly | 934 // Recording the position and size of emitted pools allows to correctly |
920 // compute the offset mappings between the different versions of a function in | 935 // compute the offset mappings between the different versions of a function in |
921 // all situations. | 936 // all situations. |
922 // | 937 // |
923 // The parameter indicates the size of the pool (in bytes), including | 938 // The parameter indicates the size of the pool (in bytes), including |
924 // the marker and branch over the data. | 939 // the marker and branch over the data. |
925 void RecordConstPool(int size); | 940 void RecordConstPool(int size); |
926 | 941 |
| 942 // Patch the dummy heap number that we emitted during code assembly in the |
| 943 // constant pool entry referenced by {pc}. Replace it with the actual heap |
| 944 // object (handle). |
| 945 static void set_heap_number(Handle<HeapObject> number, Address pc); |
927 | 946 |
928 // Instruction set functions ------------------------------------------------ | 947 // Instruction set functions ------------------------------------------------ |
929 | 948 |
930 // Branch / Jump instructions. | 949 // Branch / Jump instructions. |
931 // For branches offsets are scaled, i.e. they in instrcutions not in bytes. | 950 // For branches offsets are scaled, i.e. they in instrcutions not in bytes. |
932 // Branch to register. | 951 // Branch to register. |
933 void br(const Register& xn); | 952 void br(const Register& xn); |
934 | 953 |
935 // Branch-link to register. | 954 // Branch-link to register. |
936 void blr(const Register& xn); | 955 void blr(const Register& xn); |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 const MemOperand& dst); | 1372 const MemOperand& dst); |
1354 | 1373 |
1355 // Load word pair with sign extension. | 1374 // Load word pair with sign extension. |
1356 void ldpsw(const Register& rt, const Register& rt2, const MemOperand& src); | 1375 void ldpsw(const Register& rt, const Register& rt2, const MemOperand& src); |
1357 | 1376 |
1358 // Load literal to register from a pc relative address. | 1377 // Load literal to register from a pc relative address. |
1359 void ldr_pcrel(const CPURegister& rt, int imm19); | 1378 void ldr_pcrel(const CPURegister& rt, int imm19); |
1360 | 1379 |
1361 // Load literal to register. | 1380 // Load literal to register. |
1362 void ldr(const CPURegister& rt, const Immediate& imm); | 1381 void ldr(const CPURegister& rt, const Immediate& imm); |
| 1382 void ldr(const CPURegister& rt, const Operand& operand); |
1363 | 1383 |
1364 // Load-acquire word. | 1384 // Load-acquire word. |
1365 void ldar(const Register& rt, const Register& rn); | 1385 void ldar(const Register& rt, const Register& rn); |
1366 | 1386 |
1367 // Load-acquire exclusive word. | 1387 // Load-acquire exclusive word. |
1368 void ldaxr(const Register& rt, const Register& rn); | 1388 void ldaxr(const Register& rt, const Register& rn); |
1369 | 1389 |
1370 // Store-release word. | 1390 // Store-release word. |
1371 void stlr(const Register& rt, const Register& rn); | 1391 void stlr(const Register& rt, const Register& rn); |
1372 | 1392 |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2205 public: | 2225 public: |
2206 explicit EnsureSpace(Assembler* assembler) { | 2226 explicit EnsureSpace(Assembler* assembler) { |
2207 assembler->CheckBufferSpace(); | 2227 assembler->CheckBufferSpace(); |
2208 } | 2228 } |
2209 }; | 2229 }; |
2210 | 2230 |
2211 } // namespace internal | 2231 } // namespace internal |
2212 } // namespace v8 | 2232 } // namespace v8 |
2213 | 2233 |
2214 #endif // V8_ARM64_ASSEMBLER_ARM64_H_ | 2234 #endif // V8_ARM64_ASSEMBLER_ARM64_H_ |
OLD | NEW |