Remove deprecated ShouldSelfOptimize machinery.
authormstarzinger <mstarzinger@chromium.org>
Fri, 21 Nov 2014 11:23:34 +0000 (03:23 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 21 Nov 2014 11:23:52 +0000 (11:23 +0000)
R=titzer@chromium.org

Review URL: https://codereview.chromium.org/582683002

Cr-Commit-Position: refs/heads/master@{#25459}

12 files changed:
src/arm/full-codegen-arm.cc
src/arm64/full-codegen-arm64.cc
src/ast-numbering.cc
src/ast.h
src/compiler.cc
src/compiler.h
src/flag-definitions.h
src/ia32/full-codegen-ia32.cc
src/mips/full-codegen-mips.cc
src/mips64/full-codegen-mips64.cc
src/x64/full-codegen-x64.cc
src/x87/full-codegen-x87.cc

index fbf3fec..7dec9f2 100644 (file)
@@ -424,14 +424,9 @@ void FullCodeGenerator::EmitReturnSequence() {
       __ CallRuntime(Runtime::kTraceExit, 1);
     }
     // Pretend that the exit is a backwards jump to the entry.
-    int weight = 1;
-    if (info_->ShouldSelfOptimize()) {
-      weight = FLAG_interrupt_budget / FLAG_self_opt_count;
-    } else {
-      int distance = masm_->pc_offset();
-      weight = Min(kMaxBackEdgeWeight,
-                   Max(1, distance / kCodeSizeMultiplier));
-    }
+    int distance = masm_->pc_offset();
+    int weight =
+        Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier));
     EmitProfilingCounterDecrement(weight);
     Label ok;
     __ b(pl, &ok);
index 710956f..bdbe35e 100644 (file)
@@ -413,14 +413,9 @@ void FullCodeGenerator::EmitReturnSequence() {
       DCHECK(x0.Is(result_register()));
     }
     // Pretend that the exit is a backwards jump to the entry.
-    int weight = 1;
-    if (info_->ShouldSelfOptimize()) {
-      weight = FLAG_interrupt_budget / FLAG_self_opt_count;
-    } else {
-      int distance = masm_->pc_offset() + kCodeSizeMultiplier / 2;
-      weight = Min(kMaxBackEdgeWeight,
-                   Max(1, distance / kCodeSizeMultiplier));
-    }
+    int distance = masm_->pc_offset() + kCodeSizeMultiplier / 2;
+    int weight =
+        Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier));
     EmitProfilingCounterDecrement(weight);
     Label ok;
     __ B(pl, &ok);
index 058921b..54c67e8 100644 (file)
@@ -45,7 +45,6 @@ class AstNumberingVisitor FINAL : public AstVisitor {
   void IncrementNodeCount() { properties_.add_node_count(1); }
   void DisableCrankshaft(BailoutReason reason) {
     dont_crankshaft_reason_ = reason;
-    properties_.flags()->Add(kDontSelfOptimize);
   }
   // TODO(turbofan): Remove the dont_turbofan_reason once no nodes are
   // DontTurbofanNode.  That set of nodes must be kept in sync with
@@ -53,14 +52,9 @@ class AstNumberingVisitor FINAL : public AstVisitor {
   void DisableTurbofan(BailoutReason reason) {
     dont_crankshaft_reason_ = reason;
     dont_turbofan_reason_ = reason;
-    DisableSelfOptimization();
-  }
-  void DisableSelfOptimization() {
-    properties_.flags()->Add(kDontSelfOptimize);
   }
   void DisableCaching(BailoutReason reason) {
     dont_crankshaft_reason_ = reason;
-    DisableSelfOptimization();
     properties_.flags()->Add(kDontCache);
   }
 
@@ -303,7 +297,6 @@ void AstNumberingVisitor::VisitWithStatement(WithStatement* node) {
 
 void AstNumberingVisitor::VisitDoWhileStatement(DoWhileStatement* node) {
   IncrementNodeCount();
-  DisableSelfOptimization();
   node->set_base_id(ReserveIdRange(DoWhileStatement::num_ids()));
   Visit(node->body());
   Visit(node->cond());
@@ -312,7 +305,6 @@ void AstNumberingVisitor::VisitDoWhileStatement(DoWhileStatement* node) {
 
 void AstNumberingVisitor::VisitWhileStatement(WhileStatement* node) {
   IncrementNodeCount();
-  DisableSelfOptimization();
   node->set_base_id(ReserveIdRange(WhileStatement::num_ids()));
   Visit(node->cond());
   Visit(node->body());
@@ -371,7 +363,6 @@ void AstNumberingVisitor::VisitCompareOperation(CompareOperation* node) {
 
 void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) {
   IncrementNodeCount();
-  DisableSelfOptimization();
   ReserveFeedbackSlots(node);
   node->set_base_id(ReserveIdRange(ForInStatement::num_ids()));
   Visit(node->each());
@@ -433,7 +424,6 @@ void AstNumberingVisitor::VisitCaseClause(CaseClause* node) {
 
 void AstNumberingVisitor::VisitForStatement(ForStatement* node) {
   IncrementNodeCount();
-  DisableSelfOptimization();
   node->set_base_id(ReserveIdRange(ForStatement::num_ids()));
   if (node->init() != NULL) Visit(node->init());
   if (node->cond() != NULL) Visit(node->cond());
index f4742f1..cfc34ca 100644 (file)
--- a/src/ast.h
+++ b/src/ast.h
@@ -150,7 +150,6 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
 
 
 enum AstPropertiesFlag {
-  kDontSelfOptimize,
   kDontSoftInline,
   kDontCache
 };
index 82412a3..ce7a43c 100644 (file)
@@ -276,18 +276,6 @@ Code::Flags CompilationInfo::flags() const {
 }
 
 
-// Primitive functions are unlikely to be picked up by the stack-walking
-// profiler, so they trigger their own optimization when they're called
-// for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time.
-bool CompilationInfo::ShouldSelfOptimize() {
-  return FLAG_crankshaft &&
-      !function()->flags()->Contains(kDontSelfOptimize) &&
-      !function()->dont_optimize() &&
-      function()->scope()->AllowsLazyCompilation() &&
-      (shared_info().is_null() || !shared_info()->optimization_disabled());
-}
-
-
 void CompilationInfo::PrepareForCompilation(Scope* scope) {
   DCHECK(scope_ == NULL);
   scope_ = scope;
index 3db32ce..195e0af 100644 (file)
@@ -301,9 +301,6 @@ class CompilationInfo {
     SetFlag(kDeoptimizationSupport);
   }
 
-  // Determines whether or not to insert a self-optimization header.
-  bool ShouldSelfOptimize();
-
   void set_deferred_handles(DeferredHandles* deferred_handles) {
     DCHECK(deferred_handles_ == NULL);
     deferred_handles_ = deferred_handles;
index 0d7363e..2ca2449 100644 (file)
@@ -401,7 +401,6 @@ DEFINE_INT(type_info_threshold, 25,
            "percentage of ICs that must have type info to allow optimization")
 DEFINE_INT(generic_ic_threshold, 30,
            "max percentage of megamorphic/generic ICs to allow optimization")
-DEFINE_INT(self_opt_count, 130, "call count before self-optimization")
 
 DEFINE_BOOL(trace_opt_verbose, false, "extra verbose compilation tracing")
 DEFINE_IMPLICATION(trace_opt_verbose, trace_opt)
index 672b46b..4d4f788 100644 (file)
@@ -383,14 +383,9 @@ void FullCodeGenerator::EmitReturnSequence() {
       __ CallRuntime(Runtime::kTraceExit, 1);
     }
     // Pretend that the exit is a backwards jump to the entry.
-    int weight = 1;
-    if (info_->ShouldSelfOptimize()) {
-      weight = FLAG_interrupt_budget / FLAG_self_opt_count;
-    } else {
-      int distance = masm_->pc_offset();
-      weight = Min(kMaxBackEdgeWeight,
-                   Max(1, distance / kCodeSizeMultiplier));
-    }
+    int distance = masm_->pc_offset();
+    int weight =
+        Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier));
     EmitProfilingCounterDecrement(weight);
     Label ok;
     __ j(positive, &ok, Label::kNear);
index 28082f0..e23aaee 100644 (file)
@@ -411,14 +411,9 @@ void FullCodeGenerator::EmitReturnSequence() {
       __ CallRuntime(Runtime::kTraceExit, 1);
     }
     // Pretend that the exit is a backwards jump to the entry.
-    int weight = 1;
-    if (info_->ShouldSelfOptimize()) {
-      weight = FLAG_interrupt_budget / FLAG_self_opt_count;
-    } else {
-      int distance = masm_->pc_offset();
-      weight = Min(kMaxBackEdgeWeight,
-                   Max(1, distance / kCodeSizeMultiplier));
-    }
+    int distance = masm_->pc_offset();
+    int weight =
+        Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier));
     EmitProfilingCounterDecrement(weight);
     Label ok;
     __ Branch(&ok, ge, a3, Operand(zero_reg));
index 0ac6467..a93667c 100644 (file)
@@ -407,14 +407,9 @@ void FullCodeGenerator::EmitReturnSequence() {
       __ CallRuntime(Runtime::kTraceExit, 1);
     }
     // Pretend that the exit is a backwards jump to the entry.
-    int weight = 1;
-    if (info_->ShouldSelfOptimize()) {
-      weight = FLAG_interrupt_budget / FLAG_self_opt_count;
-    } else {
-      int distance = masm_->pc_offset();
-      weight = Min(kMaxBackEdgeWeight,
-                   Max(1, distance / kCodeSizeMultiplier));
-    }
+    int distance = masm_->pc_offset();
+    int weight =
+        Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier));
     EmitProfilingCounterDecrement(weight);
     Label ok;
     __ Branch(&ok, ge, a3, Operand(zero_reg));
index ac31cfd..b752e2c 100644 (file)
@@ -386,14 +386,9 @@ void FullCodeGenerator::EmitReturnSequence() {
       __ CallRuntime(Runtime::kTraceExit, 1);
     }
     // Pretend that the exit is a backwards jump to the entry.
-    int weight = 1;
-    if (info_->ShouldSelfOptimize()) {
-      weight = FLAG_interrupt_budget / FLAG_self_opt_count;
-    } else {
-      int distance = masm_->pc_offset();
-      weight = Min(kMaxBackEdgeWeight,
-                   Max(1, distance / kCodeSizeMultiplier));
-    }
+    int distance = masm_->pc_offset();
+    int weight =
+        Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier));
     EmitProfilingCounterDecrement(weight);
     Label ok;
     __ j(positive, &ok, Label::kNear);
index fa9088c..8661322 100644 (file)
@@ -380,14 +380,9 @@ void FullCodeGenerator::EmitReturnSequence() {
       __ CallRuntime(Runtime::kTraceExit, 1);
     }
     // Pretend that the exit is a backwards jump to the entry.
-    int weight = 1;
-    if (info_->ShouldSelfOptimize()) {
-      weight = FLAG_interrupt_budget / FLAG_self_opt_count;
-    } else {
-      int distance = masm_->pc_offset();
-      weight = Min(kMaxBackEdgeWeight,
-                   Max(1, distance / kCodeSizeMultiplier));
-    }
+    int distance = masm_->pc_offset();
+    int weight =
+        Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier));
     EmitProfilingCounterDecrement(weight);
     Label ok;
     __ j(positive, &ok, Label::kNear);