Revision: 12186
Author:   [email protected]
Date:     Wed Jul 25 06:51:29 2012
Log:      Classify small functions platform-dependently.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10829009
http://code.google.com/p/v8/source/detail?r=12186

Modified:
 /branches/bleeding_edge/src/arm/full-codegen-arm.cc
 /branches/bleeding_edge/src/full-codegen.h
 /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
 /branches/bleeding_edge/src/mips/full-codegen-mips.cc
 /branches/bleeding_edge/src/runtime-profiler.cc
 /branches/bleeding_edge/src/x64/full-codegen-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Thu Jul 19 07:45:19 2012 +++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Wed Jul 25 06:51:29 2012
@@ -338,8 +338,8 @@
 }


-static const int kMaxBackEdgeWeight = 127;
-static const int kBackEdgeDistanceDivisor = 142;
+const int FullCodeGenerator::kMaxBackEdgeWeight = 127;
+const int FullCodeGenerator::kBackEdgeDistanceUnit = 142;


 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
@@ -355,7 +355,7 @@
       ASSERT(back_edge_target->is_bound());
       int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
       weight = Min(kMaxBackEdgeWeight,
-                   Max(1, distance / kBackEdgeDistanceDivisor));
+                   Max(1, distance / kBackEdgeDistanceUnit));
     }
     EmitProfilingCounterDecrement(weight);
     __ b(pl, &ok);
@@ -407,7 +407,7 @@
       } else if (FLAG_weighted_back_edges) {
         int distance = masm_->pc_offset();
         weight = Min(kMaxBackEdgeWeight,
-                     Max(1, distance / kBackEdgeDistanceDivisor));
+                     Max(1, distance / kBackEdgeDistanceUnit));
       }
       EmitProfilingCounterDecrement(weight);
       Label ok;
=======================================
--- /branches/bleeding_edge/src/full-codegen.h  Wed Jun 20 01:58:41 2012
+++ /branches/bleeding_edge/src/full-codegen.h  Wed Jul 25 06:51:29 2012
@@ -112,6 +112,9 @@
   }

   Zone* zone() const { return zone_; }
+
+  static const int kMaxBackEdgeWeight;
+  static const int kBackEdgeDistanceUnit;

  private:
   class Breakable;
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Thu Jul 19 07:45:19 2012 +++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Wed Jul 25 06:51:29 2012
@@ -325,8 +325,8 @@
 }


-static const int kMaxBackEdgeWeight = 127;
-static const int kBackEdgeDistanceDivisor = 100;
+const int FullCodeGenerator::kMaxBackEdgeWeight = 127;
+const int FullCodeGenerator::kBackEdgeDistanceUnit = 100;


 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
@@ -340,7 +340,7 @@
       ASSERT(back_edge_target->is_bound());
       int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
       weight = Min(kMaxBackEdgeWeight,
-                   Max(1, distance / kBackEdgeDistanceDivisor));
+                   Max(1, distance / kBackEdgeDistanceUnit));
     }
     EmitProfilingCounterDecrement(weight);
     __ j(positive, &ok, Label::kNear);
@@ -402,7 +402,7 @@
       } else if (FLAG_weighted_back_edges) {
         int distance = masm_->pc_offset();
         weight = Min(kMaxBackEdgeWeight,
-                     Max(1, distance / kBackEdgeDistanceDivisor));
+                     Max(1, distance / kBackEdgeDistanceUnit));
       }
       EmitProfilingCounterDecrement(weight);
       Label ok;
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Thu Jul 19 07:45:19 2012 +++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Wed Jul 25 06:51:29 2012
@@ -340,8 +340,8 @@
 }


-static const int kMaxBackEdgeWeight = 127;
-static const int kBackEdgeDistanceDivisor = 142;
+const int FullCodeGenerator::kMaxBackEdgeWeight = 127;
+const int FullCodeGenerator::kBackEdgeDistanceUnit = 142;


 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
@@ -360,7 +360,7 @@
       ASSERT(back_edge_target->is_bound());
       int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
       weight = Min(kMaxBackEdgeWeight,
-                   Max(1, distance / kBackEdgeDistanceDivisor));
+                   Max(1, distance / kBackEdgeDistanceUnit));
     }
     EmitProfilingCounterDecrement(weight);
     __ slt(at, a3, zero_reg);
@@ -413,7 +413,7 @@
       } else if (FLAG_weighted_back_edges) {
         int distance = masm_->pc_offset();
         weight = Min(kMaxBackEdgeWeight,
-                     Max(1, distance / kBackEdgeDistanceDivisor));
+                     Max(1, distance / kBackEdgeDistanceUnit));
       }
       EmitProfilingCounterDecrement(weight);
       Label ok;
=======================================
--- /branches/bleeding_edge/src/runtime-profiler.cc     Thu Jul 19 11:58:23 2012
+++ /branches/bleeding_edge/src/runtime-profiler.cc     Wed Jul 25 06:51:29 2012
@@ -34,6 +34,7 @@
 #include "compilation-cache.h"
 #include "deoptimizer.h"
 #include "execution.h"
+#include "full-codegen.h"
 #include "global-handles.h"
 #include "isolate-inl.h"
 #include "mark-compact.h"
@@ -81,7 +82,8 @@

 // Maximum size in bytes of generated code for a function to be optimized
 // the very first time it is seen on the stack.
-static const int kMaxSizeEarlyOpt = 500;
+static const int kMaxSizeEarlyOpt =
+    5 * FullCodeGenerator::kBackEdgeDistanceUnit;


 Atomic32 RuntimeProfiler::state_ = 0;
@@ -317,8 +319,6 @@
     }
     if (!function->IsOptimizable()) continue;

-
-
     if (FLAG_watch_ic_patching) {
       int ticks = shared_code->profiler_ticks();

@@ -341,7 +341,7 @@
           }
         }
       } else if (!any_ic_changed_ &&
-          shared_code->instruction_size() < kMaxSizeEarlyOpt) {
+                 shared_code->instruction_size() < kMaxSizeEarlyOpt) {
// If no IC was patched since the last tick and this function is very
         // small, optimistically optimize it now.
         Optimize(function, "small function");
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Thu Jul 19 07:45:19 2012 +++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Wed Jul 25 06:51:29 2012
@@ -321,8 +321,8 @@
 }


-static const int kMaxBackEdgeWeight = 127;
-static const int kBackEdgeDistanceDivisor = 162;
+const int FullCodeGenerator::kMaxBackEdgeWeight = 127;
+const int FullCodeGenerator::kBackEdgeDistanceUnit = 162;


 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
@@ -336,7 +336,7 @@
       ASSERT(back_edge_target->is_bound());
       int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
       weight = Min(kMaxBackEdgeWeight,
-                   Max(1, distance / kBackEdgeDistanceDivisor));
+                   Max(1, distance / kBackEdgeDistanceUnit));
     }
     EmitProfilingCounterDecrement(weight);
     __ j(positive, &ok, Label::kNear);
@@ -392,7 +392,7 @@
       } else if (FLAG_weighted_back_edges) {
         int distance = masm_->pc_offset();
         weight = Min(kMaxBackEdgeWeight,
-                     Max(1, distance = kBackEdgeDistanceDivisor));
+                     Max(1, distance / kBackEdgeDistanceUnit));
       }
       EmitProfilingCounterDecrement(weight);
       Label ok;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to