Reviewers: danno,

Description:
Implemented function that returns code age.

This may be used to display debugging information.

BUG=

Please review this at https://codereview.chromium.org/16509005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/objects.h
  M src/objects.cc


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index fc42fc7ecc43c263aef2dd187b5ef21dae588f73..efaf833de765f6b0daff3df3673b581ff921229b 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -10299,8 +10299,21 @@ 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) {
+  ASSERT(code->FindCodeAgeSequence() != NULL);
   Isolate* isolate = Isolate::Current();
   Builtins* builtins = isolate->builtins();
   Code* stub = NULL;
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 756631068e719d0345e1889f9b2f63ff367237e8..5ba1214e17d51297a5180e2234b1ebb737675e0f 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -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,7 +4967,7 @@ class Code: public HeapObject {

   // Code aging
   byte* FindCodeAgeSequence();
-  static void  GetCodeAgeAndParity(Code* code, Age* age,
+  static void GetCodeAgeAndParity(Code* code, Age* age,
                                    MarkingParity* parity);
   static void GetCodeAgeAndParity(byte* sequence, 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