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

Side by Side Diff: src/hydrogen.h

Issue 6532088: Partial refactoring of subgraphs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build/ia32
Patch Set: Created 9 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 | « 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 class HSubgraph: public ZoneObject { 194 class HSubgraph: public ZoneObject {
195 public: 195 public:
196 explicit HSubgraph(HGraph* graph) 196 explicit HSubgraph(HGraph* graph)
197 : graph_(graph), 197 : graph_(graph),
198 entry_block_(NULL), 198 entry_block_(NULL),
199 exit_block_(NULL) { 199 exit_block_(NULL) {
200 } 200 }
201 201
202 HGraph* graph() const { return graph_; } 202 HGraph* graph() const { return graph_; }
203 HEnvironment* environment() const { 203 HBasicBlock* entry_block() const { return entry_block_; }
204 ASSERT(HasExit()); 204 HBasicBlock* exit_block() const { return exit_block_; }
205 return exit_block_->last_environment(); 205 void set_exit_block(HBasicBlock* block) {
206 exit_block_ = block;
206 } 207 }
207 208
208 bool HasExit() const { return exit_block_ != NULL; }
209
210 void PreProcessOsrEntry(IterationStatement* statement); 209 void PreProcessOsrEntry(IterationStatement* statement);
211 210
212 void AppendJoin(HSubgraph* then_graph, HSubgraph* else_graph, AstNode* node); 211 void AppendJoin(HSubgraph* then_graph, HSubgraph* else_graph, AstNode* node);
213 void AppendWhile(HSubgraph* condition, 212 void AppendWhile(HSubgraph* condition,
214 HSubgraph* body, 213 HSubgraph* body,
215 IterationStatement* statement, 214 IterationStatement* statement,
216 HSubgraph* continue_subgraph, 215 HSubgraph* continue_subgraph,
217 HSubgraph* exit, 216 HSubgraph* exit,
218 HBasicBlock* break_block); 217 HBasicBlock* break_block);
219 void AppendDoWhile(HSubgraph* body, 218 void AppendDoWhile(HSubgraph* body,
(...skipping 10 matching lines...) Expand all
230 void ResolveContinue(IterationStatement* statement, 229 void ResolveContinue(IterationStatement* statement,
231 HBasicBlock* continue_block); 230 HBasicBlock* continue_block);
232 HBasicBlock* JoinBlocks(HBasicBlock* a, HBasicBlock* b, int id); 231 HBasicBlock* JoinBlocks(HBasicBlock* a, HBasicBlock* b, int id);
233 232
234 void FinishExit(HControlInstruction* instruction); 233 void FinishExit(HControlInstruction* instruction);
235 void Initialize(HBasicBlock* block) { 234 void Initialize(HBasicBlock* block) {
236 ASSERT(entry_block_ == NULL); 235 ASSERT(entry_block_ == NULL);
237 entry_block_ = block; 236 entry_block_ = block;
238 exit_block_ = block; 237 exit_block_ = block;
239 } 238 }
240 HBasicBlock* entry_block() const { return entry_block_; }
241 HBasicBlock* exit_block() const { return exit_block_; }
242 void set_exit_block(HBasicBlock* block) {
243 exit_block_ = block;
244 }
245
246 void ConnectExitTo(HBasicBlock* other, bool include_stack_check = false) {
247 if (HasExit()) {
248 exit_block()->Goto(other, include_stack_check);
249 }
250 }
251 239
252 protected: 240 protected:
253 HGraph* graph_; // The graph this is a subgraph of. 241 HGraph* graph_; // The graph this is a subgraph of.
254 HBasicBlock* entry_block_; 242 HBasicBlock* entry_block_;
255 HBasicBlock* exit_block_; 243 HBasicBlock* exit_block_;
256 }; 244 };
257 245
258 246
259 class HGraph: public HSubgraph { 247 class HGraph: public HSubgraph {
260 public: 248 public:
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 } 638 }
651 639
652 HGraph* CreateGraph(CompilationInfo* info); 640 HGraph* CreateGraph(CompilationInfo* info);
653 641
654 // Simple accessors. 642 // Simple accessors.
655 HGraph* graph() const { return graph_; } 643 HGraph* graph() const { return graph_; }
656 HSubgraph* subgraph() const { return current_subgraph_; } 644 HSubgraph* subgraph() const { return current_subgraph_; }
657 BreakAndContinueScope* break_scope() const { return break_scope_; } 645 BreakAndContinueScope* break_scope() const { return break_scope_; }
658 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } 646 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; }
659 647
660 HEnvironment* environment() const { return subgraph()->environment(); } 648 HBasicBlock* current_block() const { return subgraph()->exit_block(); }
661 HBasicBlock* CurrentBlock() const { return subgraph()->exit_block(); } 649 void set_current_block(HBasicBlock* block) {
650 subgraph()->set_exit_block(block);
651 }
652 HEnvironment* environment() const {
653 return current_block()->last_environment();
654 }
662 655
663 // Adding instructions. 656 // Adding instructions.
664 HInstruction* AddInstruction(HInstruction* instr); 657 HInstruction* AddInstruction(HInstruction* instr);
665 void AddSimulate(int id); 658 void AddSimulate(int id);
666 659
667 // Bailout environment manipulation. 660 // Bailout environment manipulation.
668 void Push(HValue* value) { environment()->Push(value); } 661 void Push(HValue* value) { environment()->Push(value); }
669 HValue* Pop() { return environment()->Pop(); } 662 HValue* Pop() { return environment()->Pop(); }
670 663
671 private: 664 private:
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 const char* filename_; 1090 const char* filename_;
1098 HeapStringAllocator string_allocator_; 1091 HeapStringAllocator string_allocator_;
1099 StringStream trace_; 1092 StringStream trace_;
1100 int indent_; 1093 int indent_;
1101 }; 1094 };
1102 1095
1103 1096
1104 } } // namespace v8::internal 1097 } } // namespace v8::internal
1105 1098
1106 #endif // V8_HYDROGEN_H_ 1099 #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