| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 3713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3724 // be moved. | 3724 // be moved. |
| 3725 CreateFillerObjectAt(result->address(), object_size); | 3725 CreateFillerObjectAt(result->address(), object_size); |
| 3726 allocation = lo_space_->AllocateRaw(object_size, EXECUTABLE); | 3726 allocation = lo_space_->AllocateRaw(object_size, EXECUTABLE); |
| 3727 if (!allocation.To(&result)) return allocation; | 3727 if (!allocation.To(&result)) return allocation; |
| 3728 OnAllocationEvent(result, object_size); | 3728 OnAllocationEvent(result, object_size); |
| 3729 } | 3729 } |
| 3730 } | 3730 } |
| 3731 | 3731 |
| 3732 result->set_map_no_write_barrier(code_map()); | 3732 result->set_map_no_write_barrier(code_map()); |
| 3733 Code* code = Code::cast(result); | 3733 Code* code = Code::cast(result); |
| 3734 DCHECK(IsAligned(bit_cast<intptr_t>(code->address()), kCodeAlignment)); |
| 3734 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || | 3735 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || |
| 3735 isolate_->code_range()->contains(code->address())); | 3736 isolate_->code_range()->contains(code->address())); |
| 3736 code->set_gc_metadata(Smi::FromInt(0)); | 3737 code->set_gc_metadata(Smi::FromInt(0)); |
| 3737 code->set_ic_age(global_ic_age_); | 3738 code->set_ic_age(global_ic_age_); |
| 3738 return code; | 3739 return code; |
| 3739 } | 3740 } |
| 3740 | 3741 |
| 3741 | 3742 |
| 3742 AllocationResult Heap::CopyCode(Code* code) { | 3743 AllocationResult Heap::CopyCode(Code* code) { |
| 3743 AllocationResult allocation; | 3744 AllocationResult allocation; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3761 // Copy code object. | 3762 // Copy code object. |
| 3762 Address old_addr = code->address(); | 3763 Address old_addr = code->address(); |
| 3763 Address new_addr = result->address(); | 3764 Address new_addr = result->address(); |
| 3764 CopyBlock(new_addr, old_addr, obj_size); | 3765 CopyBlock(new_addr, old_addr, obj_size); |
| 3765 Code* new_code = Code::cast(result); | 3766 Code* new_code = Code::cast(result); |
| 3766 | 3767 |
| 3767 // Update the constant pool. | 3768 // Update the constant pool. |
| 3768 new_code->set_constant_pool(new_constant_pool); | 3769 new_code->set_constant_pool(new_constant_pool); |
| 3769 | 3770 |
| 3770 // Relocate the copy. | 3771 // Relocate the copy. |
| 3772 DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment)); |
| 3771 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || | 3773 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || |
| 3772 isolate_->code_range()->contains(code->address())); | 3774 isolate_->code_range()->contains(code->address())); |
| 3773 new_code->Relocate(new_addr - old_addr); | 3775 new_code->Relocate(new_addr - old_addr); |
| 3774 return new_code; | 3776 return new_code; |
| 3775 } | 3777 } |
| 3776 | 3778 |
| 3777 | 3779 |
| 3778 AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) { | 3780 AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) { |
| 3779 // Allocate ByteArray and ConstantPoolArray before the Code object, so that we | 3781 // Allocate ByteArray and ConstantPoolArray before the Code object, so that we |
| 3780 // do not risk leaving uninitialized Code object (and breaking the heap). | 3782 // do not risk leaving uninitialized Code object (and breaking the heap). |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3819 new_code->set_relocation_info(reloc_info_array); | 3821 new_code->set_relocation_info(reloc_info_array); |
| 3820 | 3822 |
| 3821 // Update constant pool. | 3823 // Update constant pool. |
| 3822 new_code->set_constant_pool(new_constant_pool); | 3824 new_code->set_constant_pool(new_constant_pool); |
| 3823 | 3825 |
| 3824 // Copy patched rinfo. | 3826 // Copy patched rinfo. |
| 3825 CopyBytes(new_code->relocation_start(), reloc_info.start(), | 3827 CopyBytes(new_code->relocation_start(), reloc_info.start(), |
| 3826 static_cast<size_t>(reloc_info.length())); | 3828 static_cast<size_t>(reloc_info.length())); |
| 3827 | 3829 |
| 3828 // Relocate the copy. | 3830 // Relocate the copy. |
| 3831 DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment)); |
| 3829 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || | 3832 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || |
| 3830 isolate_->code_range()->contains(code->address())); | 3833 isolate_->code_range()->contains(code->address())); |
| 3831 new_code->Relocate(new_addr - old_addr); | 3834 new_code->Relocate(new_addr - old_addr); |
| 3832 | 3835 |
| 3833 #ifdef VERIFY_HEAP | 3836 #ifdef VERIFY_HEAP |
| 3834 if (FLAG_verify_heap) code->ObjectVerify(); | 3837 if (FLAG_verify_heap) code->ObjectVerify(); |
| 3835 #endif | 3838 #endif |
| 3836 return new_code; | 3839 return new_code; |
| 3837 } | 3840 } |
| 3838 | 3841 |
| (...skipping 2596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6435 static_cast<int>(object_sizes_last_time_[index])); | 6438 static_cast<int>(object_sizes_last_time_[index])); |
| 6436 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6439 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6437 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6440 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6438 | 6441 |
| 6439 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6442 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6440 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6443 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6441 ClearObjectStats(); | 6444 ClearObjectStats(); |
| 6442 } | 6445 } |
| 6443 } | 6446 } |
| 6444 } // namespace v8::internal | 6447 } // namespace v8::internal |
| OLD | NEW |