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

Unified Diff: src/objects-inl.h

Issue 132063004: More efficient use of space in AllocationSite. (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
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 15c9c1f5ff197d5eb7851fb2ecf66baca8963d18..99ed47f01fd7321bf89c98adb712e74933994674 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1304,9 +1304,7 @@ void AllocationSite::Initialize() {
set_transition_info(Smi::FromInt(0));
SetElementsKind(GetInitialFastElementsKind());
set_nested_site(Smi::FromInt(0));
- set_memento_create_count(Smi::FromInt(0));
- set_memento_found_count(Smi::FromInt(0));
- set_pretenure_decision(Smi::FromInt(0));
+ set_pretenure_data(Smi::FromInt(0));
set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()),
SKIP_WRITE_BARRIER);
}
@@ -1315,7 +1313,7 @@ void AllocationSite::Initialize() {
void AllocationSite::MarkZombie() {
ASSERT(!IsZombie());
Initialize();
- set_pretenure_decision(Smi::FromInt(kZombie));
+ set_pretenure_decision(kZombie);
}
@@ -1370,32 +1368,32 @@ inline DependentCode::DependencyGroup AllocationSite::ToDependencyGroup(
inline bool AllocationSite::IncrementMementoFoundCount() {
if (IsZombie()) return false;
- int value = memento_found_count()->value();
- set_memento_found_count(Smi::FromInt(value + 1));
+ int value = memento_found_count();
+ set_memento_found_count(value + 1);
return value == 0;
}
inline void AllocationSite::IncrementMementoCreateCount() {
ASSERT(FLAG_allocation_site_pretenuring);
- int value = memento_create_count()->value();
- set_memento_create_count(Smi::FromInt(value + 1));
+ int value = memento_create_count();
+ set_memento_create_count(value + 1);
}
inline bool AllocationSite::DigestPretenuringFeedback() {
bool decision_made = false;
if (!PretenuringDecisionMade()) {
- int create_count = memento_create_count()->value();
+ int create_count = memento_create_count();
if (create_count >= kPretenureMinimumCreated) {
- int found_count = memento_found_count()->value();
+ int found_count = memento_found_count();
double ratio = static_cast<double>(found_count) / create_count;
if (FLAG_trace_track_allocation_sites) {
PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n",
static_cast<void*>(this), create_count, found_count, ratio);
}
int result = ratio >= kPretenureRatio ? kTenure : kDontTenure;
- set_pretenure_decision(Smi::FromInt(result));
+ set_pretenure_decision(result);
decision_made = true;
// TODO(mvstanton): if the decision represents a change, any dependent
// code registered for pretenuring changes should be deopted.
@@ -1403,8 +1401,8 @@ inline bool AllocationSite::DigestPretenuringFeedback() {
}
// Clear feedback calculation fields until the next gc.
- set_memento_found_count(Smi::FromInt(0));
- set_memento_create_count(Smi::FromInt(0));
+ set_memento_found_count(0);
+ set_memento_create_count(0);
return decision_made;
}
@@ -4598,10 +4596,7 @@ ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset)
ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset)
ACCESSORS(AllocationSite, nested_site, Object, kNestedSiteOffset)
-ACCESSORS_TO_SMI(AllocationSite, memento_found_count, kMementoFoundCountOffset)
-ACCESSORS_TO_SMI(AllocationSite, memento_create_count,
- kMementoCreateCountOffset)
-ACCESSORS_TO_SMI(AllocationSite, pretenure_decision, kPretenureDecisionOffset)
+ACCESSORS_TO_SMI(AllocationSite, pretenure_data, kPretenureDataOffset)
ACCESSORS(AllocationSite, dependent_code, DependentCode,
kDependentCodeOffset)
ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset)
« src/flag-definitions.h ('K') | « src/objects.h ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698