OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/x64/assembler-x64.h" | 5 #include "src/x64/assembler-x64.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 | 8 |
9 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
10 | 10 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 if (base_code == rbp.code() && ((buf_[0] & 0xC0) == 0)) return false; | 273 if (base_code == rbp.code() && ((buf_[0] & 0xC0) == 0)) return false; |
274 base_code |= ((rex_ & 0x01) << 3); | 274 base_code |= ((rex_ & 0x01) << 3); |
275 return code == base_code; | 275 return code == base_code; |
276 } | 276 } |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 // ----------------------------------------------------------------------------- | 280 // ----------------------------------------------------------------------------- |
281 // Implementation of Assembler. | 281 // Implementation of Assembler. |
282 | 282 |
283 #ifdef GENERATED_CODE_COVERAGE | |
284 static void InitCoverageLog(); | |
285 #endif | |
286 | |
287 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) | 283 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) |
288 : AssemblerBase(isolate, buffer, buffer_size), code_targets_(100) { | 284 : AssemblerBase(isolate, buffer, buffer_size), code_targets_(100) { |
289 // Clear the buffer in debug mode unless it was provided by the | 285 // Clear the buffer in debug mode unless it was provided by the |
290 // caller in which case we can't be sure it's okay to overwrite | 286 // caller in which case we can't be sure it's okay to overwrite |
291 // existing code in it. | 287 // existing code in it. |
292 #ifdef DEBUG | 288 #ifdef DEBUG |
293 if (own_buffer_) { | 289 if (own_buffer_) { |
294 memset(buffer_, 0xCC, buffer_size_); // int3 | 290 memset(buffer_, 0xCC, buffer_size_); // int3 |
295 } | 291 } |
296 #endif | 292 #endif |
297 | 293 |
298 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); | 294 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); |
299 | |
300 | |
301 #ifdef GENERATED_CODE_COVERAGE | |
302 InitCoverageLog(); | |
303 #endif | |
304 } | 295 } |
305 | 296 |
306 | 297 |
307 void Assembler::GetCode(CodeDesc* desc) { | 298 void Assembler::GetCode(CodeDesc* desc) { |
308 // Finalize code (at this point overflow() may be true, but the gap ensures | 299 // Finalize code (at this point overflow() may be true, but the gap ensures |
309 // that we are still not overlapping instructions and relocation info). | 300 // that we are still not overlapping instructions and relocation info). |
310 DCHECK(pc_ <= reloc_info_writer.pos()); // No overlap. | 301 DCHECK(pc_ <= reloc_info_writer.pos()); // No overlap. |
311 // Set up code descriptor. | 302 // Set up code descriptor. |
312 desc->buffer = buffer_; | 303 desc->buffer = buffer_; |
313 desc->buffer_size = buffer_size_; | 304 desc->buffer_size = buffer_size_; |
(...skipping 4301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4615 | 4606 |
4616 bool RelocInfo::IsInConstantPool() { | 4607 bool RelocInfo::IsInConstantPool() { |
4617 return false; | 4608 return false; |
4618 } | 4609 } |
4619 | 4610 |
4620 | 4611 |
4621 } // namespace internal | 4612 } // namespace internal |
4622 } // namespace v8 | 4613 } // namespace v8 |
4623 | 4614 |
4624 #endif // V8_TARGET_ARCH_X64 | 4615 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |