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

Side by Side Diff: src/hydrogen.h

Issue 17568015: New array bounds check elimination pass (focused on induction variables and bitwise operations). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Switched flag to false by default. Created 7 years, 5 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/flag-definitions.h ('k') | 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 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 int block_id() const { return block_id_; } 62 int block_id() const { return block_id_; }
63 void set_block_id(int id) { block_id_ = id; } 63 void set_block_id(int id) { block_id_ = id; }
64 HGraph* graph() const { return graph_; } 64 HGraph* graph() const { return graph_; }
65 Isolate* isolate() const; 65 Isolate* isolate() const;
66 const ZoneList<HPhi*>* phis() const { return &phis_; } 66 const ZoneList<HPhi*>* phis() const { return &phis_; }
67 HInstruction* first() const { return first_; } 67 HInstruction* first() const { return first_; }
68 HInstruction* last() const { return last_; } 68 HInstruction* last() const { return last_; }
69 void set_last(HInstruction* instr) { last_ = instr; } 69 void set_last(HInstruction* instr) { last_ = instr; }
70 HControlInstruction* end() const { return end_; } 70 HControlInstruction* end() const { return end_; }
71 HLoopInformation* loop_information() const { return loop_information_; } 71 HLoopInformation* loop_information() const { return loop_information_; }
72 HLoopInformation* current_loop() const {
73 return IsLoopHeader() ? loop_information()
74 : (parent_loop_header() != NULL
75 ? parent_loop_header()->loop_information() : NULL);
76 }
72 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } 77 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; }
73 bool HasPredecessor() const { return predecessors_.length() > 0; } 78 bool HasPredecessor() const { return predecessors_.length() > 0; }
74 const ZoneList<HBasicBlock*>* dominated_blocks() const { 79 const ZoneList<HBasicBlock*>* dominated_blocks() const {
75 return &dominated_blocks_; 80 return &dominated_blocks_;
76 } 81 }
77 const ZoneList<int>* deleted_phis() const { 82 const ZoneList<int>* deleted_phis() const {
78 return &deleted_phis_; 83 return &deleted_phis_;
79 } 84 }
80 void RecordDeletedPhi(int merge_index) { 85 void RecordDeletedPhi(int merge_index) {
81 deleted_phis_.Add(merge_index, zone()); 86 deleted_phis_.Add(merge_index, zone());
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } 269 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
265 HBasicBlock* loop_header() const { return loop_header_; } 270 HBasicBlock* loop_header() const { return loop_header_; }
266 HBasicBlock* GetLastBackEdge() const; 271 HBasicBlock* GetLastBackEdge() const;
267 void RegisterBackEdge(HBasicBlock* block); 272 void RegisterBackEdge(HBasicBlock* block);
268 273
269 HStackCheck* stack_check() const { return stack_check_; } 274 HStackCheck* stack_check() const { return stack_check_; }
270 void set_stack_check(HStackCheck* stack_check) { 275 void set_stack_check(HStackCheck* stack_check) {
271 stack_check_ = stack_check; 276 stack_check_ = stack_check;
272 } 277 }
273 278
279 bool IsNestedInThisLoop(HLoopInformation* other) {
280 while (other != NULL) {
281 if (other == this) {
282 return true;
283 }
284 other = other->parent_loop();
285 }
286 return false;
287 }
288 HLoopInformation* parent_loop() {
289 HBasicBlock* parent_header = loop_header()->parent_loop_header();
290 return parent_header != NULL ? parent_header->loop_information() : NULL;
291 }
292
274 private: 293 private:
275 void AddBlock(HBasicBlock* block); 294 void AddBlock(HBasicBlock* block);
276 295
277 ZoneList<HBasicBlock*> back_edges_; 296 ZoneList<HBasicBlock*> back_edges_;
278 HBasicBlock* loop_header_; 297 HBasicBlock* loop_header_;
279 ZoneList<HBasicBlock*> blocks_; 298 ZoneList<HBasicBlock*> blocks_;
280 HStackCheck* stack_check_; 299 HStackCheck* stack_check_;
281 }; 300 };
282 301
283 302
284 class BoundsCheckTable; 303 class BoundsCheckTable;
304 class InductionVariableBlocksTable;
285 class HGraph: public ZoneObject { 305 class HGraph: public ZoneObject {
286 public: 306 public:
287 explicit HGraph(CompilationInfo* info); 307 explicit HGraph(CompilationInfo* info);
288 308
289 Isolate* isolate() const { return isolate_; } 309 Isolate* isolate() const { return isolate_; }
290 Zone* zone() const { return zone_; } 310 Zone* zone() const { return zone_; }
291 CompilationInfo* info() const { return info_; } 311 CompilationInfo* info() const { return info_; }
292 312
293 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } 313 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
294 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } 314 const ZoneList<HPhi*>* phi_list() const { return phi_list_; }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 template<class Phase> 461 template<class Phase>
442 void Run() { 462 void Run() {
443 Phase phase(this); 463 Phase phase(this);
444 phase.Run(); 464 phase.Run();
445 } 465 }
446 466
447 void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi); 467 void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi);
448 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); 468 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor);
449 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); 469 void SetupInformativeDefinitionsInBlock(HBasicBlock* block);
450 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); 470 void SetupInformativeDefinitionsRecursively(HBasicBlock* block);
471 void EliminateRedundantBoundsChecksUsingInductionVariables();
451 472
452 Isolate* isolate_; 473 Isolate* isolate_;
453 int next_block_id_; 474 int next_block_id_;
454 HBasicBlock* entry_block_; 475 HBasicBlock* entry_block_;
455 HEnvironment* start_environment_; 476 HEnvironment* start_environment_;
456 ZoneList<HBasicBlock*> blocks_; 477 ZoneList<HBasicBlock*> blocks_;
457 ZoneList<HValue*> values_; 478 ZoneList<HValue*> values_;
458 ZoneList<HPhi*>* phi_list_; 479 ZoneList<HPhi*>* phi_list_;
459 ZoneList<HInstruction*>* uint32_instructions_; 480 ZoneList<HInstruction*>* uint32_instructions_;
460 SetOncePointer<HConstant> undefined_constant_; 481 SetOncePointer<HConstant> undefined_constant_;
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 EmbeddedVector<char, 64> filename_; 2164 EmbeddedVector<char, 64> filename_;
2144 HeapStringAllocator string_allocator_; 2165 HeapStringAllocator string_allocator_;
2145 StringStream trace_; 2166 StringStream trace_;
2146 int indent_; 2167 int indent_;
2147 }; 2168 };
2148 2169
2149 2170
2150 } } // namespace v8::internal 2171 } } // namespace v8::internal
2151 2172
2152 #endif // V8_HYDROGEN_H_ 2173 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698