Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 int block_id() const { return block_id_; } | 61 int block_id() const { return block_id_; } |
| 62 void set_block_id(int id) { block_id_ = id; } | 62 void set_block_id(int id) { block_id_ = id; } |
| 63 HGraph* graph() const { return graph_; } | 63 HGraph* graph() const { return graph_; } |
| 64 Isolate* isolate() const; | 64 Isolate* isolate() const; |
| 65 const ZoneList<HPhi*>* phis() const { return &phis_; } | 65 const ZoneList<HPhi*>* phis() const { return &phis_; } |
| 66 HInstruction* first() const { return first_; } | 66 HInstruction* first() const { return first_; } |
| 67 HInstruction* last() const { return last_; } | 67 HInstruction* last() const { return last_; } |
| 68 void set_last(HInstruction* instr) { last_ = instr; } | 68 void set_last(HInstruction* instr) { last_ = instr; } |
| 69 HControlInstruction* end() const { return end_; } | 69 HControlInstruction* end() const { return end_; } |
| 70 HLoopInformation* loop_information() const { return loop_information_; } | 70 HLoopInformation* loop_information() const { return loop_information_; } |
| 71 HLoopInformation* current_loop() const { | |
| 72 return IsLoopHeader() ? loop_information() | |
| 73 : (parent_loop_header() != NULL | |
| 74 ? parent_loop_header()->loop_information() : NULL); | |
| 75 } | |
| 71 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } | 76 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } |
| 72 bool HasPredecessor() const { return predecessors_.length() > 0; } | 77 bool HasPredecessor() const { return predecessors_.length() > 0; } |
| 73 const ZoneList<HBasicBlock*>* dominated_blocks() const { | 78 const ZoneList<HBasicBlock*>* dominated_blocks() const { |
| 74 return &dominated_blocks_; | 79 return &dominated_blocks_; |
| 75 } | 80 } |
| 76 const ZoneList<int>* deleted_phis() const { | 81 const ZoneList<int>* deleted_phis() const { |
| 77 return &deleted_phis_; | 82 return &deleted_phis_; |
| 78 } | 83 } |
| 79 void RecordDeletedPhi(int merge_index) { | 84 void RecordDeletedPhi(int merge_index) { |
| 80 deleted_phis_.Add(merge_index, zone()); | 85 deleted_phis_.Add(merge_index, zone()); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 249 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| 245 HBasicBlock* loop_header() const { return loop_header_; } | 250 HBasicBlock* loop_header() const { return loop_header_; } |
| 246 HBasicBlock* GetLastBackEdge() const; | 251 HBasicBlock* GetLastBackEdge() const; |
| 247 void RegisterBackEdge(HBasicBlock* block); | 252 void RegisterBackEdge(HBasicBlock* block); |
| 248 | 253 |
| 249 HStackCheck* stack_check() const { return stack_check_; } | 254 HStackCheck* stack_check() const { return stack_check_; } |
| 250 void set_stack_check(HStackCheck* stack_check) { | 255 void set_stack_check(HStackCheck* stack_check) { |
| 251 stack_check_ = stack_check; | 256 stack_check_ = stack_check; |
| 252 } | 257 } |
| 253 | 258 |
| 259 bool IsNestedInThisLoop(HLoopInformation* other) { | |
| 260 while (other != NULL) { | |
| 261 if (other == this) { | |
| 262 return true; | |
| 263 } | |
| 264 other = other->parent_loop(); | |
| 265 } | |
| 266 return false; | |
| 267 } | |
| 268 bool IsNestedInThisLoop(HBasicBlock* other_block) { | |
|
titzer
2013/06/24 14:03:30
This method overloading is just for convenience; I
Massi
2013/07/01 13:10:49
Removed and inlined.
| |
| 269 return IsNestedInThisLoop(other_block->current_loop()); | |
| 270 } | |
| 271 HLoopInformation* parent_loop() { | |
| 272 HBasicBlock* parent_header = loop_header()->parent_loop_header(); | |
| 273 return parent_header != NULL ? parent_header->loop_information() : NULL; | |
| 274 } | |
| 275 | |
| 254 private: | 276 private: |
| 255 void AddBlock(HBasicBlock* block); | 277 void AddBlock(HBasicBlock* block); |
| 256 | 278 |
| 257 ZoneList<HBasicBlock*> back_edges_; | 279 ZoneList<HBasicBlock*> back_edges_; |
| 258 HBasicBlock* loop_header_; | 280 HBasicBlock* loop_header_; |
| 259 ZoneList<HBasicBlock*> blocks_; | 281 ZoneList<HBasicBlock*> blocks_; |
| 260 HStackCheck* stack_check_; | 282 HStackCheck* stack_check_; |
| 261 }; | 283 }; |
| 262 | 284 |
| 263 | 285 |
| 264 class BoundsCheckTable; | 286 class BoundsCheckTable; |
| 287 class InductionVariableBlocksTable; | |
| 265 class HGraph: public ZoneObject { | 288 class HGraph: public ZoneObject { |
| 266 public: | 289 public: |
| 267 explicit HGraph(CompilationInfo* info); | 290 explicit HGraph(CompilationInfo* info); |
| 268 | 291 |
| 269 Isolate* isolate() const { return isolate_; } | 292 Isolate* isolate() const { return isolate_; } |
| 270 Zone* zone() const { return zone_; } | 293 Zone* zone() const { return zone_; } |
| 271 CompilationInfo* info() const { return info_; } | 294 CompilationInfo* info() const { return info_; } |
| 272 | 295 |
| 273 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 296 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| 274 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } | 297 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 HValue* use_value, | 462 HValue* use_value, |
| 440 int use_index, | 463 int use_index, |
| 441 Representation to); | 464 Representation to); |
| 442 void InsertRepresentationChangesForValue(HValue* value); | 465 void InsertRepresentationChangesForValue(HValue* value); |
| 443 void InferTypes(ZoneList<HValue*>* worklist); | 466 void InferTypes(ZoneList<HValue*>* worklist); |
| 444 void InitializeInferredTypes(int from_inclusive, int to_inclusive); | 467 void InitializeInferredTypes(int from_inclusive, int to_inclusive); |
| 445 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); | 468 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); |
| 446 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); | 469 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); |
| 447 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); | 470 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); |
| 448 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); | 471 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); |
| 472 void EliminateRedundantBoundsChecksUsingInductionVariables(); | |
| 473 void CollectInductionVariableData(HBasicBlock* bb, | |
| 474 InductionVariableBlocksTable* table); | |
| 475 void EliminateRedundantBoundsChecksUsingInductionVariables( | |
| 476 HBasicBlock* bb, | |
| 477 InductionVariableBlocksTable* table); | |
| 449 | 478 |
| 450 Isolate* isolate_; | 479 Isolate* isolate_; |
| 451 int next_block_id_; | 480 int next_block_id_; |
| 452 HBasicBlock* entry_block_; | 481 HBasicBlock* entry_block_; |
| 453 HEnvironment* start_environment_; | 482 HEnvironment* start_environment_; |
| 454 ZoneList<HBasicBlock*> blocks_; | 483 ZoneList<HBasicBlock*> blocks_; |
| 455 ZoneList<HValue*> values_; | 484 ZoneList<HValue*> values_; |
| 456 ZoneList<HPhi*>* phi_list_; | 485 ZoneList<HPhi*>* phi_list_; |
| 457 ZoneList<HInstruction*>* uint32_instructions_; | 486 ZoneList<HInstruction*>* uint32_instructions_; |
| 458 SetOncePointer<HConstant> undefined_constant_; | 487 SetOncePointer<HConstant> undefined_constant_; |
| (...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2038 EmbeddedVector<char, 64> filename_; | 2067 EmbeddedVector<char, 64> filename_; |
| 2039 HeapStringAllocator string_allocator_; | 2068 HeapStringAllocator string_allocator_; |
| 2040 StringStream trace_; | 2069 StringStream trace_; |
| 2041 int indent_; | 2070 int indent_; |
| 2042 }; | 2071 }; |
| 2043 | 2072 |
| 2044 | 2073 |
| 2045 } } // namespace v8::internal | 2074 } } // namespace v8::internal |
| 2046 | 2075 |
| 2047 #endif // V8_HYDROGEN_H_ | 2076 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |