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

Unified Diff: src/objects.cc

Issue 40003002: Add support for tracking NotExectuted/ExecutedOnceCodeAge's when --track_gc_object_stats flag is se… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix nit 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
« no previous file with comments | « src/objects.h ('k') | src/v8-counters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/objects.h ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698