Reviewers: danno,

Description:
Deprecate old code aging mechanism.

The old code aging mechanism is too agressive with flushing as it leads
to many functions being flushed and recompiled over and over again. By
now the new code aging mechanism has stabilized enough to deprecate the
old fallback mechanism.

[email protected]

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

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

Affected files:
  M src/compiler.cc
  M src/flag-definitions.h
  M src/objects-inl.h
  M src/objects-visiting-inl.h
  M src/objects.h
  M src/objects.cc


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 7b0b92152931dc3da1e9036cc585b631de054c5c..b58686e2a1192f7195ac6c1a663b1d679be48892 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -811,7 +811,6 @@ static bool InstallFullCode(CompilationInfo* info) {

   // Check the function has compiled code.
   ASSERT(shared->is_compiled());
-  shared->set_code_age(0);
   shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize));
   shared->set_dont_inline(lit->flags()->Contains(kDontInline));
   shared->set_ast_node_count(lit->ast_node_count());
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 49dac4a6db04eb8a8d3d9cbdb55699015fa247a0..e5a516b80d437625e883a771a9956ebad5c89e2c 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -480,7 +480,7 @@ DEFINE_bool(flush_code_incrementally, true,
 DEFINE_bool(trace_code_flushing, false, "trace code flushing progress")
 DEFINE_bool(age_code, true,
             "track un-executed functions to age code and flush only "
-            "old code")
+            "old code (required for code flushing)")
 DEFINE_bool(incremental_marking, true, "use incremental marking")
DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps")
 DEFINE_bool(trace_incremental_marking, false,
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 47d119af52ba882525576ddbd9a21aae539e514f..9f4392a2bed9b22440f6c0299b65b11c310b575f 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -4778,17 +4778,6 @@ BuiltinFunctionId SharedFunctionInfo::builtin_function_id() {
 }


-int SharedFunctionInfo::code_age() {
-  return (compiler_hints() >> kCodeAgeShift) & kCodeAgeMask;
-}
-
-
-void SharedFunctionInfo::set_code_age(int code_age) {
-  int hints = compiler_hints() & ~(kCodeAgeMask << kCodeAgeShift);
-  set_compiler_hints(hints | ((code_age & kCodeAgeMask) << kCodeAgeShift));
-}
-
-
 int SharedFunctionInfo::ic_age() {
   return ICAgeBits::decode(counters());
 }
Index: src/objects-visiting-inl.h
diff --git a/src/objects-visiting-inl.h b/src/objects-visiting-inl.h
index c138fdd429f1e7668881e4d396e3ea7a1d4fb578..182bce4d4c24dba302ce700feb5f121e9475bac7 100644
--- a/src/objects-visiting-inl.h
+++ b/src/objects-visiting-inl.h
@@ -606,11 +606,6 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
   // by optimized version of function.
   MarkBit code_mark = Marking::MarkBitFrom(function->code());
   if (code_mark.Get()) {
-    if (!FLAG_age_code) {
-      if (!Marking::MarkBitFrom(shared_info).Get()) {
-        shared_info->set_code_age(0);
-      }
-    }
     return false;
   }

@@ -682,20 +677,12 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
     return false;
   }

-  if (FLAG_age_code) {
-    return shared_info->code()->IsOld();
-  } else {
- // How many collections newly compiled code object will survive before being
-    // flushed.
-    static const int kCodeAgeThreshold = 5;
-
-    // Age this shared function info.
-    if (shared_info->code_age() < kCodeAgeThreshold) {
-      shared_info->set_code_age(shared_info->code_age() + 1);
-      return false;
-    }
-    return true;
+  // Check age of code. If code aging is disabled we never flush.
+  if (!FLAG_age_code || !shared_info->code()->IsOld()) {
+    return false;
   }
+
+  return true;
 }


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 5459679982d152f63ffad01e0d27d32b40122a38..07048a16e71ec4136f49936d674e96e2bbee86fd 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9401,7 +9401,6 @@ bool JSFunction::CompileLazy(Handle<JSFunction> function,
   bool result = true;
   if (function->shared()->is_compiled()) {
     function->ReplaceCode(function->shared()->code());
-    function->shared()->set_code_age(0);
   } else {
     ASSERT(function->shared()->allows_lazy_compilation());
     CompilationInfoWithZone info(function);
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index dd21db333b7d567c9e48d74de85641c617978cd7..ba3c7a66c1615f82d7acd39630b645137a57a78d 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -4820,7 +4820,10 @@ class Code: public HeapObject {
   };
 #undef DECLARE_CODE_AGE_ENUM

-  // Code aging
+ // Code aging. Indicates how many full GCs this code has survived without
+  // being entered through the prologue.  Used to determine when it is
+  // relatively safe to flush this code object and replace it with lazy
+  // compilation stub.
   static void MakeCodeAgeSequenceYoung(byte* sequence);
   void MakeOlder(MarkingParity);
   static bool IsYoungSequence(byte* sequence);
@@ -6139,14 +6142,6 @@ class SharedFunctionInfo: public HeapObject {
   // iteration by the debugger).
   DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context)

-  // Indicates how many full GCs this function has survived with assigned
-  // code object. Used to determine when it is relatively safe to flush
-  // this code object and replace it with lazy compilation stub.
-  // Age is reset when GC notices that the code object is referenced
-  // from the stack or compilation cache.
-  inline int code_age();
-  inline void set_code_age(int age);
-
   // Indicates whether optimizations have been disabled for this
   // shared function info. If a function is repeatedly optimized or if
   // we cannot optimize the function we disable optimization to avoid
@@ -6389,16 +6384,11 @@ class SharedFunctionInfo: public HeapObject {
   static const int kStartPositionShift = 2;
   static const int kStartPositionMask  = ~((1 << kStartPositionShift) - 1);

-  // Bit positions in compiler_hints.
-  static const int kCodeAgeSize = 3;
-  static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1;
-
   enum CompilerHints {
     kAllowLazyCompilation,
     kAllowLazyCompilationWithoutContext,
     kLiveObjectsMayExist,
-    kCodeAgeShift,
-    kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize,
+    kOptimizationDisabled,
     kStrictModeFunction,
     kExtendedModeFunction,
     kUsesArguments,


--
--
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