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

Side by Side Diff: src/objects-inl.h

Issue 309623007: Tenure allocation sites only when semi-space is maximum size. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/spaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 } 1570 }
1571 1571
1572 1572
1573 inline void AllocationSite::IncrementMementoCreateCount() { 1573 inline void AllocationSite::IncrementMementoCreateCount() {
1574 ASSERT(FLAG_allocation_site_pretenuring); 1574 ASSERT(FLAG_allocation_site_pretenuring);
1575 int value = memento_create_count(); 1575 int value = memento_create_count();
1576 set_memento_create_count(value + 1); 1576 set_memento_create_count(value + 1);
1577 } 1577 }
1578 1578
1579 1579
1580 inline bool AllocationSite::DigestPretenuringFeedback() { 1580 inline bool AllocationSite::MakePretenureDecision(
1581 bool decision_changed = false; 1581 PretenureDecision current_decision,
1582 double ratio,
1583 bool maximum_size_scavenge) {
1584 // Here we just allow state transitions from undecided or maybe tenure
1585 // to don't tenure, maybe tenure, or tenure.
1586 if ((current_decision == kUndecided || current_decision == kMaybeTenure)) {
1587 if (ratio >= kPretenureRatio) {
1588 // We just transition into tenure state when the semi-space was at
1589 // maximum capacity.
1590 if (maximum_size_scavenge) {
1591 set_deopt_dependent_code(true);
1592 set_pretenure_decision(kTenure);
1593 // Currently we just need to deopt when we make a state transition to
1594 // tenure.
1595 return true;
1596 }
1597 set_pretenure_decision(kMaybeTenure);
1598 } else {
1599 set_pretenure_decision(kDontTenure);
1600 }
1601 }
1602 return false;
1603 }
1604
1605
1606 inline bool AllocationSite::DigestPretenuringFeedback(
1607 bool maximum_size_scavenge) {
1608 bool deopt = false;
1582 int create_count = memento_create_count(); 1609 int create_count = memento_create_count();
1583 int found_count = memento_found_count(); 1610 int found_count = memento_found_count();
1584 bool minimum_mementos_created = create_count >= kPretenureMinimumCreated; 1611 bool minimum_mementos_created = create_count >= kPretenureMinimumCreated;
1585 double ratio = 1612 double ratio =
1586 minimum_mementos_created || FLAG_trace_pretenuring_statistics ? 1613 minimum_mementos_created || FLAG_trace_pretenuring_statistics ?
1587 static_cast<double>(found_count) / create_count : 0.0; 1614 static_cast<double>(found_count) / create_count : 0.0;
1588 PretenureFlag current_mode = GetPretenureMode(); 1615 PretenureDecision current_decision = pretenure_decision();
1589 1616
1590 // TODO(hpayer): Add an intermediate state MAYBE_TENURE which collects 1617 if (minimum_mementos_created) {
1591 // more lifetime feedback for tenuring candidates. In the meantime, we 1618 deopt = MakePretenureDecision(
1592 // just allow transitions from undecided to tenured or not tenured. 1619 current_decision, ratio, maximum_size_scavenge);
1593 if (minimum_mementos_created && pretenure_decision() == kUndecided) {
1594 PretenureDecision result = ratio >= kPretenureRatio
1595 ? kTenure
1596 : kDontTenure;
1597 set_pretenure_decision(result);
1598 if (current_mode != GetPretenureMode()) {
1599 decision_changed = true;
1600 set_deopt_dependent_code(true);
1601 }
1602 } 1620 }
1603 1621
1604 if (FLAG_trace_pretenuring_statistics) { 1622 if (FLAG_trace_pretenuring_statistics) {
1605 PrintF( 1623 PrintF(
1606 "AllocationSite(%p): (created, found, ratio) (%d, %d, %f) %s => %s\n", 1624 "AllocationSite(%p): (created, found, ratio) (%d, %d, %f) %s => %s\n",
1607 static_cast<void*>(this), create_count, found_count, ratio, 1625 static_cast<void*>(this), create_count, found_count, ratio,
1608 current_mode == TENURED ? "tenured" : "not tenured", 1626 PretenureDecisionName(current_decision),
1609 GetPretenureMode() == TENURED ? "tenured" : "not tenured"); 1627 PretenureDecisionName(pretenure_decision()));
1610 } 1628 }
1611 1629
1612 // Clear feedback calculation fields until the next gc. 1630 // Clear feedback calculation fields until the next gc.
1613 set_memento_found_count(0); 1631 set_memento_found_count(0);
1614 set_memento_create_count(0); 1632 set_memento_create_count(0);
1615 return decision_changed; 1633 return deopt;
1616 } 1634 }
1617 1635
1618 1636
1619 void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) { 1637 void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) {
1620 JSObject::ValidateElements(object); 1638 JSObject::ValidateElements(object);
1621 ElementsKind elements_kind = object->map()->elements_kind(); 1639 ElementsKind elements_kind = object->map()->elements_kind();
1622 if (!IsFastObjectElementsKind(elements_kind)) { 1640 if (!IsFastObjectElementsKind(elements_kind)) {
1623 if (IsFastHoleyElementsKind(elements_kind)) { 1641 if (IsFastHoleyElementsKind(elements_kind)) {
1624 TransitionElementsKind(object, FAST_HOLEY_ELEMENTS); 1642 TransitionElementsKind(object, FAST_HOLEY_ELEMENTS);
1625 } else { 1643 } else {
(...skipping 5243 matching lines...) Expand 10 before | Expand all | Expand 10 after
6869 #undef READ_SHORT_FIELD 6887 #undef READ_SHORT_FIELD
6870 #undef WRITE_SHORT_FIELD 6888 #undef WRITE_SHORT_FIELD
6871 #undef READ_BYTE_FIELD 6889 #undef READ_BYTE_FIELD
6872 #undef WRITE_BYTE_FIELD 6890 #undef WRITE_BYTE_FIELD
6873 #undef NOBARRIER_READ_BYTE_FIELD 6891 #undef NOBARRIER_READ_BYTE_FIELD
6874 #undef NOBARRIER_WRITE_BYTE_FIELD 6892 #undef NOBARRIER_WRITE_BYTE_FIELD
6875 6893
6876 } } // namespace v8::internal 6894 } } // namespace v8::internal
6877 6895
6878 #endif // V8_OBJECTS_INL_H_ 6896 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698