| 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 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 // size of instructions to patch + kGap | 2168 // size of instructions to patch + kGap |
| 2169 // Where kGap is the distance from which the Assembler tries to grow the | 2169 // Where kGap is the distance from which the Assembler tries to grow the |
| 2170 // buffer. | 2170 // buffer. |
| 2171 // If more or fewer instructions than expected are generated or if some | 2171 // If more or fewer instructions than expected are generated or if some |
| 2172 // relocation information takes space in the buffer, the PatchingAssembler | 2172 // relocation information takes space in the buffer, the PatchingAssembler |
| 2173 // will crash trying to grow the buffer. | 2173 // will crash trying to grow the buffer. |
| 2174 PatchingAssembler(Instruction* start, unsigned count) | 2174 PatchingAssembler(Instruction* start, unsigned count) |
| 2175 : Assembler(NULL, | 2175 : Assembler(NULL, |
| 2176 reinterpret_cast<byte*>(start), | 2176 reinterpret_cast<byte*>(start), |
| 2177 count * kInstructionSize + kGap) { | 2177 count * kInstructionSize + kGap) { |
| 2178 // Block constant pool emission. | 2178 StartBlockPools(); |
| 2179 StartBlockConstPool(); | |
| 2180 } | 2179 } |
| 2181 | 2180 |
| 2182 PatchingAssembler(byte* start, unsigned count) | 2181 PatchingAssembler(byte* start, unsigned count) |
| 2183 : Assembler(NULL, start, count * kInstructionSize + kGap) { | 2182 : Assembler(NULL, start, count * kInstructionSize + kGap) { |
| 2184 // Block constant pool emission. | 2183 // Block constant pool emission. |
| 2185 StartBlockConstPool(); | 2184 StartBlockPools(); |
| 2186 } | 2185 } |
| 2187 | 2186 |
| 2188 ~PatchingAssembler() { | 2187 ~PatchingAssembler() { |
| 2189 // Const pool should still be blocked. | 2188 // Const pool should still be blocked. |
| 2190 ASSERT(is_const_pool_blocked()); | 2189 ASSERT(is_const_pool_blocked()); |
| 2191 EndBlockConstPool(); | 2190 EndBlockPools(); |
| 2192 // Verify we have generated the number of instruction we expected. | 2191 // Verify we have generated the number of instruction we expected. |
| 2193 ASSERT((pc_offset() + kGap) == buffer_size_); | 2192 ASSERT((pc_offset() + kGap) == buffer_size_); |
| 2194 // Verify no relocation information has been emitted. | 2193 // Verify no relocation information has been emitted. |
| 2195 ASSERT(num_pending_reloc_info() == 0); | 2194 ASSERT(num_pending_reloc_info() == 0); |
| 2196 // Flush the Instruction cache. | 2195 // Flush the Instruction cache. |
| 2197 size_t length = buffer_size_ - kGap; | 2196 size_t length = buffer_size_ - kGap; |
| 2198 CPU::FlushICache(buffer_, length); | 2197 CPU::FlushICache(buffer_, length); |
| 2199 } | 2198 } |
| 2200 }; | 2199 }; |
| 2201 | 2200 |
| 2202 | 2201 |
| 2203 class EnsureSpace BASE_EMBEDDED { | 2202 class EnsureSpace BASE_EMBEDDED { |
| 2204 public: | 2203 public: |
| 2205 explicit EnsureSpace(Assembler* assembler) { | 2204 explicit EnsureSpace(Assembler* assembler) { |
| 2206 assembler->CheckBuffer(); | 2205 assembler->CheckBuffer(); |
| 2207 } | 2206 } |
| 2208 }; | 2207 }; |
| 2209 | 2208 |
| 2210 } } // namespace v8::internal | 2209 } } // namespace v8::internal |
| 2211 | 2210 |
| 2212 #endif // V8_A64_ASSEMBLER_A64_H_ | 2211 #endif // V8_A64_ASSEMBLER_A64_H_ |
| OLD | NEW |