| Index: src/ia32/full-codegen-ia32.cc
|
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
|
| index fdafe39cfbed0c539cdd98251d43b823f560424c..50713b5c141a10c9cad8a29ed77aee159f2276e1 100644
|
| --- a/src/ia32/full-codegen-ia32.cc
|
| +++ b/src/ia32/full-codegen-ia32.cc
|
| @@ -329,39 +329,27 @@ void FullCodeGenerator::EmitProfilingCounterReset() {
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
|
| - Label* back_edge_target) {
|
| - Comment cmnt(masm_, "[ Stack check");
|
| +void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt,
|
| + Label* back_edge_target) {
|
| + Comment cmnt(masm_, "[ Back edge bookkeeping");
|
| Label ok;
|
|
|
| - if (FLAG_count_based_interrupts) {
|
| - int weight = 1;
|
| - if (FLAG_weighted_back_edges) {
|
| - ASSERT(back_edge_target->is_bound());
|
| - int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
|
| - weight = Min(kMaxBackEdgeWeight,
|
| - Max(1, distance / kBackEdgeDistanceUnit));
|
| - }
|
| - EmitProfilingCounterDecrement(weight);
|
| - __ j(positive, &ok, Label::kNear);
|
| - InterruptStub stub;
|
| - __ CallStub(&stub);
|
| - } else {
|
| - // Count based interrupts happen often enough when they are enabled
|
| - // that the additional stack checks are not necessary (they would
|
| - // only check for interrupts).
|
| - ExternalReference stack_limit =
|
| - ExternalReference::address_of_stack_limit(isolate());
|
| - __ cmp(esp, Operand::StaticVariable(stack_limit));
|
| - __ j(above_equal, &ok, Label::kNear);
|
| - StackCheckStub stub;
|
| - __ CallStub(&stub);
|
| + int weight = 1;
|
| + if (FLAG_weighted_back_edges) {
|
| + ASSERT(back_edge_target->is_bound());
|
| + int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
|
| + weight = Min(kMaxBackEdgeWeight,
|
| + Max(1, distance / kBackEdgeDistanceUnit));
|
| }
|
| + EmitProfilingCounterDecrement(weight);
|
| + __ j(positive, &ok, Label::kNear);
|
| + InterruptStub stub;
|
| + __ CallStub(&stub);
|
|
|
| // Record a mapping of this PC offset to the OSR id. This is used to find
|
| // the AST id from the unoptimized code in order to use it as a key into
|
| // the deoptimization input data found in the optimized code.
|
| - RecordStackCheck(stmt->OsrEntryId());
|
| + RecordBackEdge(stmt->OsrEntryId());
|
|
|
| // Loop stack checks can be patched to perform on-stack replacement. In
|
| // order to decide whether or not to perform OSR we embed the loop depth
|
| @@ -370,9 +358,7 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
|
| ASSERT(loop_depth() > 0);
|
| __ test(eax, Immediate(Min(loop_depth(), Code::kMaxLoopNestingMarker)));
|
|
|
| - if (FLAG_count_based_interrupts) {
|
| - EmitProfilingCounterReset();
|
| - }
|
| + EmitProfilingCounterReset();
|
|
|
| __ bind(&ok);
|
| PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
|
| @@ -1200,7 +1186,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
| __ bind(loop_statement.continue_label());
|
| __ add(Operand(esp, 0 * kPointerSize), Immediate(Smi::FromInt(1)));
|
|
|
| - EmitStackCheck(stmt, &loop);
|
| + EmitBackEdgeBookkeeping(stmt, &loop);
|
| __ jmp(&loop);
|
|
|
| // Remove the pointers stored on the stack.
|
|
|