| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
| 4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
| 5 // met: | 5 // met: |
| 6 // | 6 // |
| 7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
| 9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
| 10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 return assembler->serializer_enabled(); | 296 return assembler->serializer_enabled(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 return !RelocInfo::IsNone(rmode); | 299 return !RelocInfo::IsNone(rmode); |
| 300 } | 300 } |
| 301 | 301 |
| 302 | 302 |
| 303 // Constant Pool. | 303 // Constant Pool. |
| 304 void ConstPool::RecordEntry(intptr_t data, | 304 void ConstPool::RecordEntry(intptr_t data, |
| 305 RelocInfo::Mode mode) { | 305 RelocInfo::Mode mode) { |
| 306 DCHECK(mode != RelocInfo::COMMENT && mode != RelocInfo::POSITION && | 306 DCHECK(mode != RelocInfo::COMMENT && mode != RelocInfo::CONST_POOL && |
| 307 mode != RelocInfo::STATEMENT_POSITION && | 307 mode != RelocInfo::VENEER_POOL && |
| 308 mode != RelocInfo::CONST_POOL && mode != RelocInfo::VENEER_POOL && | |
| 309 mode != RelocInfo::CODE_AGE_SEQUENCE && | 308 mode != RelocInfo::CODE_AGE_SEQUENCE && |
| 310 mode != RelocInfo::DEOPT_REASON && mode != RelocInfo::DEOPT_ID); | 309 mode != RelocInfo::DEOPT_POSITION && mode != RelocInfo::DEOPT_REASON && |
| 310 mode != RelocInfo::DEOPT_ID); |
| 311 uint64_t raw_data = static_cast<uint64_t>(data); | 311 uint64_t raw_data = static_cast<uint64_t>(data); |
| 312 int offset = assm_->pc_offset(); | 312 int offset = assm_->pc_offset(); |
| 313 if (IsEmpty()) { | 313 if (IsEmpty()) { |
| 314 first_use_ = offset; | 314 first_use_ = offset; |
| 315 } | 315 } |
| 316 | 316 |
| 317 std::pair<uint64_t, int> entry = std::make_pair(raw_data, offset); | 317 std::pair<uint64_t, int> entry = std::make_pair(raw_data, offset); |
| 318 if (CanBeShared(mode)) { | 318 if (CanBeShared(mode)) { |
| 319 shared_entries_.insert(entry); | 319 shared_entries_.insert(entry); |
| 320 if (shared_entries_.count(entry.first) == 1) { | 320 if (shared_entries_.count(entry.first) == 1) { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 unique_entries_.clear(); | 544 unique_entries_.clear(); |
| 545 first_use_ = -1; | 545 first_use_ = -1; |
| 546 } | 546 } |
| 547 | 547 |
| 548 | 548 |
| 549 // Assembler | 549 // Assembler |
| 550 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) | 550 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) |
| 551 : AssemblerBase(isolate, buffer, buffer_size), | 551 : AssemblerBase(isolate, buffer, buffer_size), |
| 552 constpool_(this), | 552 constpool_(this), |
| 553 recorded_ast_id_(TypeFeedbackId::None()), | 553 recorded_ast_id_(TypeFeedbackId::None()), |
| 554 unresolved_branches_(), | 554 unresolved_branches_() { |
| 555 positions_recorder_(this) { | |
| 556 const_pool_blocked_nesting_ = 0; | 555 const_pool_blocked_nesting_ = 0; |
| 557 veneer_pool_blocked_nesting_ = 0; | 556 veneer_pool_blocked_nesting_ = 0; |
| 558 Reset(); | 557 Reset(); |
| 559 } | 558 } |
| 560 | 559 |
| 561 | 560 |
| 562 Assembler::~Assembler() { | 561 Assembler::~Assembler() { |
| 563 DCHECK(constpool_.IsEmpty()); | 562 DCHECK(constpool_.IsEmpty()); |
| 564 DCHECK(const_pool_blocked_nesting_ == 0); | 563 DCHECK(const_pool_blocked_nesting_ == 0); |
| 565 DCHECK(veneer_pool_blocked_nesting_ == 0); | 564 DCHECK(veneer_pool_blocked_nesting_ == 0); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 579 reinterpret_cast<byte*>(pc_)); | 578 reinterpret_cast<byte*>(pc_)); |
| 580 constpool_.Clear(); | 579 constpool_.Clear(); |
| 581 next_constant_pool_check_ = 0; | 580 next_constant_pool_check_ = 0; |
| 582 next_veneer_pool_check_ = kMaxInt; | 581 next_veneer_pool_check_ = kMaxInt; |
| 583 no_const_pool_before_ = 0; | 582 no_const_pool_before_ = 0; |
| 584 ClearRecordedAstId(); | 583 ClearRecordedAstId(); |
| 585 } | 584 } |
| 586 | 585 |
| 587 | 586 |
| 588 void Assembler::GetCode(CodeDesc* desc) { | 587 void Assembler::GetCode(CodeDesc* desc) { |
| 589 reloc_info_writer.Finish(); | |
| 590 // Emit constant pool if necessary. | 588 // Emit constant pool if necessary. |
| 591 CheckConstPool(true, false); | 589 CheckConstPool(true, false); |
| 592 DCHECK(constpool_.IsEmpty()); | 590 DCHECK(constpool_.IsEmpty()); |
| 593 | 591 |
| 594 // Set up code descriptor. | 592 // Set up code descriptor. |
| 595 if (desc) { | 593 if (desc) { |
| 596 desc->buffer = reinterpret_cast<byte*>(buffer_); | 594 desc->buffer = reinterpret_cast<byte*>(buffer_); |
| 597 desc->buffer_size = buffer_size_; | 595 desc->buffer_size = buffer_size_; |
| 598 desc->instr_size = pc_offset(); | 596 desc->instr_size = pc_offset(); |
| 599 desc->reloc_size = | 597 desc->reloc_size = |
| (...skipping 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2942 } | 2940 } |
| 2943 | 2941 |
| 2944 | 2942 |
| 2945 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { | 2943 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { |
| 2946 // We do not try to reuse pool constants. | 2944 // We do not try to reuse pool constants. |
| 2947 RelocInfo rinfo(isolate(), reinterpret_cast<byte*>(pc_), rmode, data, NULL); | 2945 RelocInfo rinfo(isolate(), reinterpret_cast<byte*>(pc_), rmode, data, NULL); |
| 2948 if (((rmode >= RelocInfo::COMMENT) && | 2946 if (((rmode >= RelocInfo::COMMENT) && |
| 2949 (rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_TAIL_CALL)) || | 2947 (rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_TAIL_CALL)) || |
| 2950 (rmode == RelocInfo::INTERNAL_REFERENCE) || | 2948 (rmode == RelocInfo::INTERNAL_REFERENCE) || |
| 2951 (rmode == RelocInfo::CONST_POOL) || (rmode == RelocInfo::VENEER_POOL) || | 2949 (rmode == RelocInfo::CONST_POOL) || (rmode == RelocInfo::VENEER_POOL) || |
| 2950 (rmode == RelocInfo::DEOPT_POSITION) || |
| 2952 (rmode == RelocInfo::DEOPT_REASON) || (rmode == RelocInfo::DEOPT_ID) || | 2951 (rmode == RelocInfo::DEOPT_REASON) || (rmode == RelocInfo::DEOPT_ID) || |
| 2953 (rmode == RelocInfo::GENERATOR_CONTINUATION)) { | 2952 (rmode == RelocInfo::GENERATOR_CONTINUATION)) { |
| 2954 // Adjust code for new modes. | 2953 // Adjust code for new modes. |
| 2955 DCHECK(RelocInfo::IsDebugBreakSlot(rmode) || RelocInfo::IsComment(rmode) || | 2954 DCHECK(RelocInfo::IsDebugBreakSlot(rmode) || RelocInfo::IsComment(rmode) || |
| 2956 RelocInfo::IsDeoptReason(rmode) || RelocInfo::IsDeoptId(rmode) || | 2955 RelocInfo::IsDeoptReason(rmode) || RelocInfo::IsDeoptId(rmode) || |
| 2957 RelocInfo::IsPosition(rmode) || | 2956 RelocInfo::IsDeoptPosition(rmode) || |
| 2958 RelocInfo::IsInternalReference(rmode) || | 2957 RelocInfo::IsInternalReference(rmode) || |
| 2959 RelocInfo::IsConstPool(rmode) || RelocInfo::IsVeneerPool(rmode) || | 2958 RelocInfo::IsConstPool(rmode) || RelocInfo::IsVeneerPool(rmode) || |
| 2960 RelocInfo::IsGeneratorContinuation(rmode)); | 2959 RelocInfo::IsGeneratorContinuation(rmode)); |
| 2961 // These modes do not need an entry in the constant pool. | 2960 // These modes do not need an entry in the constant pool. |
| 2962 } else { | 2961 } else { |
| 2963 constpool_.RecordEntry(data, rmode); | 2962 constpool_.RecordEntry(data, rmode); |
| 2964 // Make sure the constant pool is not emitted in place of the next | 2963 // Make sure the constant pool is not emitted in place of the next |
| 2965 // instruction for which we just recorded relocation info. | 2964 // instruction for which we just recorded relocation info. |
| 2966 BlockConstPoolFor(1); | 2965 BlockConstPoolFor(1); |
| 2967 } | 2966 } |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3213 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); | 3212 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); |
| 3214 DCHECK((target_offset >> 48) == 0); | 3213 DCHECK((target_offset >> 48) == 0); |
| 3215 add(rd, rd, scratch); | 3214 add(rd, rd, scratch); |
| 3216 } | 3215 } |
| 3217 | 3216 |
| 3218 | 3217 |
| 3219 } // namespace internal | 3218 } // namespace internal |
| 3220 } // namespace v8 | 3219 } // namespace v8 |
| 3221 | 3220 |
| 3222 #endif // V8_TARGET_ARCH_ARM64 | 3221 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |