| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 568 |
| 569 | 569 |
| 570 void Heap::GarbageCollectionEpilogue() { | 570 void Heap::GarbageCollectionEpilogue() { |
| 571 store_buffer()->GCEpilogue(); | 571 store_buffer()->GCEpilogue(); |
| 572 | 572 |
| 573 // In release mode, we only zap the from space under heap verification. | 573 // In release mode, we only zap the from space under heap verification. |
| 574 if (Heap::ShouldZapGarbage()) { | 574 if (Heap::ShouldZapGarbage()) { |
| 575 ZapFromSpace(); | 575 ZapFromSpace(); |
| 576 } | 576 } |
| 577 | 577 |
| 578 // Process pretenuring feedback and update allocation sites. |
| 579 ProcessPretenuringFeedback(); |
| 580 |
| 578 #ifdef VERIFY_HEAP | 581 #ifdef VERIFY_HEAP |
| 579 if (FLAG_verify_heap) { | 582 if (FLAG_verify_heap) { |
| 580 Verify(); | 583 Verify(); |
| 581 } | 584 } |
| 582 #endif | 585 #endif |
| 583 | 586 |
| 584 AllowHeapAllocation for_the_rest_of_the_epilogue; | 587 AllowHeapAllocation for_the_rest_of_the_epilogue; |
| 585 | 588 |
| 586 #ifdef DEBUG | 589 #ifdef DEBUG |
| 587 if (FLAG_print_global_handles) isolate_->global_handles()->Print(); | 590 if (FLAG_print_global_handles) isolate_->global_handles()->Print(); |
| (...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 // Set age mark. | 1614 // Set age mark. |
| 1612 new_space_.set_age_mark(new_space_.top()); | 1615 new_space_.set_age_mark(new_space_.top()); |
| 1613 | 1616 |
| 1614 new_space_.LowerInlineAllocationLimit( | 1617 new_space_.LowerInlineAllocationLimit( |
| 1615 new_space_.inline_allocation_limit_step()); | 1618 new_space_.inline_allocation_limit_step()); |
| 1616 | 1619 |
| 1617 // Update how much has survived scavenge. | 1620 // Update how much has survived scavenge. |
| 1618 IncrementYoungSurvivorsCounter(static_cast<int>( | 1621 IncrementYoungSurvivorsCounter(static_cast<int>( |
| 1619 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size())); | 1622 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size())); |
| 1620 | 1623 |
| 1621 ProcessPretenuringFeedback(); | |
| 1622 | |
| 1623 LOG(isolate_, ResourceEvent("scavenge", "end")); | 1624 LOG(isolate_, ResourceEvent("scavenge", "end")); |
| 1624 | 1625 |
| 1625 gc_state_ = NOT_IN_GC; | 1626 gc_state_ = NOT_IN_GC; |
| 1626 | 1627 |
| 1627 scavenges_since_last_idle_round_++; | 1628 scavenges_since_last_idle_round_++; |
| 1628 } | 1629 } |
| 1629 | 1630 |
| 1630 | 1631 |
| 1631 String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap, | 1632 String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap, |
| 1632 Object** p) { | 1633 Object** p) { |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2662 return accessors; | 2663 return accessors; |
| 2663 } | 2664 } |
| 2664 | 2665 |
| 2665 | 2666 |
| 2666 MaybeObject* Heap::AllocateTypeFeedbackInfo() { | 2667 MaybeObject* Heap::AllocateTypeFeedbackInfo() { |
| 2667 TypeFeedbackInfo* info; | 2668 TypeFeedbackInfo* info; |
| 2668 { MaybeObject* maybe_info = AllocateStruct(TYPE_FEEDBACK_INFO_TYPE); | 2669 { MaybeObject* maybe_info = AllocateStruct(TYPE_FEEDBACK_INFO_TYPE); |
| 2669 if (!maybe_info->To(&info)) return maybe_info; | 2670 if (!maybe_info->To(&info)) return maybe_info; |
| 2670 } | 2671 } |
| 2671 info->initialize_storage(); | 2672 info->initialize_storage(); |
| 2672 info->set_type_feedback_cells(TypeFeedbackCells::cast(empty_fixed_array()), | 2673 info->set_feedback_vector(empty_fixed_array(), SKIP_WRITE_BARRIER); |
| 2673 SKIP_WRITE_BARRIER); | |
| 2674 return info; | 2674 return info; |
| 2675 } | 2675 } |
| 2676 | 2676 |
| 2677 | 2677 |
| 2678 MaybeObject* Heap::AllocateAliasedArgumentsEntry(int aliased_context_slot) { | 2678 MaybeObject* Heap::AllocateAliasedArgumentsEntry(int aliased_context_slot) { |
| 2679 AliasedArgumentsEntry* entry; | 2679 AliasedArgumentsEntry* entry; |
| 2680 { MaybeObject* maybe_entry = AllocateStruct(ALIASED_ARGUMENTS_ENTRY_TYPE); | 2680 { MaybeObject* maybe_entry = AllocateStruct(ALIASED_ARGUMENTS_ENTRY_TYPE); |
| 2681 if (!maybe_entry->To(&entry)) return maybe_entry; | 2681 if (!maybe_entry->To(&entry)) return maybe_entry; |
| 2682 } | 2682 } |
| 2683 entry->set_aliased_context_slot(aliased_context_slot); | 2683 entry->set_aliased_context_slot(aliased_context_slot); |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3620 ASSERT(allocation_sites_scratchpad()->length() == | 3620 ASSERT(allocation_sites_scratchpad()->length() == |
| 3621 kAllocationSiteScratchpadSize); | 3621 kAllocationSiteScratchpadSize); |
| 3622 for (int i = 0; i < kAllocationSiteScratchpadSize; i++) { | 3622 for (int i = 0; i < kAllocationSiteScratchpadSize; i++) { |
| 3623 allocation_sites_scratchpad()->set_undefined(i); | 3623 allocation_sites_scratchpad()->set_undefined(i); |
| 3624 } | 3624 } |
| 3625 } | 3625 } |
| 3626 | 3626 |
| 3627 | 3627 |
| 3628 void Heap::AddAllocationSiteToScratchpad(AllocationSite* site) { | 3628 void Heap::AddAllocationSiteToScratchpad(AllocationSite* site) { |
| 3629 if (allocation_sites_scratchpad_length_ < kAllocationSiteScratchpadSize) { | 3629 if (allocation_sites_scratchpad_length_ < kAllocationSiteScratchpadSize) { |
| 3630 // We cannot use the normal write-barrier because slots need to be |
| 3631 // recorded with non-incremental marking as well. We have to explicitly |
| 3632 // record the slot to take evacuation candidates into account. |
| 3630 allocation_sites_scratchpad()->set( | 3633 allocation_sites_scratchpad()->set( |
| 3631 allocation_sites_scratchpad_length_, site); | 3634 allocation_sites_scratchpad_length_, site, SKIP_WRITE_BARRIER); |
| 3635 Object** slot = allocation_sites_scratchpad()->RawFieldOfElementAt( |
| 3636 allocation_sites_scratchpad_length_); |
| 3637 mark_compact_collector()->RecordSlot(slot, slot, *slot); |
| 3632 allocation_sites_scratchpad_length_++; | 3638 allocation_sites_scratchpad_length_++; |
| 3633 } | 3639 } |
| 3634 } | 3640 } |
| 3635 | 3641 |
| 3636 | 3642 |
| 3637 Map* Heap::MapForExternalArrayType(ExternalArrayType array_type) { | 3643 Map* Heap::MapForExternalArrayType(ExternalArrayType array_type) { |
| 3638 return Map::cast(roots_[RootIndexForExternalArrayType(array_type)]); | 3644 return Map::cast(roots_[RootIndexForExternalArrayType(array_type)]); |
| 3639 } | 3645 } |
| 3640 | 3646 |
| 3641 | 3647 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3768 | 3774 |
| 3769 return share; | 3775 return share; |
| 3770 } | 3776 } |
| 3771 | 3777 |
| 3772 | 3778 |
| 3773 MaybeObject* Heap::AllocateJSMessageObject(String* type, | 3779 MaybeObject* Heap::AllocateJSMessageObject(String* type, |
| 3774 JSArray* arguments, | 3780 JSArray* arguments, |
| 3775 int start_position, | 3781 int start_position, |
| 3776 int end_position, | 3782 int end_position, |
| 3777 Object* script, | 3783 Object* script, |
| 3778 Object* stack_trace, | |
| 3779 Object* stack_frames) { | 3784 Object* stack_frames) { |
| 3780 Object* result; | 3785 Object* result; |
| 3781 { MaybeObject* maybe_result = Allocate(message_object_map(), NEW_SPACE); | 3786 { MaybeObject* maybe_result = Allocate(message_object_map(), NEW_SPACE); |
| 3782 if (!maybe_result->ToObject(&result)) return maybe_result; | 3787 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 3783 } | 3788 } |
| 3784 JSMessageObject* message = JSMessageObject::cast(result); | 3789 JSMessageObject* message = JSMessageObject::cast(result); |
| 3785 message->set_properties(Heap::empty_fixed_array(), SKIP_WRITE_BARRIER); | 3790 message->set_properties(Heap::empty_fixed_array(), SKIP_WRITE_BARRIER); |
| 3786 message->initialize_elements(); | 3791 message->initialize_elements(); |
| 3787 message->set_elements(Heap::empty_fixed_array(), SKIP_WRITE_BARRIER); | 3792 message->set_elements(Heap::empty_fixed_array(), SKIP_WRITE_BARRIER); |
| 3788 message->set_type(type); | 3793 message->set_type(type); |
| 3789 message->set_arguments(arguments); | 3794 message->set_arguments(arguments); |
| 3790 message->set_start_position(start_position); | 3795 message->set_start_position(start_position); |
| 3791 message->set_end_position(end_position); | 3796 message->set_end_position(end_position); |
| 3792 message->set_script(script); | 3797 message->set_script(script); |
| 3793 message->set_stack_trace(stack_trace); | |
| 3794 message->set_stack_frames(stack_frames); | 3798 message->set_stack_frames(stack_frames); |
| 3795 return result; | 3799 return result; |
| 3796 } | 3800 } |
| 3797 | 3801 |
| 3798 | 3802 |
| 3799 MaybeObject* Heap::AllocateExternalStringFromAscii( | 3803 MaybeObject* Heap::AllocateExternalStringFromAscii( |
| 3800 const ExternalAsciiString::Resource* resource) { | 3804 const ExternalAsciiString::Resource* resource) { |
| 3801 size_t length = resource->length(); | 3805 size_t length = resource->length(); |
| 3802 if (length > static_cast<size_t>(String::kMaxLength)) { | 3806 if (length > static_cast<size_t>(String::kMaxLength)) { |
| 3803 isolate()->context()->mark_out_of_memory(); | 3807 isolate()->context()->mark_out_of_memory(); |
| (...skipping 3903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7707 static_cast<int>(object_sizes_last_time_[index])); | 7711 static_cast<int>(object_sizes_last_time_[index])); |
| 7708 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7712 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7709 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7713 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7710 | 7714 |
| 7711 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7715 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7712 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7716 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7713 ClearObjectStats(); | 7717 ClearObjectStats(); |
| 7714 } | 7718 } |
| 7715 | 7719 |
| 7716 } } // namespace v8::internal | 7720 } } // namespace v8::internal |
| OLD | NEW |