Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index a386b821ceeb3532bd553eaba7e43a8ae3d15ab9..1ceeb30701d2653a1848198af39f70d4db55e9ab 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -1322,6 +1322,16 @@ void AllocationSite::Initialize() { |
} |
+void AllocationSite::MarkZombie() { |
+ ASSERT(!IsZombie()); |
+ set_pretenure_decision(Smi::FromInt(kZombie)); |
+ // Clear all non-smi fields |
+ set_transition_info(Smi::FromInt(0)); |
+ set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()), |
+ SKIP_WRITE_BARRIER); |
+} |
+ |
+ |
// Heuristic: We only need to create allocation site info if the boilerplate |
// elements kind is the initial elements kind. |
AllocationSiteMode AllocationSite::GetMode( |
@@ -1348,6 +1358,9 @@ AllocationSiteMode AllocationSite::GetMode(ElementsKind from, |
inline bool AllocationSite::CanTrack(InstanceType type) { |
+ if (FLAG_allocation_site_pretenuring) { |
+ return type == JS_ARRAY_TYPE || type == JS_OBJECT_TYPE; |
+ } |
return type == JS_ARRAY_TYPE; |
} |
@@ -1367,6 +1380,33 @@ inline DependentCode::DependencyGroup AllocationSite::ToDependencyGroup( |
} |
+inline void AllocationSite::IncrementMementoFoundCount() { |
+ int value = memento_found_count()->value(); |
+ set_memento_found_count(Smi::FromInt(value + 1)); |
+} |
+ |
+ |
+inline void AllocationSite::IncrementMementoCreateCount() { |
+ ASSERT(FLAG_allocation_site_pretenuring); |
+ int value = memento_create_count()->value(); |
+ set_memento_create_count(Smi::FromInt(value + 1)); |
+} |
+ |
+ |
+inline bool AllocationSite::ShouldPretenure() { |
+ ASSERT(FLAG_allocation_site_pretenuring); |
+ int create_count = memento_create_count()->value(); |
+ int found_count = memento_found_count()->value(); |
+ double ratio = create_count > 0 |
Hannes Payer (out of office)
2013/11/21 20:52:24
We have to guard against the case where we just st
mvstanton
2013/11/22 11:18:51
Good advice. Done.
|
+ ? static_cast<double>(found_count) / create_count |
+ : 0.0; |
+ if (FLAG_trace_track_allocation_sites) { |
+ PrintF("(%d, %d) ratio = %f\n", create_count, found_count, ratio); |
+ } |
+ return ratio >= 0.60; |
Hannes Payer (out of office)
2013/11/21 20:52:24
This should be a constant in allocation site calle
mvstanton
2013/11/22 11:18:51
Done. Awkwardly, it must be initialized in objects
|
+} |
+ |
+ |
void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) { |
object->ValidateElements(); |
ElementsKind elements_kind = object->map()->elements_kind(); |