OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 void db(uint8_t data) { dc8(data); } | 1687 void db(uint8_t data) { dc8(data); } |
1688 | 1688 |
1689 // Code generation helpers -------------------------------------------------- | 1689 // Code generation helpers -------------------------------------------------- |
1690 | 1690 |
1691 unsigned num_pending_reloc_info() const { return num_pending_reloc_info_; } | 1691 unsigned num_pending_reloc_info() const { return num_pending_reloc_info_; } |
1692 | 1692 |
1693 Instruction* InstructionAt(int offset) const { | 1693 Instruction* InstructionAt(int offset) const { |
1694 return reinterpret_cast<Instruction*>(buffer_ + offset); | 1694 return reinterpret_cast<Instruction*>(buffer_ + offset); |
1695 } | 1695 } |
1696 | 1696 |
| 1697 ptrdiff_t InstructionOffset(Instruction* instr) const { |
| 1698 return reinterpret_cast<byte*>(instr) - buffer_; |
| 1699 } |
| 1700 |
1697 // Register encoding. | 1701 // Register encoding. |
1698 static Instr Rd(CPURegister rd) { | 1702 static Instr Rd(CPURegister rd) { |
1699 ASSERT(rd.code() != kSPRegInternalCode); | 1703 ASSERT(rd.code() != kSPRegInternalCode); |
1700 return rd.code() << Rd_offset; | 1704 return rd.code() << Rd_offset; |
1701 } | 1705 } |
1702 | 1706 |
1703 static Instr Rn(CPURegister rn) { | 1707 static Instr Rn(CPURegister rn) { |
1704 ASSERT(rn.code() != kSPRegInternalCode); | 1708 ASSERT(rn.code() != kSPRegInternalCode); |
1705 return rn.code() << Rn_offset; | 1709 return rn.code() << Rn_offset; |
1706 } | 1710 } |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 // It is maintained to the closest unresolved branch limit minus the maximum | 2179 // It is maintained to the closest unresolved branch limit minus the maximum |
2176 // veneer margin (or kMaxInt if there are no unresolved branches). | 2180 // veneer margin (or kMaxInt if there are no unresolved branches). |
2177 int next_veneer_pool_check_; | 2181 int next_veneer_pool_check_; |
2178 | 2182 |
2179 private: | 2183 private: |
2180 // If a veneer is emitted for a branch instruction, that instruction must be | 2184 // If a veneer is emitted for a branch instruction, that instruction must be |
2181 // removed from the associated label's link chain so that the assembler does | 2185 // removed from the associated label's link chain so that the assembler does |
2182 // not later attempt (likely unsuccessfully) to patch it to branch directly to | 2186 // not later attempt (likely unsuccessfully) to patch it to branch directly to |
2183 // the label. | 2187 // the label. |
2184 void DeleteUnresolvedBranchInfoForLabel(Label* label); | 2188 void DeleteUnresolvedBranchInfoForLabel(Label* label); |
| 2189 // This function deletes the information related to the label by iterating |
| 2190 // through all unresolved branch infos and deleting the appropriating one. Its |
| 2191 // complexity is proportional to the number of unresolved branches pending. |
| 2192 void DeleteUnresolvedBranchInfoForLabelIterate(Label* label); |
| 2193 // This function deletes the information related to the label by traversing |
| 2194 // the label chain, and for each PC-relative instruction in the chain checking |
| 2195 // if pending unresolved information exists. Its complexity is proportional to |
| 2196 // the length of the label chain. |
| 2197 void DeleteUnresolvedBranchInfoForLabelTraverse(Label* label); |
2185 | 2198 |
2186 private: | 2199 private: |
2187 PositionsRecorder positions_recorder_; | 2200 PositionsRecorder positions_recorder_; |
2188 friend class PositionsRecorder; | 2201 friend class PositionsRecorder; |
2189 friend class EnsureSpace; | 2202 friend class EnsureSpace; |
2190 }; | 2203 }; |
2191 | 2204 |
2192 class PatchingAssembler : public Assembler { | 2205 class PatchingAssembler : public Assembler { |
2193 public: | 2206 public: |
2194 // Create an Assembler with a buffer starting at 'start'. | 2207 // Create an Assembler with a buffer starting at 'start'. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2238 class EnsureSpace BASE_EMBEDDED { | 2251 class EnsureSpace BASE_EMBEDDED { |
2239 public: | 2252 public: |
2240 explicit EnsureSpace(Assembler* assembler) { | 2253 explicit EnsureSpace(Assembler* assembler) { |
2241 assembler->CheckBuffer(); | 2254 assembler->CheckBuffer(); |
2242 } | 2255 } |
2243 }; | 2256 }; |
2244 | 2257 |
2245 } } // namespace v8::internal | 2258 } } // namespace v8::internal |
2246 | 2259 |
2247 #endif // V8_ARM64_ASSEMBLER_ARM64_H_ | 2260 #endif // V8_ARM64_ASSEMBLER_ARM64_H_ |
OLD | NEW |