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

Side by Side Diff: src/compiler.cc

Issue 340059: Add support for for loops to the toplevel code generator. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/fast-codegen.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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 #endif 112 #endif
113 113
114 // Optimize the AST. 114 // Optimize the AST.
115 if (!Rewriter::Optimize(literal)) { 115 if (!Rewriter::Optimize(literal)) {
116 // Signal a stack overflow by returning a null handle. The stack 116 // Signal a stack overflow by returning a null handle. The stack
117 // overflow exception will be thrown by the caller. 117 // overflow exception will be thrown by the caller.
118 return Handle<Code>::null(); 118 return Handle<Code>::null();
119 } 119 }
120 120
121 // Generate code and return it. 121 // Generate code and return it.
122 if (FLAG_fast_compiler) { 122 if (FLAG_fast_compiler && !Bootstrapper::IsActive()) {
Kevin Millikin (Chromium) 2009/11/02 14:01:22 I will not commit this part of the change :)
123 CodeGenSelector selector; 123 CodeGenSelector selector;
124 CodeGenSelector::CodeGenTag code_gen = selector.Select(literal); 124 CodeGenSelector::CodeGenTag code_gen = selector.Select(literal);
125 if (code_gen == CodeGenSelector::FAST) { 125 if (code_gen == CodeGenSelector::FAST) {
126 return FastCodeGenerator::MakeCode(literal, script, is_eval); 126 return FastCodeGenerator::MakeCode(literal, script, is_eval);
127 } 127 }
128 ASSERT(code_gen == CodeGenSelector::NORMAL); 128 ASSERT(code_gen == CodeGenSelector::NORMAL);
129 } 129 }
130 return CodeGenerator::MakeCode(literal, script, is_eval); 130 return CodeGenerator::MakeCode(literal, script, is_eval);
131 } 131 }
132 132
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 BAILOUT("DoWhileStatement"); 580 BAILOUT("DoWhileStatement");
581 } 581 }
582 582
583 583
584 void CodeGenSelector::VisitWhileStatement(WhileStatement* stmt) { 584 void CodeGenSelector::VisitWhileStatement(WhileStatement* stmt) {
585 BAILOUT("WhileStatement"); 585 BAILOUT("WhileStatement");
586 } 586 }
587 587
588 588
589 void CodeGenSelector::VisitForStatement(ForStatement* stmt) { 589 void CodeGenSelector::VisitForStatement(ForStatement* stmt) {
590 BAILOUT("ForStatement"); 590 // We do not handle loops with breaks or continue statements in their
591 // body. We will bailout when we hit those statements in the body.
592 if (stmt->init() != NULL) {
593 Visit(stmt->init());
594 CHECK_BAILOUT;
595 }
596 if (stmt->cond() != NULL) {
597 ProcessExpression(stmt->cond(), Expression::kTest);
598 CHECK_BAILOUT;
599 }
600 Visit(stmt->body());
601 if (stmt->next() != NULL) {
602 CHECK_BAILOUT;
603 Visit(stmt->next());
604 }
591 } 605 }
592 606
593 607
594 void CodeGenSelector::VisitForInStatement(ForInStatement* stmt) { 608 void CodeGenSelector::VisitForInStatement(ForInStatement* stmt) {
595 BAILOUT("ForInStatement"); 609 BAILOUT("ForInStatement");
596 } 610 }
597 611
598 612
599 void CodeGenSelector::VisitTryCatchStatement(TryCatchStatement* stmt) { 613 void CodeGenSelector::VisitTryCatchStatement(TryCatchStatement* stmt) {
600 BAILOUT("TryCatchStatement"); 614 BAILOUT("TryCatchStatement");
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 975
962 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { 976 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) {
963 BAILOUT("ThisFunction"); 977 BAILOUT("ThisFunction");
964 } 978 }
965 979
966 #undef BAILOUT 980 #undef BAILOUT
967 #undef CHECK_BAILOUT 981 #undef CHECK_BAILOUT
968 982
969 983
970 } } // namespace v8::internal 984 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/fast-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698