| 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 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2143 class PatchingAssembler : public Assembler { | 2143 class PatchingAssembler : public Assembler { |
| 2144 public: | 2144 public: |
| 2145 // Create an Assembler with a buffer starting at 'start'. | 2145 // Create an Assembler with a buffer starting at 'start'. |
| 2146 // The buffer size is | 2146 // The buffer size is |
| 2147 // size of instructions to patch + kGap | 2147 // size of instructions to patch + kGap |
| 2148 // Where kGap is the distance from which the Assembler tries to grow the | 2148 // Where kGap is the distance from which the Assembler tries to grow the |
| 2149 // buffer. | 2149 // buffer. |
| 2150 // If more or fewer instructions than expected are generated or if some | 2150 // If more or fewer instructions than expected are generated or if some |
| 2151 // relocation information takes space in the buffer, the PatchingAssembler | 2151 // relocation information takes space in the buffer, the PatchingAssembler |
| 2152 // will crash trying to grow the buffer. | 2152 // will crash trying to grow the buffer. |
| 2153 PatchingAssembler(Instruction* start, unsigned count) | 2153 PatchingAssembler(Isolate* isolate, Instruction* start, unsigned count) |
| 2154 : Assembler(NULL, | 2154 : Assembler(isolate, reinterpret_cast<byte*>(start), |
| 2155 reinterpret_cast<byte*>(start), | 2155 count * kInstructionSize + kGap) { |
| 2156 count * kInstructionSize + kGap) { | |
| 2157 StartBlockPools(); | 2156 StartBlockPools(); |
| 2158 } | 2157 } |
| 2159 | 2158 |
| 2160 PatchingAssembler(byte* start, unsigned count) | 2159 PatchingAssembler(Isolate* isolate, byte* start, unsigned count) |
| 2161 : Assembler(NULL, start, count * kInstructionSize + kGap) { | 2160 : Assembler(isolate, start, count * kInstructionSize + kGap) { |
| 2162 // Block constant pool emission. | 2161 // Block constant pool emission. |
| 2163 StartBlockPools(); | 2162 StartBlockPools(); |
| 2164 } | 2163 } |
| 2165 | 2164 |
| 2166 ~PatchingAssembler() { | 2165 ~PatchingAssembler() { |
| 2167 // Const pool should still be blocked. | 2166 // Const pool should still be blocked. |
| 2168 DCHECK(is_const_pool_blocked()); | 2167 DCHECK(is_const_pool_blocked()); |
| 2169 EndBlockPools(); | 2168 EndBlockPools(); |
| 2170 // Verify we have generated the number of instruction we expected. | 2169 // Verify we have generated the number of instruction we expected. |
| 2171 DCHECK((pc_offset() + kGap) == buffer_size_); | 2170 DCHECK((pc_offset() + kGap) == buffer_size_); |
| 2172 // Verify no relocation information has been emitted. | 2171 // Verify no relocation information has been emitted. |
| 2173 DCHECK(IsConstPoolEmpty()); | 2172 DCHECK(IsConstPoolEmpty()); |
| 2174 // Flush the Instruction cache. | 2173 // Flush the Instruction cache. |
| 2175 size_t length = buffer_size_ - kGap; | 2174 size_t length = buffer_size_ - kGap; |
| 2176 Assembler::FlushICacheWithoutIsolate(buffer_, length); | 2175 Assembler::FlushICache(isolate(), buffer_, length); |
| 2177 } | 2176 } |
| 2178 | 2177 |
| 2179 // See definition of PatchAdrFar() for details. | 2178 // See definition of PatchAdrFar() for details. |
| 2180 static const int kAdrFarPatchableNNops = 2; | 2179 static const int kAdrFarPatchableNNops = 2; |
| 2181 static const int kAdrFarPatchableNInstrs = kAdrFarPatchableNNops + 2; | 2180 static const int kAdrFarPatchableNInstrs = kAdrFarPatchableNNops + 2; |
| 2182 void PatchAdrFar(int64_t target_offset); | 2181 void PatchAdrFar(int64_t target_offset); |
| 2183 }; | 2182 }; |
| 2184 | 2183 |
| 2185 | 2184 |
| 2186 class EnsureSpace BASE_EMBEDDED { | 2185 class EnsureSpace BASE_EMBEDDED { |
| 2187 public: | 2186 public: |
| 2188 explicit EnsureSpace(Assembler* assembler) { | 2187 explicit EnsureSpace(Assembler* assembler) { |
| 2189 assembler->CheckBufferSpace(); | 2188 assembler->CheckBufferSpace(); |
| 2190 } | 2189 } |
| 2191 }; | 2190 }; |
| 2192 | 2191 |
| 2193 } // namespace internal | 2192 } // namespace internal |
| 2194 } // namespace v8 | 2193 } // namespace v8 |
| 2195 | 2194 |
| 2196 #endif // V8_ARM64_ASSEMBLER_ARM64_H_ | 2195 #endif // V8_ARM64_ASSEMBLER_ARM64_H_ |
| OLD | NEW |