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 3536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3547 } else if (IsCodePtrEntry(rmode)) { | 3547 } else if (IsCodePtrEntry(rmode)) { |
3548 count_of_code_ptr_++; | 3548 count_of_code_ptr_++; |
3549 } else { | 3549 } else { |
3550 ASSERT(IsHeapPtrEntry(rmode)); | 3550 ASSERT(IsHeapPtrEntry(rmode)); |
3551 count_of_heap_ptr_++; | 3551 count_of_heap_ptr_++; |
3552 } | 3552 } |
3553 } | 3553 } |
3554 | 3554 |
3555 // Check if we still have room for another entry given Arm's ldr and vldr | 3555 // Check if we still have room for another entry given Arm's ldr and vldr |
3556 // immediate offset range. | 3556 // immediate offset range. |
3557 if (!(is_uint12(ConstantPoolArray::SizeFor(count_of_64bit_, | 3557 // TODO(rmcilroy): Avoid creating a new object here when we support |
3558 count_of_code_ptr_, | 3558 // extended constant pools. |
3559 count_of_heap_ptr_, | 3559 ConstantPoolArray::NumberOfEntries total(count_of_64bit_, |
3560 count_of_32bit_))) && | 3560 count_of_code_ptr_, |
3561 is_uint10(ConstantPoolArray::SizeFor(count_of_64bit_, 0, 0, 0))) { | 3561 count_of_heap_ptr_, |
| 3562 count_of_32bit_); |
| 3563 ConstantPoolArray::NumberOfEntries int64_counts(count_of_64bit_, 0, 0, 0); |
| 3564 if (!(is_uint12(ConstantPoolArray::SizeFor(total)) && |
| 3565 is_uint10(ConstantPoolArray::SizeFor(int64_counts)))) { |
3562 assm->set_constant_pool_full(); | 3566 assm->set_constant_pool_full(); |
3563 } | 3567 } |
3564 } | 3568 } |
3565 | 3569 |
3566 | 3570 |
3567 void ConstantPoolBuilder::Relocate(int pc_delta) { | 3571 void ConstantPoolBuilder::Relocate(int pc_delta) { |
3568 for (std::vector<RelocInfo>::iterator rinfo = entries_.begin(); | 3572 for (std::vector<RelocInfo>::iterator rinfo = entries_.begin(); |
3569 rinfo != entries_.end(); rinfo++) { | 3573 rinfo != entries_.end(); rinfo++) { |
3570 ASSERT(rinfo->rmode() != RelocInfo::JS_RETURN); | 3574 ASSERT(rinfo->rmode() != RelocInfo::JS_RETURN); |
3571 rinfo->set_pc(rinfo->pc() + pc_delta); | 3575 rinfo->set_pc(rinfo->pc() + pc_delta); |
3572 } | 3576 } |
3573 } | 3577 } |
3574 | 3578 |
3575 | 3579 |
3576 Handle<ConstantPoolArray> ConstantPoolBuilder::New(Isolate* isolate) { | 3580 Handle<ConstantPoolArray> ConstantPoolBuilder::New(Isolate* isolate) { |
3577 if (IsEmpty()) { | 3581 if (IsEmpty()) { |
3578 return isolate->factory()->empty_constant_pool_array(); | 3582 return isolate->factory()->empty_constant_pool_array(); |
3579 } else { | 3583 } else { |
3580 return isolate->factory()->NewConstantPoolArray(count_of_64bit_, | 3584 ConstantPoolArray::NumberOfEntries small(count_of_64bit_, |
3581 count_of_code_ptr_, | 3585 count_of_code_ptr_, |
3582 count_of_heap_ptr_, | 3586 count_of_heap_ptr_, |
3583 count_of_32bit_); | 3587 count_of_32bit_); |
| 3588 return isolate->factory()->NewConstantPoolArray(small); |
3584 } | 3589 } |
3585 } | 3590 } |
3586 | 3591 |
3587 | 3592 |
3588 void ConstantPoolBuilder::Populate(Assembler* assm, | 3593 void ConstantPoolBuilder::Populate(Assembler* assm, |
3589 ConstantPoolArray* constant_pool) { | 3594 ConstantPoolArray* constant_pool) { |
3590 ASSERT(constant_pool->count_of_int64_entries() == count_of_64bit_); | 3595 ConstantPoolArray::LayoutSection section = ConstantPoolArray::SMALL_SECTION; |
3591 ASSERT(constant_pool->count_of_code_ptr_entries() == count_of_code_ptr_); | 3596 ASSERT(count_of_64bit_ == |
3592 ASSERT(constant_pool->count_of_heap_ptr_entries() == count_of_heap_ptr_); | 3597 constant_pool->number_of_entries(ConstantPoolArray::INT64, section)); |
3593 ASSERT(constant_pool->count_of_int32_entries() == count_of_32bit_); | 3598 ASSERT(count_of_code_ptr_ == |
| 3599 constant_pool->number_of_entries(ConstantPoolArray::CODE_PTR, section)); |
| 3600 ASSERT(count_of_heap_ptr_ == |
| 3601 constant_pool->number_of_entries(ConstantPoolArray::HEAP_PTR, section)); |
| 3602 ASSERT(count_of_32bit_ == |
| 3603 constant_pool->number_of_entries(ConstantPoolArray::INT32, section)); |
3594 ASSERT(entries_.size() == merged_indexes_.size()); | 3604 ASSERT(entries_.size() == merged_indexes_.size()); |
3595 | 3605 |
3596 int index_64bit = 0; | 3606 int index_64bit = 0; |
3597 int index_code_ptr = count_of_64bit_; | 3607 int index_code_ptr = count_of_64bit_; |
3598 int index_heap_ptr = count_of_64bit_ + count_of_code_ptr_; | 3608 int index_heap_ptr = count_of_64bit_ + count_of_code_ptr_; |
3599 int index_32bit = count_of_64bit_ + count_of_code_ptr_ + count_of_heap_ptr_; | 3609 int index_32bit = count_of_64bit_ + count_of_code_ptr_ + count_of_heap_ptr_; |
3600 | 3610 |
3601 size_t i; | 3611 size_t i; |
3602 std::vector<RelocInfo>::const_iterator rinfo; | 3612 std::vector<RelocInfo>::const_iterator rinfo; |
3603 for (rinfo = entries_.begin(), i = 0; rinfo != entries_.end(); rinfo++, i++) { | 3613 for (rinfo = entries_.begin(), i = 0; rinfo != entries_.end(); rinfo++, i++) { |
3604 RelocInfo::Mode rmode = rinfo->rmode(); | 3614 RelocInfo::Mode rmode = rinfo->rmode(); |
3605 | 3615 |
3606 // Update constant pool if necessary and get the entry's offset. | 3616 // Update constant pool if necessary and get the entry's offset. |
3607 int offset; | 3617 int offset; |
3608 if (merged_indexes_[i] == -1) { | 3618 if (merged_indexes_[i] == -1) { |
3609 if (Is64BitEntry(rmode)) { | 3619 if (Is64BitEntry(rmode)) { |
3610 offset = constant_pool->OffsetOfElementAt(index_64bit) - kHeapObjectTag; | 3620 offset = constant_pool->OffsetOfElementAt(index_64bit) - kHeapObjectTag; |
3611 constant_pool->set(index_64bit++, rinfo->data64()); | 3621 constant_pool->set(index_64bit++, rinfo->data64()); |
3612 } else if (Is32BitEntry(rmode)) { | 3622 } else if (Is32BitEntry(rmode)) { |
3613 offset = constant_pool->OffsetOfElementAt(index_32bit) - kHeapObjectTag; | 3623 offset = constant_pool->OffsetOfElementAt(index_32bit) - kHeapObjectTag; |
3614 constant_pool->set(index_32bit++, static_cast<int32_t>(rinfo->data())); | 3624 constant_pool->set(index_32bit++, static_cast<int32_t>(rinfo->data())); |
3615 } else if (IsCodePtrEntry(rmode)) { | 3625 } else if (IsCodePtrEntry(rmode)) { |
3616 offset = constant_pool->OffsetOfElementAt(index_code_ptr) - | 3626 offset = constant_pool->OffsetOfElementAt(index_code_ptr) - |
3617 kHeapObjectTag; | 3627 kHeapObjectTag; |
3618 constant_pool->set(index_code_ptr++, | 3628 constant_pool->set(index_code_ptr++, |
3619 reinterpret_cast<Object *>(rinfo->data())); | 3629 reinterpret_cast<Address>(rinfo->data())); |
3620 } else { | 3630 } else { |
3621 ASSERT(IsHeapPtrEntry(rmode)); | 3631 ASSERT(IsHeapPtrEntry(rmode)); |
3622 offset = constant_pool->OffsetOfElementAt(index_heap_ptr) - | 3632 offset = constant_pool->OffsetOfElementAt(index_heap_ptr) - |
3623 kHeapObjectTag; | 3633 kHeapObjectTag; |
3624 constant_pool->set(index_heap_ptr++, | 3634 constant_pool->set(index_heap_ptr++, |
3625 reinterpret_cast<Object *>(rinfo->data())); | 3635 reinterpret_cast<Object *>(rinfo->data())); |
3626 } | 3636 } |
3627 merged_indexes_[i] = offset; // Stash offset for merged entries. | 3637 merged_indexes_[i] = offset; // Stash offset for merged entries. |
3628 } else { | 3638 } else { |
3629 size_t merged_index = static_cast<size_t>(merged_indexes_[i]); | 3639 size_t merged_index = static_cast<size_t>(merged_indexes_[i]); |
(...skipping 23 matching lines...) Expand all Loading... |
3653 ASSERT((index_64bit == count_of_64bit_) && | 3663 ASSERT((index_64bit == count_of_64bit_) && |
3654 (index_code_ptr == (index_64bit + count_of_code_ptr_)) && | 3664 (index_code_ptr == (index_64bit + count_of_code_ptr_)) && |
3655 (index_heap_ptr == (index_code_ptr + count_of_heap_ptr_)) && | 3665 (index_heap_ptr == (index_code_ptr + count_of_heap_ptr_)) && |
3656 (index_32bit == (index_heap_ptr + count_of_32bit_))); | 3666 (index_32bit == (index_heap_ptr + count_of_32bit_))); |
3657 } | 3667 } |
3658 | 3668 |
3659 | 3669 |
3660 } } // namespace v8::internal | 3670 } } // namespace v8::internal |
3661 | 3671 |
3662 #endif // V8_TARGET_ARCH_ARM | 3672 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |