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

Side by Side Diff: src/data-flow.h

Issue 998001: Loop peeling for inner loops.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler.cc ('k') | src/data-flow.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // one. Control is split by the condition and merged back from the back 457 // one. Control is split by the condition and merged back from the back
458 // edge at end of the body to the beginning of the condition. The single 458 // edge at end of the body to the beginning of the condition. The single
459 // (free) exit of the result graph is the right (false) arm of the branch 459 // (free) exit of the result graph is the right (false) arm of the branch
460 // node. 460 // node.
461 void Loop(JoinNode* merge, 461 void Loop(JoinNode* merge,
462 FlowGraph* condition, 462 FlowGraph* condition,
463 BranchNode* branch, 463 BranchNode* branch,
464 FlowGraph* body); 464 FlowGraph* body);
465 465
466 #ifdef DEBUG 466 #ifdef DEBUG
467 void PrintText(ZoneList<Node*>* postorder); 467 void PrintText(FunctionLiteral* fun, ZoneList<Node*>* postorder);
468 #endif 468 #endif
469 469
470 private: 470 private:
471 FlowGraph() : entry_(NULL), exit_(NULL) {} 471 FlowGraph() : entry_(NULL), exit_(NULL) {}
472 472
473 Node* entry_; 473 Node* entry_;
474 Node* exit_; 474 Node* exit_;
475 }; 475 };
476 476
477 477
478 // Construct a flow graph from a function literal. Build pre- and postorder 478 // Construct a flow graph from a function literal. Build pre- and postorder
479 // traversal orders as a byproduct. 479 // traversal orders as a byproduct.
480 class FlowGraphBuilder: public AstVisitor { 480 class FlowGraphBuilder: public AstVisitor {
481 public: 481 public:
482 FlowGraphBuilder() 482 FlowGraphBuilder()
483 : graph_(FlowGraph::Empty()), 483 : graph_(FlowGraph::Empty()),
484 global_exit_(NULL), 484 global_exit_(NULL),
485 preorder_(4), 485 preorder_(4),
486 postorder_(4), 486 postorder_(4),
487 definitions_(4) { 487 definitions_(4) {}
488 }
489 488
490 void Build(FunctionLiteral* lit); 489 void Build(FunctionLiteral* lit);
491 490
492 FlowGraph* graph() { return &graph_; } 491 FlowGraph* graph() { return &graph_; }
493 ZoneList<Node*>* postorder() { return &postorder_; } 492 ZoneList<Node*>* postorder() { return &postorder_; }
494 ZoneList<Expression*>* definitions() { return &definitions_; } 493 ZoneList<Expression*>* definitions() { return &definitions_; }
495 494
496 private: 495 private:
497 ExitNode* global_exit() { return global_exit_; } 496 ExitNode* global_exit() { return global_exit_; }
498 497
498 // Helpers to allow tranforming the ast during flow graph construction.
499 void VisitStatements(ZoneList<Statement*>* stmts);
500 Statement* ProcessStatement(Statement* stmt);
501
499 // AST node visit functions. 502 // AST node visit functions.
500 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 503 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
501 AST_NODE_LIST(DECLARE_VISIT) 504 AST_NODE_LIST(DECLARE_VISIT)
502 #undef DECLARE_VISIT 505 #undef DECLARE_VISIT
503 506
504 FlowGraph graph_; 507 FlowGraph graph_;
505 ExitNode* global_exit_; 508 ExitNode* global_exit_;
506 ZoneList<Node*> preorder_; 509 ZoneList<Node*> preorder_;
507 ZoneList<Node*> postorder_; 510 ZoneList<Node*> postorder_;
508 511
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 List<BitVector*> variables_; 661 List<BitVector*> variables_;
659 662
660 DISALLOW_COPY_AND_ASSIGN(ReachingDefinitions); 663 DISALLOW_COPY_AND_ASSIGN(ReachingDefinitions);
661 }; 664 };
662 665
663 666
664 } } // namespace v8::internal 667 } } // namespace v8::internal
665 668
666 669
667 #endif // V8_DATAFLOW_H_ 670 #endif // V8_DATAFLOW_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/data-flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698