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

Side by Side Diff: src/full-codegen.cc

Issue 3302012: Move stack check after while statement. (Closed)
Patch Set: Created 10 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/test-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 __ CallStub(&stack_stub); 818 __ CallStub(&stack_stub);
819 __ jmp(&stack_check_success); 819 __ jmp(&stack_check_success);
820 820
821 __ bind(&done); 821 __ bind(&done);
822 decrement_loop_depth(); 822 decrement_loop_depth();
823 } 823 }
824 824
825 825
826 void FullCodeGenerator::VisitWhileStatement(WhileStatement* stmt) { 826 void FullCodeGenerator::VisitWhileStatement(WhileStatement* stmt) {
827 Comment cmnt(masm_, "[ WhileStatement"); 827 Comment cmnt(masm_, "[ WhileStatement");
828 Label body, stack_limit_hit, stack_check_success; 828 Label body, stack_limit_hit, stack_check_success, done;
829 829
830 Iteration loop_statement(this, stmt); 830 Iteration loop_statement(this, stmt);
831 increment_loop_depth(); 831 increment_loop_depth();
832 832
833 // Emit the test at the bottom of the loop. 833 // Emit the test at the bottom of the loop.
834 __ jmp(loop_statement.continue_target()); 834 __ jmp(loop_statement.continue_target());
835 835
836 __ bind(&stack_limit_hit);
837 StackCheckStub stack_stub;
838 __ CallStub(&stack_stub);
839 __ jmp(&stack_check_success);
840
841 __ bind(&body); 836 __ bind(&body);
842 Visit(stmt->body()); 837 Visit(stmt->body());
843 __ bind(loop_statement.continue_target()); 838 __ bind(loop_statement.continue_target());
844 839
845 // Emit the statement position here as this is where the while 840 // Emit the statement position here as this is where the while
846 // statement code starts. 841 // statement code starts.
847 SetStatementPosition(stmt); 842 SetStatementPosition(stmt);
848 843
849 // Check stack before looping. 844 // Check stack before looping.
850 __ StackLimitCheck(&stack_limit_hit); 845 __ StackLimitCheck(&stack_limit_hit);
851 __ bind(&stack_check_success); 846 __ bind(&stack_check_success);
852 847
853 VisitForControl(stmt->cond(), 848 VisitForControl(stmt->cond(),
854 &body, 849 &body,
855 loop_statement.break_target(), 850 loop_statement.break_target(),
856 loop_statement.break_target()); 851 loop_statement.break_target());
857 852
858 __ bind(loop_statement.break_target()); 853 __ bind(loop_statement.break_target());
854 __ jmp(&done);
855
856 __ bind(&stack_limit_hit);
857 StackCheckStub stack_stub;
858 __ CallStub(&stack_stub);
859 __ jmp(&stack_check_success);
860
861 __ bind(&done);
859 decrement_loop_depth(); 862 decrement_loop_depth();
860 } 863 }
861 864
862 865
863 void FullCodeGenerator::VisitForStatement(ForStatement* stmt) { 866 void FullCodeGenerator::VisitForStatement(ForStatement* stmt) {
864 Comment cmnt(masm_, "[ ForStatement"); 867 Comment cmnt(masm_, "[ ForStatement");
865 Label test, body, stack_limit_hit, stack_check_success; 868 Label test, body, stack_limit_hit, stack_check_success;
866 869
867 Iteration loop_statement(this, stmt); 870 Iteration loop_statement(this, stmt);
868 if (stmt->init() != NULL) { 871 if (stmt->init() != NULL) {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 ASSERT(args->length() == 1); 1133 ASSERT(args->length() == 1);
1131 VisitForValue(args->at(0), kStack); 1134 VisitForValue(args->at(0), kStack);
1132 __ CallRuntime(Runtime::kRegExpCloneResult, 1); 1135 __ CallRuntime(Runtime::kRegExpCloneResult, 1);
1133 Apply(context_, result_register()); 1136 Apply(context_, result_register());
1134 } 1137 }
1135 1138
1136 #undef __ 1139 #undef __
1137 1140
1138 1141
1139 } } // namespace v8::internal 1142 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698