Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 46da8a794ff062669596a5c63fb9c6fb76d6297f..f11580452066e2e64b3eb9563dbecb6eb8dbd62f 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -10634,12 +10634,25 @@ void Code::MarkCodeAsExecuted(byte* sequence, Isolate* isolate) { |
} |
+static Code::Age EffectiveAge(Code::Age age) { |
+ if (age == Code::kNotExecutedCodeAge) { |
+ // Treat that's never been executed as old immediately. |
+ age = Code::kIsOldCodeAge; |
+ } else if (age == Code::kExecutedOnceCodeAge) { |
+ // Pre-age code that has only been executed once. |
+ age = Code::kPreAgedCodeAge; |
+ } |
+ return age; |
+} |
+ |
+ |
void Code::MakeOlder(MarkingParity current_parity) { |
byte* sequence = FindCodeAgeSequence(); |
if (sequence != NULL) { |
Age age; |
MarkingParity code_parity; |
GetCodeAgeAndParity(sequence, &age, &code_parity); |
+ age = EffectiveAge(age); |
if (age != kLastCodeAge && code_parity != current_parity) { |
PatchPlatformCodeAge(GetIsolate(), |
sequence, |
@@ -10651,8 +10664,7 @@ void Code::MakeOlder(MarkingParity current_parity) { |
bool Code::IsOld() { |
- Age age = GetAge(); |
- return age >= kIsOldCodeAge; |
+ return GetAge() >= kIsOldCodeAge; |
} |
@@ -10667,9 +10679,14 @@ byte* Code::FindCodeAgeSequence() { |
Code::Age Code::GetAge() { |
+ return EffectiveAge(GetRawAge()); |
+} |
+ |
+ |
+Code::Age Code::GetRawAge() { |
byte* sequence = FindCodeAgeSequence(); |
if (sequence == NULL) { |
- return Code::kNoAgeCodeAge; |
+ return kNoAgeCodeAge; |
} |
Age age; |
MarkingParity parity; |
@@ -10700,15 +10717,13 @@ void Code::GetCodeAgeAndParity(Code* code, Age* age, |
#undef HANDLE_CODE_AGE |
stub = *builtins->MarkCodeAsExecutedOnce(); |
if (code == stub) { |
- // Treat that's never been executed as old immediatly. |
- *age = kIsOldCodeAge; |
+ *age = kNotExecutedCodeAge; |
*parity = NO_MARKING_PARITY; |
return; |
} |
stub = *builtins->MarkCodeAsExecutedTwice(); |
if (code == stub) { |
- // Pre-age code that has only been executed once. |
- *age = kPreAgedCodeAge; |
+ *age = kExecutedOnceCodeAge; |
*parity = NO_MARKING_PARITY; |
return; |
} |