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

Unified Diff: src/objects.h

Issue 40063002: Bookkeeping for allocation site pretenuring (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase built on site fields in another CL. Created 7 years, 1 month 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.h
diff --git a/src/objects.h b/src/objects.h
index e6ec722cf92a86c535fd3eae9834d6a1fc4cccb4..2116d1533be591e63305fe43ea4afcdd084f3c66 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -8104,6 +8104,10 @@ enum AllocationSiteMode {
class AllocationSite: public Struct {
public:
static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
+ static const int kUndecided = 0;
+ static const int kDontTenure = 1;
+ static const int kTenure = 2;
+ static const int kZombie = 3;
Hannes Payer (out of office) 2013/11/21 20:52:24 Right now the state diagram (should) looks like th
mvstanton 2013/11/22 11:18:51 Thx. I made these 4 state values into an enum to i
DECL_ACCESSORS(transition_info, Object)
// nested_site threads a list of sites that represent nested literals
@@ -8118,10 +8122,6 @@ class AllocationSite: public Struct {
inline void Initialize();
- bool HasNestedSites() {
- return nested_site()->IsAllocationSite();
- }
-
// This method is expensive, it should only be called for reporting.
bool IsNestedSite();
@@ -8129,6 +8129,33 @@ class AllocationSite: public Struct {
class UnusedBits: public BitField<int, 15, 14> {};
class DoNotInlineBit: public BitField<bool, 29, 1> {};
Hannes Payer (out of office) 2013/11/21 20:52:24 Can we have newlines between the methods?
mvstanton 2013/11/22 11:18:51 Done.
+ inline void IncrementMementoFoundCount();
+ inline void IncrementMementoCreateCount();
+ PretenureFlag GetPretenureMode() {
+ int mode = pretenure_decision()->value();
+ // Zombie objects "decide" to be untenured.
+ return (mode == kTenure) ? TENURED : NOT_TENURED;
+ }
+ bool IsZombie() {
+ return pretenure_decision()->value() == kZombie;
+ }
+ inline void MarkZombie();
+ bool DecisionMade() {
+ return pretenure_decision()->value() != kUndecided;
+ }
+ void Decide() {
+ ASSERT(!DecisionMade());
+ if (ShouldPretenure()) {
+ set_pretenure_decision(Smi::FromInt(kTenure));
+ } else {
+ set_pretenure_decision(Smi::FromInt(kDontTenure));
+ }
+ }
+ void Clear() {
+ set_memento_found_count(Smi::FromInt(0));
+ set_memento_create_count(Smi::FromInt(0));
+ }
+
ElementsKind GetElementsKind() {
ASSERT(!SitePointsToLiteral());
int value = Smi::cast(transition_info())->value();
@@ -8202,6 +8229,8 @@ class AllocationSite: public Struct {
private:
inline DependentCode::DependencyGroup ToDependencyGroup(Reason reason);
+ inline bool ShouldPretenure();
+
DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite);
};
@@ -8213,7 +8242,10 @@ class AllocationMemento: public Struct {
DECL_ACCESSORS(allocation_site, Object)
- bool IsValid() { return allocation_site()->IsAllocationSite(); }
+ bool IsValid() {
+ return allocation_site()->IsAllocationSite() &&
+ !AllocationSite::cast(allocation_site())->IsZombie();
+ }
AllocationSite* GetAllocationSite() {
ASSERT(IsValid());
return AllocationSite::cast(allocation_site());

Powered by Google App Engine
This is Rietveld 408576698