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

Side by Side Diff: src/hydrogen.cc

Issue 9348057: Split AST Declaration class, in preparation for new module declaration forms. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Jakob's comments. Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.h ('k') | src/ia32/full-codegen-ia32.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 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 2316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2327 // not replayed by the Lithium translation. 2327 // not replayed by the Lithium translation.
2328 HEnvironment* initial_env = environment()->CopyWithoutHistory(); 2328 HEnvironment* initial_env = environment()->CopyWithoutHistory();
2329 HBasicBlock* body_entry = CreateBasicBlock(initial_env); 2329 HBasicBlock* body_entry = CreateBasicBlock(initial_env);
2330 current_block()->Goto(body_entry); 2330 current_block()->Goto(body_entry);
2331 body_entry->SetJoinId(AstNode::kFunctionEntryId); 2331 body_entry->SetJoinId(AstNode::kFunctionEntryId);
2332 set_current_block(body_entry); 2332 set_current_block(body_entry);
2333 2333
2334 // Handle implicit declaration of the function name in named function 2334 // Handle implicit declaration of the function name in named function
2335 // expressions before other declarations. 2335 // expressions before other declarations.
2336 if (scope->is_function_scope() && scope->function() != NULL) { 2336 if (scope->is_function_scope() && scope->function() != NULL) {
2337 HandleDeclaration(scope->function(), CONST, NULL); 2337 HandleVariableDeclaration(scope->function(), CONST, NULL);
2338 } 2338 }
2339 VisitDeclarations(scope->declarations()); 2339 VisitDeclarations(scope->declarations());
2340 AddSimulate(AstNode::kDeclarationsId); 2340 AddSimulate(AstNode::kDeclarationsId);
2341 2341
2342 HValue* context = environment()->LookupContext(); 2342 HValue* context = environment()->LookupContext();
2343 AddInstruction( 2343 AddInstruction(
2344 new(zone()) HStackCheck(context, HStackCheck::kFunctionEntry)); 2344 new(zone()) HStackCheck(context, HStackCheck::kFunctionEntry));
2345 2345
2346 VisitStatements(info()->function()->body()); 2346 VisitStatements(info()->function()->body());
2347 if (HasStackOverflow()) return NULL; 2347 if (HasStackOverflow()) return NULL;
(...skipping 4075 matching lines...) Expand 10 before | Expand all | Expand 10 after
6423 void HGraphBuilder::VisitThisFunction(ThisFunction* expr) { 6423 void HGraphBuilder::VisitThisFunction(ThisFunction* expr) {
6424 ASSERT(!HasStackOverflow()); 6424 ASSERT(!HasStackOverflow());
6425 ASSERT(current_block() != NULL); 6425 ASSERT(current_block() != NULL);
6426 ASSERT(current_block()->HasPredecessor()); 6426 ASSERT(current_block()->HasPredecessor());
6427 HThisFunction* self = new(zone()) HThisFunction( 6427 HThisFunction* self = new(zone()) HThisFunction(
6428 function_state()->compilation_info()->closure()); 6428 function_state()->compilation_info()->closure());
6429 return ast_context()->ReturnInstruction(self, expr->id()); 6429 return ast_context()->ReturnInstruction(self, expr->id());
6430 } 6430 }
6431 6431
6432 6432
6433 void HGraphBuilder::VisitDeclaration(Declaration* decl) { 6433 void HGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) {
6434 HandleDeclaration(decl->proxy(), decl->mode(), decl->fun()); 6434 HandleVariableDeclaration(decl->proxy(), decl->mode(), decl->fun());
6435 } 6435 }
6436 6436
6437 6437
6438 void HGraphBuilder::HandleDeclaration(VariableProxy* proxy, 6438 void HGraphBuilder::HandleVariableDeclaration(VariableProxy* proxy,
6439 VariableMode mode, 6439 VariableMode mode,
6440 FunctionLiteral* function) { 6440 FunctionLiteral* function) {
6441 Variable* var = proxy->var(); 6441 Variable* var = proxy->var();
6442 bool binding_needs_init = 6442 bool binding_needs_init =
6443 (mode == CONST || mode == CONST_HARMONY || mode == LET); 6443 (mode == CONST || mode == CONST_HARMONY || mode == LET);
6444 switch (var->location()) { 6444 switch (var->location()) {
6445 case Variable::UNALLOCATED: 6445 case Variable::UNALLOCATED:
6446 return Bailout("unsupported global declaration"); 6446 return Bailout("unsupported global declaration");
6447 case Variable::PARAMETER: 6447 case Variable::PARAMETER:
6448 case Variable::LOCAL: 6448 case Variable::LOCAL:
6449 case Variable::CONTEXT: 6449 case Variable::CONTEXT:
6450 if (binding_needs_init || function != NULL) { 6450 if (binding_needs_init || function != NULL) {
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
7515 } 7515 }
7516 } 7516 }
7517 7517
7518 #ifdef DEBUG 7518 #ifdef DEBUG
7519 if (graph_ != NULL) graph_->Verify(false); // No full verify. 7519 if (graph_ != NULL) graph_->Verify(false); // No full verify.
7520 if (allocator_ != NULL) allocator_->Verify(); 7520 if (allocator_ != NULL) allocator_->Verify();
7521 #endif 7521 #endif
7522 } 7522 }
7523 7523
7524 } } // namespace v8::internal 7524 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698