Reviewers: Erik Corry,

Message:
As promised. Please take a look.

More to come :-)

Description:
Split experimental profiler flags


Please review this at https://chromiumcodereview.appspot.com/9374015/

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

Affected files:
  M src/compiler.cc
  M src/flag-definitions.h
  M src/heap.cc
  M src/ic.cc
  M src/mark-compact.cc
  M src/runtime-profiler.h
  M src/runtime-profiler.cc


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 98786e09ce844472adf9bfe0d3363e1394e2c686..aea889f8beaf27d258503d6b8c8ae195ae481c9d 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -114,7 +114,7 @@ void CompilationInfo::DisableOptimization() {
 // profiler, so they trigger their own optimization when they're called
 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time.
 bool CompilationInfo::ShouldSelfOptimize() {
-  return FLAG_counting_profiler &&
+  return FLAG_self_optimization &&
       FLAG_crankshaft &&
       !Serializer::enabled() &&
       !function()->flags()->Contains(kDontSelfOptimize) &&
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 58d671d8c5d267c1587cbf7a486e6216db00121d..36b3d7007d7741fabeda71a97098bc2f78b37fff 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -166,7 +166,13 @@ DEFINE_bool(optimize_closures, true, "optimize closures")
 DEFINE_int(loop_weight, 1, "loop weight for representation inference")

 // Count-based optimization decisions.
-DEFINE_bool(counting_profiler, false, "use experimental counter-based profiler") +DEFINE_bool(experimental_profiler, false, "enable all profiler experiments")
+DEFINE_bool(watch_ic_patching, false, "profiler considers IC stability")
+DEFINE_bool(self_optimization, false,
+            "primitive functions trigger their own optimization")
+
+DEFINE_implication(experimental_profiler, watch_ic_patching)
+DEFINE_implication(experimental_profiler, self_optimization)

 // assembler-ia32.cc / assembler-arm.cc / assembler-x64.cc
 DEFINE_bool(debug_code, false,
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 098e1a63696cee03c6813e26fcbe0012dfeeb052..b0828863941a8461d6f0174b2973391efefafab3 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -1201,7 +1201,7 @@ void Heap::Scavenge() {
   promotion_queue_.Destroy();

   LiveObjectList::UpdateReferencesForScavengeGC();
-  if (!FLAG_counting_profiler) {
+  if (!FLAG_watch_ic_patching) {
     isolate()->runtime_profiler()->UpdateSamplesAfterScavenge();
   }
   incremental_marking()->UpdateMarkingDequeAfterScavenge();
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index c7215409aa8b48ebe54fb2ccb611ebd0f84d2306..01caf3c65b303a48cb83acd1d802eeb73fb92727 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -293,7 +293,7 @@ Failure* IC::ReferenceError(const char* type, Handle<String> name) {


 void IC::PostPatching() {
-  if (FLAG_counting_profiler) {
+  if (FLAG_watch_ic_patching) {
     Isolate::Current()->runtime_profiler()->NotifyICChanged();
     // We do not want to optimize until the ICs have settled down,
     // so when they are patched, we postpone optimization for the
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 8692ce86eeacdd95009dea9ea41b6e5add75a87c..1adb74745fa1258f352bc961fbc0ef26e65d8c1e 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -2373,7 +2373,7 @@ void MarkCompactCollector::AfterMarking() {
     code_flusher_->ProcessCandidates();
   }

-  if (!FLAG_counting_profiler) {
+  if (!FLAG_watch_ic_patching) {
     // Clean up dead objects from the runtime profiler.
     heap()->isolate()->runtime_profiler()->RemoveDeadSamples();
   }
@@ -3383,7 +3383,7 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
   heap_->UpdateReferencesInExternalStringTable(
       &UpdateReferenceInExternalStringTableEntry);

-  if (!FLAG_counting_profiler) {
+  if (!FLAG_watch_ic_patching) {
     // Update JSFunction pointers from the runtime profiler.
     heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact(
         &updating_visitor);
Index: src/runtime-profiler.cc
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc
index 3d29c17ab06c4885d31a58f7358550c42c86b836..3e719cd3e1062588cafd9718f35d1d1cf288dbe6 100644
--- a/src/runtime-profiler.cc
+++ b/src/runtime-profiler.cc
@@ -204,7 +204,7 @@ void RuntimeProfiler::OptimizeNow() {
     JavaScriptFrame* frame = it.frame();
     JSFunction* function = JSFunction::cast(frame->function());

-    if (!FLAG_counting_profiler) {
+    if (!FLAG_watch_ic_patching) {
       // Adjust threshold each time we have processed
       // a certain number of ticks.
       if (sampler_ticks_until_threshold_adjustment_ > 0) {
@@ -232,7 +232,7 @@ void RuntimeProfiler::OptimizeNow() {
     // Do not record non-optimizable functions.
     if (!function->IsOptimizable()) continue;

-    if (FLAG_counting_profiler) {
+    if (FLAG_watch_ic_patching) {
       int ticks = function->shared()->profiler_ticks();

       if (ticks >= kProfilerTicksBeforeOptimization) {
@@ -270,7 +270,7 @@ void RuntimeProfiler::OptimizeNow() {
       }
     }
   }
-  if (FLAG_counting_profiler) {
+  if (FLAG_watch_ic_patching) {
     any_ic_changed_ = false;
     code_generated_ = false;
   } else {  // !FLAG_counting_profiler
@@ -291,7 +291,7 @@ void RuntimeProfiler::NotifyTick() {

 void RuntimeProfiler::SetUp() {
   ASSERT(has_been_globally_set_up_);
-  if (!FLAG_counting_profiler) {
+  if (!FLAG_watch_ic_patching) {
     ClearSampleBuffer();
   }
   // If the ticker hasn't already started, make sure to do so to get
@@ -301,7 +301,7 @@ void RuntimeProfiler::SetUp() {


 void RuntimeProfiler::Reset() {
-  if (FLAG_counting_profiler) {
+  if (FLAG_watch_ic_patching) {
     total_code_generated_ = 0;
   } else {  // !FLAG_counting_profiler
     sampler_threshold_ = kSamplerThresholdInit;
Index: src/runtime-profiler.h
diff --git a/src/runtime-profiler.h b/src/runtime-profiler.h
index c01717ca6815b35f615598ccb16a3511a5bae644..f37456653b1ef3fff2b098eda9a4a8f8636de6ed 100644
--- a/src/runtime-profiler.h
+++ b/src/runtime-profiler.h
@@ -64,7 +64,7 @@ class RuntimeProfiler {
   void NotifyICChanged() { any_ic_changed_ = true; }

   void NotifyCodeGenerated(int generated_code_size) {
-    if (FLAG_counting_profiler) {
+    if (FLAG_watch_ic_patching) {
       code_generated_ = true;
       total_code_generated_ += generated_code_size;
     }


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

Reply via email to