| Index: runtime/vm/code_generator_ia32.cc
|
| ===================================================================
|
| --- runtime/vm/code_generator_ia32.cc (revision 4887)
|
| +++ runtime/vm/code_generator_ia32.cc (working copy)
|
| @@ -1809,6 +1809,21 @@
|
| }
|
|
|
|
|
| +void CodeGenerator::HandleBackwardBranch(
|
| + intptr_t loop_id, intptr_t token_index) {
|
| + // Use stack overflow check to eventually stop execution of loops.
|
| + // This is necessary only if a loop does not have calls.
|
| + __ cmpl(ESP,
|
| + Address::Absolute(Isolate::Current()->stack_limit_address()));
|
| + Label no_stack_overflow;
|
| + __ j(ABOVE, &no_stack_overflow);
|
| + GenerateCallRuntime(loop_id,
|
| + token_index,
|
| + kStackOverflowRuntimeEntry);
|
| + __ Bind(&no_stack_overflow);
|
| +}
|
| +
|
| +
|
| void CodeGenerator::VisitWhileNode(WhileNode* node) {
|
| const Bool& bool_true = Bool::ZoneHandle(Bool::True());
|
| SourceLabel* label = node->label();
|
| @@ -1820,6 +1835,7 @@
|
| __ cmpl(EAX, EDX);
|
| __ j(NOT_EQUAL, label->break_label());
|
| node->body()->Visit(this);
|
| + HandleBackwardBranch(node->id(), node->token_index());
|
| __ jmp(label->continue_label());
|
| __ Bind(label->break_label());
|
| }
|
| @@ -1831,6 +1847,7 @@
|
| Label loop;
|
| __ Bind(&loop);
|
| node->body()->Visit(this);
|
| + HandleBackwardBranch(node->id(), node->token_index());
|
| __ Bind(label->continue_label());
|
| node->condition()->Visit(this);
|
| GenerateConditionTypeCheck(node->id(), node->condition()->token_index());
|
| @@ -1857,6 +1874,7 @@
|
| __ j(NOT_EQUAL, label->break_label());
|
| }
|
| node->body()->Visit(this);
|
| + HandleBackwardBranch(node->id(), node->token_index());
|
| __ Bind(label->continue_label());
|
| node->increment()->Visit(this);
|
| __ jmp(&loop);
|
|
|