__ 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);
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);
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
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);
}
void AstNumberingVisitor::VisitDoWhileStatement(DoWhileStatement* node) {
IncrementNodeCount();
- DisableSelfOptimization();
node->set_base_id(ReserveIdRange(DoWhileStatement::num_ids()));
Visit(node->body());
Visit(node->cond());
void AstNumberingVisitor::VisitWhileStatement(WhileStatement* node) {
IncrementNodeCount();
- DisableSelfOptimization();
node->set_base_id(ReserveIdRange(WhileStatement::num_ids()));
Visit(node->cond());
Visit(node->body());
void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) {
IncrementNodeCount();
- DisableSelfOptimization();
ReserveFeedbackSlots(node);
node->set_base_id(ReserveIdRange(ForInStatement::num_ids()));
Visit(node->each());
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());
enum AstPropertiesFlag {
- kDontSelfOptimize,
kDontSoftInline,
kDontCache
};
}
-// 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;
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;
"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)
__ 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);
__ 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));
__ 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));
__ 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);
__ 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);