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 3569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3580 return isolate->factory()->NewConstantPoolArray(count_of_64bit_, | 3580 return isolate->factory()->NewConstantPoolArray(count_of_64bit_, |
3581 count_of_code_ptr_, | 3581 count_of_code_ptr_, |
3582 count_of_heap_ptr_, | 3582 count_of_heap_ptr_, |
3583 count_of_32bit_); | 3583 count_of_32bit_); |
3584 } | 3584 } |
3585 } | 3585 } |
3586 | 3586 |
3587 | 3587 |
3588 void ConstantPoolBuilder::Populate(Assembler* assm, | 3588 void ConstantPoolBuilder::Populate(Assembler* assm, |
3589 ConstantPoolArray* constant_pool) { | 3589 ConstantPoolArray* constant_pool) { |
3590 ASSERT(constant_pool->count_of_int64_entries() == count_of_64bit_); | 3590 ConstantPoolArray::LayoutSection section = ConstantPoolArray::SMALL_SECTION; |
3591 ASSERT(constant_pool->count_of_code_ptr_entries() == count_of_code_ptr_); | 3591 ASSERT(count_of_64bit_ == |
3592 ASSERT(constant_pool->count_of_heap_ptr_entries() == count_of_heap_ptr_); | 3592 constant_pool->number_of_entries(ConstantPoolArray::INT64, section)); |
3593 ASSERT(constant_pool->count_of_int32_entries() == count_of_32bit_); | 3593 ASSERT(count_of_code_ptr_ == |
| 3594 constant_pool->number_of_entries(ConstantPoolArray::CODE_PTR, section)); |
| 3595 ASSERT(count_of_heap_ptr_ == |
| 3596 constant_pool->number_of_entries(ConstantPoolArray::HEAP_PTR, section)); |
| 3597 ASSERT(count_of_32bit_ == |
| 3598 constant_pool->number_of_entries(ConstantPoolArray::INT32, section)); |
3594 ASSERT(entries_.size() == merged_indexes_.size()); | 3599 ASSERT(entries_.size() == merged_indexes_.size()); |
3595 | 3600 |
3596 int index_64bit = 0; | 3601 int index_64bit = 0; |
3597 int index_code_ptr = count_of_64bit_; | 3602 int index_code_ptr = count_of_64bit_; |
3598 int index_heap_ptr = count_of_64bit_ + count_of_code_ptr_; | 3603 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_; | 3604 int index_32bit = count_of_64bit_ + count_of_code_ptr_ + count_of_heap_ptr_; |
3600 | 3605 |
3601 size_t i; | 3606 size_t i; |
3602 std::vector<RelocInfo>::const_iterator rinfo; | 3607 std::vector<RelocInfo>::const_iterator rinfo; |
3603 for (rinfo = entries_.begin(), i = 0; rinfo != entries_.end(); rinfo++, i++) { | 3608 for (rinfo = entries_.begin(), i = 0; rinfo != entries_.end(); rinfo++, i++) { |
3604 RelocInfo::Mode rmode = rinfo->rmode(); | 3609 RelocInfo::Mode rmode = rinfo->rmode(); |
3605 | 3610 |
3606 // Update constant pool if necessary and get the entry's offset. | 3611 // Update constant pool if necessary and get the entry's offset. |
3607 int offset; | 3612 int offset; |
3608 if (merged_indexes_[i] == -1) { | 3613 if (merged_indexes_[i] == -1) { |
3609 if (Is64BitEntry(rmode)) { | 3614 if (Is64BitEntry(rmode)) { |
3610 offset = constant_pool->OffsetOfElementAt(index_64bit) - kHeapObjectTag; | 3615 offset = constant_pool->OffsetOfElementAt(index_64bit) - kHeapObjectTag; |
3611 constant_pool->set(index_64bit++, rinfo->data64()); | 3616 constant_pool->set(index_64bit++, rinfo->data64()); |
3612 } else if (Is32BitEntry(rmode)) { | 3617 } else if (Is32BitEntry(rmode)) { |
3613 offset = constant_pool->OffsetOfElementAt(index_32bit) - kHeapObjectTag; | 3618 offset = constant_pool->OffsetOfElementAt(index_32bit) - kHeapObjectTag; |
3614 constant_pool->set(index_32bit++, static_cast<int32_t>(rinfo->data())); | 3619 constant_pool->set(index_32bit++, static_cast<int32_t>(rinfo->data())); |
3615 } else if (IsCodePtrEntry(rmode)) { | 3620 } else if (IsCodePtrEntry(rmode)) { |
3616 offset = constant_pool->OffsetOfElementAt(index_code_ptr) - | 3621 offset = constant_pool->OffsetOfElementAt(index_code_ptr) - |
3617 kHeapObjectTag; | 3622 kHeapObjectTag; |
3618 constant_pool->set(index_code_ptr++, | 3623 constant_pool->set(index_code_ptr++, |
3619 reinterpret_cast<Object *>(rinfo->data())); | 3624 reinterpret_cast<Address>(rinfo->data())); |
3620 } else { | 3625 } else { |
3621 ASSERT(IsHeapPtrEntry(rmode)); | 3626 ASSERT(IsHeapPtrEntry(rmode)); |
3622 offset = constant_pool->OffsetOfElementAt(index_heap_ptr) - | 3627 offset = constant_pool->OffsetOfElementAt(index_heap_ptr) - |
3623 kHeapObjectTag; | 3628 kHeapObjectTag; |
3624 constant_pool->set(index_heap_ptr++, | 3629 constant_pool->set(index_heap_ptr++, |
3625 reinterpret_cast<Object *>(rinfo->data())); | 3630 reinterpret_cast<Object *>(rinfo->data())); |
3626 } | 3631 } |
3627 merged_indexes_[i] = offset; // Stash offset for merged entries. | 3632 merged_indexes_[i] = offset; // Stash offset for merged entries. |
3628 } else { | 3633 } else { |
3629 size_t merged_index = static_cast<size_t>(merged_indexes_[i]); | 3634 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_) && | 3658 ASSERT((index_64bit == count_of_64bit_) && |
3654 (index_code_ptr == (index_64bit + count_of_code_ptr_)) && | 3659 (index_code_ptr == (index_64bit + count_of_code_ptr_)) && |
3655 (index_heap_ptr == (index_code_ptr + count_of_heap_ptr_)) && | 3660 (index_heap_ptr == (index_code_ptr + count_of_heap_ptr_)) && |
3656 (index_32bit == (index_heap_ptr + count_of_32bit_))); | 3661 (index_32bit == (index_heap_ptr + count_of_32bit_))); |
3657 } | 3662 } |
3658 | 3663 |
3659 | 3664 |
3660 } } // namespace v8::internal | 3665 } } // namespace v8::internal |
3661 | 3666 |
3662 #endif // V8_TARGET_ARCH_ARM | 3667 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |