| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // existing code in it. | 302 // existing code in it. |
| 303 #ifdef DEBUG | 303 #ifdef DEBUG |
| 304 if (own_buffer_) { | 304 if (own_buffer_) { |
| 305 memset(buffer_, 0xCC, buffer_size_); // int3 | 305 memset(buffer_, 0xCC, buffer_size_); // int3 |
| 306 } | 306 } |
| 307 #endif | 307 #endif |
| 308 | 308 |
| 309 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); | 309 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void Assembler::GetCode(Isolate* isolate, CodeDesc* desc) { |
| 313 // At this point overflow() may be true, but the gap ensures |
| 314 // that we are still not overlapping instructions and relocation info. |
| 315 DCHECK(pc_ <= reloc_info_writer.pos()); // No overlap. |
| 312 | 316 |
| 313 void Assembler::GetCode(CodeDesc* desc) { | 317 AllocateRequestedHeapNumbers(isolate); |
| 314 // Finalize code (at this point overflow() may be true, but the gap ensures | 318 |
| 315 // that we are still not overlapping instructions and relocation info). | |
| 316 DCHECK(pc_ <= reloc_info_writer.pos()); // No overlap. | |
| 317 // Set up code descriptor. | 319 // Set up code descriptor. |
| 318 desc->buffer = buffer_; | 320 desc->buffer = buffer_; |
| 319 desc->buffer_size = buffer_size_; | 321 desc->buffer_size = buffer_size_; |
| 320 desc->instr_size = pc_offset(); | 322 desc->instr_size = pc_offset(); |
| 321 DCHECK(desc->instr_size > 0); // Zero-size code objects upset the system. | 323 DCHECK(desc->instr_size > 0); // Zero-size code objects upset the system. |
| 322 desc->reloc_size = | 324 desc->reloc_size = |
| 323 static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos()); | 325 static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos()); |
| 324 desc->origin = this; | 326 desc->origin = this; |
| 325 desc->constant_pool_size = 0; | 327 desc->constant_pool_size = 0; |
| 326 desc->unwinding_info_size = 0; | 328 desc->unwinding_info_size = 0; |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 } | 1533 } |
| 1532 | 1534 |
| 1533 | 1535 |
| 1534 void Assembler::movp(Register dst, void* value, RelocInfo::Mode rmode) { | 1536 void Assembler::movp(Register dst, void* value, RelocInfo::Mode rmode) { |
| 1535 EnsureSpace ensure_space(this); | 1537 EnsureSpace ensure_space(this); |
| 1536 emit_rex(dst, kPointerSize); | 1538 emit_rex(dst, kPointerSize); |
| 1537 emit(0xB8 | dst.low_bits()); | 1539 emit(0xB8 | dst.low_bits()); |
| 1538 emitp(value, rmode); | 1540 emitp(value, rmode); |
| 1539 } | 1541 } |
| 1540 | 1542 |
| 1543 void Assembler::movp_heap_number(Register dst, double value) { |
| 1544 EnsureSpace ensure_space(this); |
| 1545 emit_rex(dst, kPointerSize); |
| 1546 emit(0xB8 | dst.low_bits()); |
| 1547 RequestHeapNumber(value); |
| 1548 emitp(nullptr, RelocInfo::EMBEDDED_OBJECT); |
| 1549 } |
| 1550 |
| 1541 void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { | 1551 void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { |
| 1542 EnsureSpace ensure_space(this); | 1552 EnsureSpace ensure_space(this); |
| 1543 emit_rex_64(dst); | 1553 emit_rex_64(dst); |
| 1544 emit(0xB8 | dst.low_bits()); | 1554 emit(0xB8 | dst.low_bits()); |
| 1545 if (!RelocInfo::IsNone(rmode)) { | 1555 if (!RelocInfo::IsNone(rmode)) { |
| 1546 RecordRelocInfo(rmode, value); | 1556 RecordRelocInfo(rmode, value); |
| 1547 } | 1557 } |
| 1548 emitq(value); | 1558 emitq(value); |
| 1549 } | 1559 } |
| 1550 | 1560 |
| (...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4785 | 4795 |
| 4786 bool RelocInfo::IsInConstantPool() { | 4796 bool RelocInfo::IsInConstantPool() { |
| 4787 return false; | 4797 return false; |
| 4788 } | 4798 } |
| 4789 | 4799 |
| 4790 | 4800 |
| 4791 } // namespace internal | 4801 } // namespace internal |
| 4792 } // namespace v8 | 4802 } // namespace v8 |
| 4793 | 4803 |
| 4794 #endif // V8_TARGET_ARCH_X64 | 4804 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |