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

Side by Side Diff: src/hydrogen.cc

Issue 12646003: Add parser support for generators. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Finish parser, build AST, add tests Created 7 years, 9 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3787 matching lines...) Expand 10 before | Expand all | Expand 10 after
3798 3798
3799 void HOptimizedGraphBuilder::VisitExpressions( 3799 void HOptimizedGraphBuilder::VisitExpressions(
3800 ZoneList<Expression*>* exprs) { 3800 ZoneList<Expression*>* exprs) {
3801 for (int i = 0; i < exprs->length(); ++i) { 3801 for (int i = 0; i < exprs->length(); ++i) {
3802 CHECK_ALIVE(VisitForValue(exprs->at(i))); 3802 CHECK_ALIVE(VisitForValue(exprs->at(i)));
3803 } 3803 }
3804 } 3804 }
3805 3805
3806 3806
3807 bool HOptimizedGraphBuilder::BuildGraph() { 3807 bool HOptimizedGraphBuilder::BuildGraph() {
3808 if (info()->function()->is_generator()) {
3809 Bailout("function is a generator");
3810 return false;
3811 }
3808 Scope* scope = info()->scope(); 3812 Scope* scope = info()->scope();
3809 if (scope->HasIllegalRedeclaration()) { 3813 if (scope->HasIllegalRedeclaration()) {
3810 Bailout("function with illegal redeclaration"); 3814 Bailout("function with illegal redeclaration");
3811 return false; 3815 return false;
3812 } 3816 }
3813 if (scope->calls_eval()) { 3817 if (scope->calls_eval()) {
3814 Bailout("function calls eval"); 3818 Bailout("function calls eval");
3815 return false; 3819 return false;
3816 } 3820 }
3817 SetUpScope(scope); 3821 SetUpScope(scope);
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
4803 } else { 4807 } else {
4804 ASSERT(context->IsValue()); 4808 ASSERT(context->IsValue());
4805 CHECK_ALIVE(VisitForValue(stmt->expression())); 4809 CHECK_ALIVE(VisitForValue(stmt->expression()));
4806 current_block()->AddLeaveInlined(Pop(), state); 4810 current_block()->AddLeaveInlined(Pop(), state);
4807 } 4811 }
4808 } 4812 }
4809 set_current_block(NULL); 4813 set_current_block(NULL);
4810 } 4814 }
4811 4815
4812 4816
4817 void HOptimizedGraphBuilder::VisitYield(Yield* expr) {
Michael Starzinger 2013/03/14 22:29:24 Move this method away from the statement visitors
4818 // Generators are not optimized, so we should never get here.
4819 UNREACHABLE();
4820 }
4821
4822
4813 void HOptimizedGraphBuilder::VisitWithStatement(WithStatement* stmt) { 4823 void HOptimizedGraphBuilder::VisitWithStatement(WithStatement* stmt) {
4814 ASSERT(!HasStackOverflow()); 4824 ASSERT(!HasStackOverflow());
4815 ASSERT(current_block() != NULL); 4825 ASSERT(current_block() != NULL);
4816 ASSERT(current_block()->HasPredecessor()); 4826 ASSERT(current_block()->HasPredecessor());
4817 return Bailout("WithStatement"); 4827 return Bailout("WithStatement");
4818 } 4828 }
4819 4829
4820 4830
4821 void HOptimizedGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) { 4831 void HOptimizedGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
4822 ASSERT(!HasStackOverflow()); 4832 ASSERT(!HasStackOverflow());
(...skipping 6053 matching lines...) Expand 10 before | Expand all | Expand 10 after
10876 } 10886 }
10877 } 10887 }
10878 10888
10879 #ifdef DEBUG 10889 #ifdef DEBUG
10880 if (graph_ != NULL) graph_->Verify(false); // No full verify. 10890 if (graph_ != NULL) graph_->Verify(false); // No full verify.
10881 if (allocator_ != NULL) allocator_->Verify(); 10891 if (allocator_ != NULL) allocator_->Verify();
10882 #endif 10892 #endif
10883 } 10893 }
10884 10894
10885 } } // namespace v8::internal 10895 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698