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

Unified Diff: src/objects.cc

Issue 96783002: Allocation site pretenuring. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index c484eabe9183401b1b3cce2e571efb85d66ae879..45c695213ad5e6b69e0a8799f6bcfdfb2732a6a7 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9185,19 +9185,20 @@ Handle<String> SeqString::Truncate(Handle<SeqString> string, int new_length) {
AllocationMemento* AllocationMemento::FindForHeapObject(HeapObject* object,
+ Heap* heap,
bool in_GC) {
// AllocationMemento objects are only allocated immediately after objects in
// NewSpace. Detecting whether a memento is present involves carefully
// checking the object immediately after the current object (if there is one)
// to see if it's an AllocationMemento.
- ASSERT(object->GetHeap()->InNewSpace(object));
+ ASSERT(heap->InNewSpace(object));
Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) +
object->Size();
Address top;
if (in_GC) {
- top = object->GetHeap()->new_space()->FromSpacePageHigh();
+ top = heap->new_space()->FromSpacePageHigh();
} else {
- top = object->GetHeap()->NewSpaceTop();
+ top = heap->NewSpaceTop();
}
if ((ptr_end + AllocationMemento::kSize) <= top) {
// There is room in newspace for allocation info. Do we have some?
@@ -12775,6 +12776,24 @@ void JSObject::TransitionElementsKind(Handle<JSObject> object,
const double AllocationSite::kPretenureRatio = 0.60;
+void AllocationSite::ResetPretenureDecision() {
+ dependent_code()->DeoptimizeDependentCodeGroup(
+ GetIsolate(),
+ DependentCode::kAllocationSiteTenuringChangedGroup);
+ set_pretenure_decision(Smi::FromInt(kUndecided));
+ set_memento_found_count(Smi::FromInt(0));
+ set_memento_create_count(Smi::FromInt(0));
+}
+
+
+PretenureFlag AllocationSite::GetPretenureMode() {
+ int mode = pretenure_decision()->value();
+ // Zombie objects "decide" to be untenured.
+ return (mode == kTenure && GetHeap()->GetPretenureMode() == TENURED)
+ ? TENURED : NOT_TENURED;
+}
+
+
bool AllocationSite::IsNestedSite() {
ASSERT(FLAG_trace_track_allocation_sites);
Object* current = GetHeap()->allocation_sites_list();
@@ -12873,9 +12892,10 @@ MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) {
return this;
}
- if (!GetHeap()->InNewSpace(this)) return this;
+ Heap* heap = GetHeap();
+ if (!heap->InNewSpace(this)) return this;
- AllocationMemento* memento = AllocationMemento::FindForHeapObject(this);
+ AllocationMemento* memento = AllocationMemento::FindForHeapObject(this, heap);
if (memento == NULL || !memento->IsValid()) {
return this;
}
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698