| Index: src/x64/full-codegen-x64.cc
|
| diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
|
| index c87155f49360e51fc6c79fc5111561bdd55fafd3..68773e96e28fe35229bd57ec1291b4b908cdfdb5 100644
|
| --- a/src/x64/full-codegen-x64.cc
|
| +++ b/src/x64/full-codegen-x64.cc
|
| @@ -325,34 +325,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 {
|
| - __ CompareRoot(rsp, Heap::kStackLimitRootIndex);
|
| - __ 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
|
| @@ -361,9 +354,7 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
|
| ASSERT(loop_depth() > 0);
|
| __ testl(rax, Immediate(Min(loop_depth(), Code::kMaxLoopNestingMarker)));
|
|
|
| - if (FLAG_count_based_interrupts) {
|
| - EmitProfilingCounterReset();
|
| - }
|
| + EmitProfilingCounterReset();
|
|
|
| __ bind(&ok);
|
| PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
|
| @@ -1221,7 +1212,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
| __ bind(loop_statement.continue_label());
|
| __ SmiAddConstant(Operand(rsp, 0 * kPointerSize), Smi::FromInt(1));
|
|
|
| - EmitStackCheck(stmt, &loop);
|
| + EmitBackEdgeBookkeeping(stmt, &loop);
|
| __ jmp(&loop);
|
|
|
| // Remove the pointers stored on the stack.
|
|
|