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

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

Issue 668257: Have the flow graph builder collect definitions. (Closed)
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
« no previous file with comments | « no previous file | src/data-flow.cc » ('j') | src/data-flow.cc » ('J')
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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 Node* successor_; 356 Node* successor_;
357 357
358 DISALLOW_COPY_AND_ASSIGN(JoinNode); 358 DISALLOW_COPY_AND_ASSIGN(JoinNode);
359 }; 359 };
360 360
361 361
362 // Construct a flow graph from a function literal. Build pre- and postorder 362 // Construct a flow graph from a function literal. Build pre- and postorder
363 // traversal orders as a byproduct. 363 // traversal orders as a byproduct.
364 class FlowGraphBuilder: public AstVisitor { 364 class FlowGraphBuilder: public AstVisitor {
365 public: 365 public:
366 FlowGraphBuilder() : global_exit_(NULL), preorder_(4), postorder_(4) {} 366 FlowGraphBuilder()
367 : global_exit_(NULL),
368 preorder_(4),
369 postorder_(4),
370 definitions_(4) {
371 }
367 372
368 void Build(FunctionLiteral* lit); 373 void Build(FunctionLiteral* lit);
369 374
370 FlowGraph* graph() { return &graph_; } 375 FlowGraph* graph() { return &graph_; }
371 376
372 ZoneList<Node*>* postorder() { return &postorder_; } 377 ZoneList<Node*>* postorder() { return &postorder_; }
373 378
374 private: 379 private:
375 ExitNode* global_exit() { return global_exit_; } 380 ExitNode* global_exit() { return global_exit_; }
376 381
377 // AST node visit functions. 382 // AST node visit functions.
378 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 383 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
379 AST_NODE_LIST(DECLARE_VISIT) 384 AST_NODE_LIST(DECLARE_VISIT)
380 #undef DECLARE_VISIT 385 #undef DECLARE_VISIT
381 386
382 FlowGraph graph_; 387 FlowGraph graph_;
383 ExitNode* global_exit_; 388 ExitNode* global_exit_;
384 ZoneList<Node*> preorder_; 389 ZoneList<Node*> preorder_;
385 ZoneList<Node*> postorder_; 390 ZoneList<Node*> postorder_;
386 391
392 // The flow graph builder collects a list of definitions (assignments and
393 // count operations) to stack-allocated variables to use for reaching
394 // definitions analysis.
395 ZoneList<AstNode*> definitions_;
396
387 DISALLOW_COPY_AND_ASSIGN(FlowGraphBuilder); 397 DISALLOW_COPY_AND_ASSIGN(FlowGraphBuilder);
388 }; 398 };
389 399
390 400
391 // This class is used to number all expressions in the AST according to 401 // This class is used to number all expressions in the AST according to
392 // their evaluation order (post-order left-to-right traversal). 402 // their evaluation order (post-order left-to-right traversal).
393 class AstLabeler: public AstVisitor { 403 class AstLabeler: public AstVisitor {
394 public: 404 public:
395 AstLabeler() : next_number_(0) {} 405 AstLabeler() : next_number_(0) {}
396 406
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 VarUseMap live_vars_; 472 VarUseMap live_vars_;
463 473
464 DISALLOW_COPY_AND_ASSIGN(LivenessAnalyzer); 474 DISALLOW_COPY_AND_ASSIGN(LivenessAnalyzer);
465 }; 475 };
466 476
467 477
468 } } // namespace v8::internal 478 } } // namespace v8::internal
469 479
470 480
471 #endif // V8_DATAFLOW_H_ 481 #endif // V8_DATAFLOW_H_
OLDNEW
« no previous file with comments | « no previous file | src/data-flow.cc » ('j') | src/data-flow.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698