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

Side by Side Diff: src/cfg.cc

Issue 162006: Added support for expression statements to the CFG builder and... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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/cfg.h ('k') | no next file » | 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 EXPRESSION_NODE_LIST(DEFINE_VISIT) 417 EXPRESSION_NODE_LIST(DEFINE_VISIT)
418 #undef DEFINE_VISIT 418 #undef DEFINE_VISIT
419 419
420 420
421 void StatementBuilder::VisitBlock(Block* stmt) { 421 void StatementBuilder::VisitBlock(Block* stmt) {
422 VisitStatements(stmt->statements()); 422 VisitStatements(stmt->statements());
423 } 423 }
424 424
425 425
426 void StatementBuilder::VisitExpressionStatement(ExpressionStatement* stmt) { 426 void StatementBuilder::VisitExpressionStatement(ExpressionStatement* stmt) {
427 BAILOUT("ExpressionStatement"); 427 ExpressionBuilder builder;
428 builder.Build(stmt->expression());
429 if (builder.cfg() == NULL) {
430 BAILOUT("unsupported expression in expression statement");
431 }
432 // Here's a temporary hack: we bang on the last instruction of the
433 // expression (if any) to set its location to Effect.
434 if (!builder.cfg()->is_empty()) {
435 InstructionBlock* block = InstructionBlock::cast(builder.cfg()->exit());
436 Instruction* instr = block->instructions()->last();
437 instr->set_location(CfgGlobals::current()->effect_location());
438 }
439 cfg_->Concatenate(builder.cfg());
Lasse Reichstein 2009/08/06 07:42:33 Call it graph_ or flow_graph_ or even control_flow
428 } 440 }
429 441
430 442
431 void StatementBuilder::VisitEmptyStatement(EmptyStatement* stmt) { 443 void StatementBuilder::VisitEmptyStatement(EmptyStatement* stmt) {
432 // Nothing to do. 444 // Nothing to do.
433 } 445 }
434 446
435 447
436 void StatementBuilder::VisitIfStatement(IfStatement* stmt) { 448 void StatementBuilder::VisitIfStatement(IfStatement* stmt) {
437 BAILOUT("IfStatement"); 449 BAILOUT("IfStatement");
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 void ExitNode::Print() { 595 void ExitNode::Print() {
584 if (!is_marked_) { 596 if (!is_marked_) {
585 is_marked_ = true; 597 is_marked_ = true;
586 PrintF("L%d:\nExit\n\n", number()); 598 PrintF("L%d:\nExit\n\n", number());
587 } 599 }
588 } 600 }
589 601
590 #endif // DEBUG 602 #endif // DEBUG
591 603
592 } } // namespace v8::internal 604 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/cfg.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698