Revision: 15083
Author:   [email protected]
Date:     Wed Jun 12 05:39:15 2013
Log:      Implemented function that returns code age.

This may be used to display debugging information.

BUG=
[email protected], [email protected]

Review URL: https://codereview.chromium.org/16509005
http://code.google.com/p/v8/source/detail?r=15083

Modified:
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Wed Jun 12 02:43:22 2013
+++ /branches/bleeding_edge/src/mark-compact.cc Wed Jun 12 05:39:15 2013
@@ -1004,7 +1004,7 @@
     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 @@
     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);
     }
=======================================
--- /branches/bleeding_edge/src/objects.cc      Wed Jun 12 02:43:22 2013
+++ /branches/bleeding_edge/src/objects.cc      Wed Jun 12 05:39:15 2013
@@ -10297,6 +10297,18 @@
       ? instruction_start() + prologue_offset()
       : NULL;
 }
+
+
+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,
=======================================
--- /branches/bleeding_edge/src/objects.h       Wed Jun 12 02:43:22 2013
+++ /branches/bleeding_edge/src/objects.h       Wed Jun 12 05:39:15 2013
@@ -4825,6 +4825,7 @@
   void MakeOlder(MarkingParity);
   static bool IsYoungSequence(byte* sequence);
   bool IsOld();
+  int GetAge();

   void PrintDeoptLocation(int bailout_id);

@@ -4966,8 +4967,8 @@

   // 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);

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to