Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: src/fast-codegen.cc

Issue 552065: Add the for statement back into the set of things the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/fast-codegen.cc
===================================================================
--- src/fast-codegen.cc (revision 3658)
+++ src/fast-codegen.cc (working copy)
@@ -420,7 +420,48 @@
void FastCodeGenerator::VisitForStatement(ForStatement* stmt) {
- UNREACHABLE();
+ Comment cmnt(masm_, "[ ForStatement");
+ SetStatementPosition(stmt);
+ Label test, body, stack_limit_hit, stack_check_success;
+
+ Iteration loop_statement(this, stmt);
+ if (stmt->init() != NULL) {
+ Visit(stmt->init());
+ }
+
+ increment_loop_depth();
+ // Emit the test at the bottom of the loop (even if empty).
+ __ jmp(&test);
+
+ __ bind(&body);
+ Visit(stmt->body());
+
+ __ bind(loop_statement.continue_target());
+
+ SetStatementPosition(stmt);
+ if (stmt->next() != NULL) {
+ Visit(stmt->next());
+ }
+
+ __ bind(&test);
+
+ // Check stack before looping.
+ __ StackLimitCheck(&stack_limit_hit);
+ __ bind(&stack_check_success);
+
+ if (stmt->cond() != NULL) {
+ VisitForControl(stmt->cond(), &body, loop_statement.break_target());
+ } else {
+ __ jmp(&body);
+ }
+
+ __ bind(&stack_limit_hit);
+ StackCheckStub stack_stub;
+ __ CallStub(&stack_stub);
+ __ jmp(&stack_check_success);
+
+ __ bind(loop_statement.break_target());
+ decrement_loop_depth();
}
« no previous file with comments | « src/compiler.cc ('k') | test/mjsunit/debug-step.js » ('j') | test/mjsunit/debug-step.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698