Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: src/heap-inl.h

Issue 157543002: A64: Synchronize with r18581. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap.cc ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap-inl.h
diff --git a/src/heap-inl.h b/src/heap-inl.h
index 3dce348727477c260c894f3710956e4fe0e2ce8f..fedf450ef16de2c80f86d9f126a43ce03211559d 100644
--- a/src/heap-inl.h
+++ b/src/heap-inl.h
@@ -28,6 +28,8 @@
#ifndef V8_HEAP_INL_H_
#define V8_HEAP_INL_H_
+#include <cmath>
+
#include "heap.h"
#include "isolate.h"
#include "list-inl.h"
@@ -484,22 +486,33 @@ void Heap::ScavengePointer(HeapObject** p) {
void Heap::UpdateAllocationSiteFeedback(HeapObject* object) {
- if (FLAG_allocation_site_pretenuring &&
- AllocationSite::CanTrack(object->map()->instance_type())) {
- AllocationMemento* memento = AllocationMemento::FindForHeapObject(
- object, true);
- if (memento != NULL) {
- ASSERT(memento->IsValid());
- bool add_to_scratchpad =
- memento->GetAllocationSite()->IncrementMementoFoundCount();
- Heap* heap = object->GetIsolate()->heap();
- if (add_to_scratchpad && heap->allocation_sites_scratchpad_length <
- kAllocationSiteScratchpadSize) {
- heap->allocation_sites_scratchpad[
- heap->allocation_sites_scratchpad_length++] =
- memento->GetAllocationSite();
- }
- }
+ Heap* heap = object->GetHeap();
+ ASSERT(heap->InNewSpace(object));
+
+ if (!FLAG_allocation_site_pretenuring ||
+ !heap->new_space_high_promotion_mode_active_ ||
+ !AllocationSite::CanTrack(object->map()->instance_type())) return;
+
+ // Either object is the last object in the from space, or there is another
+ // object of at least word size (the header map word) following it, so
+ // suffices to compare ptr and top here.
+ Address ptr = object->address() + object->Size();
+ Address top = heap->new_space()->FromSpacePageHigh();
+ ASSERT(ptr == top || ptr + HeapObject::kHeaderSize <= top);
+ if (ptr == top) return;
+
+ HeapObject* candidate = HeapObject::FromAddress(ptr);
+ if (candidate->map() != heap->allocation_memento_map()) return;
+
+ AllocationMemento* memento = AllocationMemento::cast(candidate);
+ if (!memento->IsValid()) return;
+
+ if (memento->GetAllocationSite()->IncrementMementoFoundCount() &&
+ heap->allocation_sites_scratchpad_length <
+ kAllocationSiteScratchpadSize) {
+ heap->allocation_sites_scratchpad[
+ heap->allocation_sites_scratchpad_length++] =
+ memento->GetAllocationSite();
}
}
@@ -531,10 +544,13 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) {
}
-bool Heap::CollectGarbage(AllocationSpace space, const char* gc_reason) {
+bool Heap::CollectGarbage(AllocationSpace space,
+ const char* gc_reason,
+ const v8::GCCallbackFlags callbackFlags) {
const char* collector_reason = NULL;
GarbageCollector collector = SelectGarbageCollector(space, &collector_reason);
- return CollectGarbage(space, collector, gc_reason, collector_reason);
+ return CollectGarbage(
+ space, collector, gc_reason, collector_reason, callbackFlags);
}
« no previous file with comments | « src/heap.cc ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698