Commit 7ff046c3 authored by hpayer@chromium.org's avatar hpayer@chromium.org

Implemented function that returns code age.

This may be used to display debugging information.

BUG=
R=danno@chromium.org, mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/16509005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15083 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1fb2f4b3
......@@ -1004,7 +1004,7 @@ void CodeFlusher::ProcessJSFunctionCandidates() {
if (!code_mark.Get()) {
if (FLAG_trace_code_flushing && shared->is_compiled()) {
SmartArrayPointer<char> name = shared->DebugName()->ToCString();
PrintF("[code-flushing clears: %s]\n", *name);
PrintF("[code-flushing clears: %s - age: %d]\n", *name, code->GetAge());
}
shared->set_code(lazy_compile);
candidate->set_code(lazy_compile);
......@@ -1045,7 +1045,7 @@ void CodeFlusher::ProcessSharedFunctionInfoCandidates() {
if (!code_mark.Get()) {
if (FLAG_trace_code_flushing && candidate->is_compiled()) {
SmartArrayPointer<char> name = candidate->DebugName()->ToCString();
PrintF("[code-flushing clears: %s]\n", *name);
PrintF("[code-flushing clears: %s - age: %d]\n", *name, code->GetAge());
}
candidate->set_code(lazy_compile);
}
......
......@@ -10299,6 +10299,18 @@ byte* Code::FindCodeAgeSequence() {
}
int Code::GetAge() {
byte* sequence = FindCodeAgeSequence();
if (sequence == NULL) {
return Code::kNoAge;
}
Age age;
MarkingParity parity;
GetCodeAgeAndParity(sequence, &age, &parity);
return age;
}
void Code::GetCodeAgeAndParity(Code* code, Age* age,
MarkingParity* parity) {
Isolate* isolate = Isolate::Current();
......
......@@ -4825,6 +4825,7 @@ class Code: public HeapObject {
void MakeOlder(MarkingParity);
static bool IsYoungSequence(byte* sequence);
bool IsOld();
int GetAge();
void PrintDeoptLocation(int bailout_id);
......@@ -4966,8 +4967,8 @@ class Code: public HeapObject {
// Code aging
byte* FindCodeAgeSequence();
static void GetCodeAgeAndParity(Code* code, Age* age,
MarkingParity* parity);
static void GetCodeAgeAndParity(Code* code, Age* age,
MarkingParity* parity);
static void GetCodeAgeAndParity(byte* sequence, Age* age,
MarkingParity* parity);
static Code* GetCodeAgeStub(Age age, MarkingParity parity);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment