| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 550 |
| 551 Assembler::Assembler(IsolateData isolate_data, void* buffer, int buffer_size) | 551 Assembler::Assembler(IsolateData isolate_data, void* buffer, int buffer_size) |
| 552 : AssemblerBase(isolate_data, buffer, buffer_size), | 552 : AssemblerBase(isolate_data, buffer, buffer_size), |
| 553 recorded_ast_id_(TypeFeedbackId::None()), | 553 recorded_ast_id_(TypeFeedbackId::None()), |
| 554 pending_32_bit_constants_(), | 554 pending_32_bit_constants_(), |
| 555 pending_64_bit_constants_() { | 555 pending_64_bit_constants_() { |
| 556 pending_32_bit_constants_.reserve(kMinNumPendingConstants); | 556 pending_32_bit_constants_.reserve(kMinNumPendingConstants); |
| 557 pending_64_bit_constants_.reserve(kMinNumPendingConstants); | 557 pending_64_bit_constants_.reserve(kMinNumPendingConstants); |
| 558 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); | 558 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); |
| 559 next_buffer_check_ = 0; | 559 next_buffer_check_ = 0; |
| 560 code_target_sharing_blocked_nesting_ = 0; |
| 560 const_pool_blocked_nesting_ = 0; | 561 const_pool_blocked_nesting_ = 0; |
| 561 no_const_pool_before_ = 0; | 562 no_const_pool_before_ = 0; |
| 562 first_const_pool_32_use_ = -1; | 563 first_const_pool_32_use_ = -1; |
| 563 first_const_pool_64_use_ = -1; | 564 first_const_pool_64_use_ = -1; |
| 564 last_bound_pos_ = 0; | 565 last_bound_pos_ = 0; |
| 565 ClearRecordedAstId(); | 566 ClearRecordedAstId(); |
| 566 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 567 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
| 567 // Register objects tend to be abstracted and survive between scopes, so | 568 // Register objects tend to be abstracted and survive between scopes, so |
| 568 // it's awkward to use CpuFeatures::VFP32DREGS with CpuFeatureScope. To make | 569 // it's awkward to use CpuFeatures::VFP32DREGS with CpuFeatureScope. To make |
| 569 // its use consistent with other features, we always enable it if we can. | 570 // its use consistent with other features, we always enable it if we can. |
| 570 EnableCpuFeature(VFP32DREGS); | 571 EnableCpuFeature(VFP32DREGS); |
| 571 } | 572 } |
| 572 } | 573 } |
| 573 | 574 |
| 574 | 575 |
| 575 Assembler::~Assembler() { | 576 Assembler::~Assembler() { |
| 576 DCHECK(const_pool_blocked_nesting_ == 0); | 577 DCHECK_EQ(const_pool_blocked_nesting_, 0); |
| 578 DCHECK_EQ(code_target_sharing_blocked_nesting_, 0); |
| 577 } | 579 } |
| 578 | 580 |
| 579 void Assembler::GetCode(Isolate* isolate, CodeDesc* desc) { | 581 void Assembler::GetCode(Isolate* isolate, CodeDesc* desc) { |
| 580 // Emit constant pool if necessary. | 582 // Emit constant pool if necessary. |
| 581 int constant_pool_offset = 0; | 583 int constant_pool_offset = 0; |
| 582 CheckConstPool(true, false); | 584 CheckConstPool(true, false); |
| 583 DCHECK(pending_32_bit_constants_.empty()); | 585 DCHECK(pending_32_bit_constants_.empty()); |
| 584 DCHECK(pending_64_bit_constants_.empty()); | 586 DCHECK(pending_64_bit_constants_.empty()); |
| 585 | 587 |
| 586 AllocateRequestedHeapNumbers(isolate); | 588 AllocateRequestedHeapNumbers(isolate); |
| (...skipping 4461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5048 void Assembler::ConstantPoolAddEntry(int position, RelocInfo::Mode rmode, | 5050 void Assembler::ConstantPoolAddEntry(int position, RelocInfo::Mode rmode, |
| 5049 intptr_t value) { | 5051 intptr_t value) { |
| 5050 DCHECK(rmode != RelocInfo::COMMENT && rmode != RelocInfo::CONST_POOL && | 5052 DCHECK(rmode != RelocInfo::COMMENT && rmode != RelocInfo::CONST_POOL && |
| 5051 rmode != RelocInfo::NONE64); | 5053 rmode != RelocInfo::NONE64); |
| 5052 bool sharing_ok = RelocInfo::IsNone(rmode) || | 5054 bool sharing_ok = RelocInfo::IsNone(rmode) || |
| 5053 (rmode >= RelocInfo::FIRST_SHAREABLE_RELOC_MODE); | 5055 (rmode >= RelocInfo::FIRST_SHAREABLE_RELOC_MODE); |
| 5054 DCHECK(pending_32_bit_constants_.size() < kMaxNumPending32Constants); | 5056 DCHECK(pending_32_bit_constants_.size() < kMaxNumPending32Constants); |
| 5055 if (pending_32_bit_constants_.empty()) { | 5057 if (pending_32_bit_constants_.empty()) { |
| 5056 first_const_pool_32_use_ = position; | 5058 first_const_pool_32_use_ = position; |
| 5057 } | 5059 } |
| 5058 ConstantPoolEntry entry( | 5060 ConstantPoolEntry entry(position, value, |
| 5059 position, value, | 5061 sharing_ok || (rmode == RelocInfo::CODE_TARGET && |
| 5060 sharing_ok || (rmode == RelocInfo::CODE_TARGET && serializer_enabled())); | 5062 IsCodeTargetSharingAllowed())); |
| 5061 | 5063 |
| 5062 bool shared = false; | 5064 bool shared = false; |
| 5063 if (sharing_ok) { | 5065 if (sharing_ok) { |
| 5064 // Merge the constant, if possible. | 5066 // Merge the constant, if possible. |
| 5065 for (size_t i = 0; i < pending_32_bit_constants_.size(); i++) { | 5067 for (size_t i = 0; i < pending_32_bit_constants_.size(); i++) { |
| 5066 ConstantPoolEntry& current_entry = pending_32_bit_constants_[i]; | 5068 ConstantPoolEntry& current_entry = pending_32_bit_constants_[i]; |
| 5067 if (!current_entry.sharing_ok()) continue; | 5069 if (!current_entry.sharing_ok()) continue; |
| 5068 if (entry.value() == current_entry.value()) { | 5070 if (entry.value() == current_entry.value()) { |
| 5069 entry.set_merged_index(i); | 5071 entry.set_merged_index(i); |
| 5070 shared = true; | 5072 shared = true; |
| 5071 break; | 5073 break; |
| 5072 } | 5074 } |
| 5073 } | 5075 } |
| 5074 } | 5076 } |
| 5075 | 5077 |
| 5076 if (rmode == RelocInfo::CODE_TARGET && serializer_enabled()) { | 5078 if (rmode == RelocInfo::CODE_TARGET && IsCodeTargetSharingAllowed()) { |
| 5077 // TODO(all): We only do this in the serializer, for now, because | |
| 5078 // full-codegen relies on RelocInfo for translating PCs between full-codegen | |
| 5079 // normal and debug code. | |
| 5080 // Sharing entries here relies on canonicalized handles - without them, we | 5079 // Sharing entries here relies on canonicalized handles - without them, we |
| 5081 // will miss the optimisation opportunity. | 5080 // will miss the optimisation opportunity. |
| 5082 Address handle_address = reinterpret_cast<Address>(value); | 5081 Address handle_address = reinterpret_cast<Address>(value); |
| 5083 auto existing = handle_to_index_map_.find(handle_address); | 5082 auto existing = handle_to_index_map_.find(handle_address); |
| 5084 if (existing != handle_to_index_map_.end()) { | 5083 if (existing != handle_to_index_map_.end()) { |
| 5085 int index = existing->second; | 5084 int index = existing->second; |
| 5086 entry.set_merged_index(index); | 5085 entry.set_merged_index(index); |
| 5087 shared = true; | 5086 shared = true; |
| 5088 } else { | 5087 } else { |
| 5089 // Keep track of this code handle. | 5088 // Keep track of this code handle. |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5369 } | 5368 } |
| 5370 | 5369 |
| 5371 void PatchingAssembler::FlushICache(Isolate* isolate) { | 5370 void PatchingAssembler::FlushICache(Isolate* isolate) { |
| 5372 Assembler::FlushICache(isolate, buffer_, buffer_size_ - kGap); | 5371 Assembler::FlushICache(isolate, buffer_, buffer_size_ - kGap); |
| 5373 } | 5372 } |
| 5374 | 5373 |
| 5375 } // namespace internal | 5374 } // namespace internal |
| 5376 } // namespace v8 | 5375 } // namespace v8 |
| 5377 | 5376 |
| 5378 #endif // V8_TARGET_ARCH_ARM | 5377 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |