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

Side by Side Diff: src/hydrogen.h

Issue 6647018: Remove class HSubgraph. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | « no previous file | src/hydrogen.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 private: 186 private:
187 void AddBlock(HBasicBlock* block); 187 void AddBlock(HBasicBlock* block);
188 188
189 ZoneList<HBasicBlock*> back_edges_; 189 ZoneList<HBasicBlock*> back_edges_;
190 HBasicBlock* loop_header_; 190 HBasicBlock* loop_header_;
191 ZoneList<HBasicBlock*> blocks_; 191 ZoneList<HBasicBlock*> blocks_;
192 }; 192 };
193 193
194 194
195 class HSubgraph: public ZoneObject { 195 class HGraph: public ZoneObject {
196 public:
197 explicit HSubgraph(HGraph* graph)
198 : graph_(graph),
199 entry_block_(NULL),
200 exit_block_(NULL) {
201 }
202
203 HGraph* graph() const { return graph_; }
204 HBasicBlock* entry_block() const { return entry_block_; }
205 HBasicBlock* exit_block() const { return exit_block_; }
206 void set_exit_block(HBasicBlock* block) {
207 exit_block_ = block;
208 }
209
210 void Initialize(HBasicBlock* block) {
211 ASSERT(entry_block_ == NULL);
212 entry_block_ = block;
213 exit_block_ = block;
214 }
215
216 protected:
217 HGraph* graph_; // The graph this is a subgraph of.
218 HBasicBlock* entry_block_;
219 HBasicBlock* exit_block_;
220 };
221
222
223 class HGraph: public HSubgraph {
224 public: 196 public:
225 explicit HGraph(CompilationInfo* info); 197 explicit HGraph(CompilationInfo* info);
226 198
227 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } 199 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
228 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } 200 const ZoneList<HPhi*>* phi_list() const { return phi_list_; }
201 HBasicBlock* entry_block() const { return entry_block_; }
229 HEnvironment* start_environment() const { return start_environment_; } 202 HEnvironment* start_environment() const { return start_environment_; }
230 203
231 void InitializeInferredTypes(); 204 void InitializeInferredTypes();
232 void InsertTypeConversions(); 205 void InsertTypeConversions();
233 void InsertRepresentationChanges(); 206 void InsertRepresentationChanges();
234 void ComputeMinusZeroChecks(); 207 void ComputeMinusZeroChecks();
235 bool ProcessArgumentsObject(); 208 bool ProcessArgumentsObject();
236 void EliminateRedundantPhis(); 209 void EliminateRedundantPhis();
237 void EliminateUnreachablePhis(); 210 void EliminateUnreachablePhis();
238 void Canonicalize(); 211 void Canonicalize();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 HValue* use, 270 HValue* use,
298 Representation to); 271 Representation to);
299 void InsertRepresentationChangesForValue(HValue* current, 272 void InsertRepresentationChangesForValue(HValue* current,
300 ZoneList<HValue*>* value_list, 273 ZoneList<HValue*>* value_list,
301 ZoneList<Representation>* rep_list); 274 ZoneList<Representation>* rep_list);
302 void InferTypes(ZoneList<HValue*>* worklist); 275 void InferTypes(ZoneList<HValue*>* worklist);
303 void InitializeInferredTypes(int from_inclusive, int to_inclusive); 276 void InitializeInferredTypes(int from_inclusive, int to_inclusive);
304 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); 277 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor);
305 278
306 int next_block_id_; 279 int next_block_id_;
280 HBasicBlock* entry_block_;
307 HEnvironment* start_environment_; 281 HEnvironment* start_environment_;
308 ZoneList<HBasicBlock*> blocks_; 282 ZoneList<HBasicBlock*> blocks_;
309 ZoneList<HValue*> values_; 283 ZoneList<HValue*> values_;
310 ZoneList<HPhi*>* phi_list_; 284 ZoneList<HPhi*>* phi_list_;
311 SetOncePointer<HConstant> undefined_constant_; 285 SetOncePointer<HConstant> undefined_constant_;
312 SetOncePointer<HConstant> constant_1_; 286 SetOncePointer<HConstant> constant_1_;
313 SetOncePointer<HConstant> constant_minus1_; 287 SetOncePointer<HConstant> constant_minus1_;
314 SetOncePointer<HConstant> constant_true_; 288 SetOncePointer<HConstant> constant_true_;
315 SetOncePointer<HConstant> constant_false_; 289 SetOncePointer<HConstant> constant_false_;
316 SetOncePointer<HArgumentsObject> arguments_object_; 290 SetOncePointer<HArgumentsObject> arguments_object_;
317 291
318 friend class HSubgraph;
319
320 DISALLOW_COPY_AND_ASSIGN(HGraph); 292 DISALLOW_COPY_AND_ASSIGN(HGraph);
321 }; 293 };
322 294
323 295
324 class HEnvironment: public ZoneObject { 296 class HEnvironment: public ZoneObject {
325 public: 297 public:
326 HEnvironment(HEnvironment* outer, 298 HEnvironment(HEnvironment* outer,
327 Scope* scope, 299 Scope* scope,
328 Handle<JSFunction> closure); 300 Handle<JSFunction> closure);
329 301
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 HGraphBuilder* owner_; 608 HGraphBuilder* owner_;
637 BreakAndContinueScope* next_; 609 BreakAndContinueScope* next_;
638 }; 610 };
639 611
640 HGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle) 612 HGraphBuilder(CompilationInfo* info, TypeFeedbackOracle* oracle)
641 : function_state_(NULL), 613 : function_state_(NULL),
642 initial_function_state_(this, info, oracle), 614 initial_function_state_(this, info, oracle),
643 ast_context_(NULL), 615 ast_context_(NULL),
644 break_scope_(NULL), 616 break_scope_(NULL),
645 graph_(NULL), 617 graph_(NULL),
646 current_subgraph_(NULL), 618 current_block_(NULL),
647 inlined_count_(0) { 619 inlined_count_(0) {
648 // This is not initialized in the initializer list because the 620 // This is not initialized in the initializer list because the
649 // constructor for the initial state relies on function_state_ == NULL 621 // constructor for the initial state relies on function_state_ == NULL
650 // to know it's the initial state. 622 // to know it's the initial state.
651 function_state_= &initial_function_state_; 623 function_state_= &initial_function_state_;
652 } 624 }
653 625
654 HGraph* CreateGraph(); 626 HGraph* CreateGraph();
655 627
656 // Simple accessors. 628 // Simple accessors.
657 HGraph* graph() const { return graph_; } 629 HGraph* graph() const { return graph_; }
658 HSubgraph* subgraph() const { return current_subgraph_; }
659 BreakAndContinueScope* break_scope() const { return break_scope_; } 630 BreakAndContinueScope* break_scope() const { return break_scope_; }
660 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } 631 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; }
661 632
662 HBasicBlock* current_block() const { return subgraph()->exit_block(); } 633 HBasicBlock* current_block() const { return current_block_; }
663 void set_current_block(HBasicBlock* block) { 634 void set_current_block(HBasicBlock* block) { current_block_ = block; }
664 subgraph()->set_exit_block(block);
665 }
666 HEnvironment* environment() const { 635 HEnvironment* environment() const {
667 return current_block()->last_environment(); 636 return current_block()->last_environment();
668 } 637 }
669 638
670 // Adding instructions. 639 // Adding instructions.
671 HInstruction* AddInstruction(HInstruction* instr); 640 HInstruction* AddInstruction(HInstruction* instr);
672 void AddSimulate(int id); 641 void AddSimulate(int id);
673 642
674 // Bailout environment manipulation. 643 // Bailout environment manipulation.
675 void Push(HValue* value) { environment()->Push(value); } 644 void Push(HValue* value) { environment()->Push(value); }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 HBasicBlock* CreateLoop(IterationStatement* statement, 715 HBasicBlock* CreateLoop(IterationStatement* statement,
747 HBasicBlock* loop_entry, 716 HBasicBlock* loop_entry,
748 HBasicBlock* body_exit, 717 HBasicBlock* body_exit,
749 HBasicBlock* loop_successor, 718 HBasicBlock* loop_successor,
750 HBasicBlock* break_block); 719 HBasicBlock* break_block);
751 720
752 HBasicBlock* JoinContinue(IterationStatement* statement, 721 HBasicBlock* JoinContinue(IterationStatement* statement,
753 HBasicBlock* exit_block, 722 HBasicBlock* exit_block,
754 HBasicBlock* continue_block); 723 HBasicBlock* continue_block);
755 724
756 void AddToSubgraph(HSubgraph* graph, ZoneList<Statement*>* stmts);
757 void AddToSubgraph(HSubgraph* graph, Statement* stmt);
758 void AddToSubgraph(HSubgraph* graph, Expression* expr);
759
760 HValue* Top() const { return environment()->Top(); } 725 HValue* Top() const { return environment()->Top(); }
761 void Drop(int n) { environment()->Drop(n); } 726 void Drop(int n) { environment()->Drop(n); }
762 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } 727 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); }
763 728
764 void VisitForValue(Expression* expr); 729 void VisitForValue(Expression* expr);
765 void VisitForEffect(Expression* expr); 730 void VisitForEffect(Expression* expr);
766 void VisitForControl(Expression* expr, 731 void VisitForControl(Expression* expr,
767 HBasicBlock* true_block, 732 HBasicBlock* true_block,
768 HBasicBlock* false_block); 733 HBasicBlock* false_block);
769 734
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 FunctionState initial_function_state_; 866 FunctionState initial_function_state_;
902 867
903 // Expression context of the currently visited subexpression. NULL when 868 // Expression context of the currently visited subexpression. NULL when
904 // visiting statements. 869 // visiting statements.
905 AstContext* ast_context_; 870 AstContext* ast_context_;
906 871
907 // A stack of breakable statements entered. 872 // A stack of breakable statements entered.
908 BreakAndContinueScope* break_scope_; 873 BreakAndContinueScope* break_scope_;
909 874
910 HGraph* graph_; 875 HGraph* graph_;
911 HSubgraph* current_subgraph_; 876 HBasicBlock* current_block_;
912 877
913 int inlined_count_; 878 int inlined_count_;
914 879
915 friend class FunctionState; // Pushes and pops the state stack. 880 friend class FunctionState; // Pushes and pops the state stack.
916 friend class AstContext; // Pushes and pops the AST context stack. 881 friend class AstContext; // Pushes and pops the AST context stack.
917 882
918 DISALLOW_COPY_AND_ASSIGN(HGraphBuilder); 883 DISALLOW_COPY_AND_ASSIGN(HGraphBuilder);
919 }; 884 };
920 885
921 886
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 const char* filename_; 1091 const char* filename_;
1127 HeapStringAllocator string_allocator_; 1092 HeapStringAllocator string_allocator_;
1128 StringStream trace_; 1093 StringStream trace_;
1129 int indent_; 1094 int indent_;
1130 }; 1095 };
1131 1096
1132 1097
1133 } } // namespace v8::internal 1098 } } // namespace v8::internal
1134 1099
1135 #endif // V8_HYDROGEN_H_ 1100 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698