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

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: Addressed review comments. 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
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 HLoopInformation* parent_loop() {
269 HBasicBlock* parent_header = loop_header()->parent_loop_header();
270 return parent_header != NULL ? parent_header->loop_information() : NULL;
271 }
272
254 private: 273 private:
255 void AddBlock(HBasicBlock* block); 274 void AddBlock(HBasicBlock* block);
256 275
257 ZoneList<HBasicBlock*> back_edges_; 276 ZoneList<HBasicBlock*> back_edges_;
258 HBasicBlock* loop_header_; 277 HBasicBlock* loop_header_;
259 ZoneList<HBasicBlock*> blocks_; 278 ZoneList<HBasicBlock*> blocks_;
260 HStackCheck* stack_check_; 279 HStackCheck* stack_check_;
261 }; 280 };
262 281
263 282
264 class BoundsCheckTable; 283 class BoundsCheckTable;
284 class InductionVariableBlocksTable;
265 class HGraph: public ZoneObject { 285 class HGraph: public ZoneObject {
266 public: 286 public:
267 explicit HGraph(CompilationInfo* info); 287 explicit HGraph(CompilationInfo* info);
268 288
269 Isolate* isolate() const { return isolate_; } 289 Isolate* isolate() const { return isolate_; }
270 Zone* zone() const { return zone_; } 290 Zone* zone() const { return zone_; }
271 CompilationInfo* info() const { return info_; } 291 CompilationInfo* info() const { return info_; }
272 292
273 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } 293 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
274 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } 294 const ZoneList<HPhi*>* phi_list() const { return phi_list_; }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 HValue* use_value, 459 HValue* use_value,
440 int use_index, 460 int use_index,
441 Representation to); 461 Representation to);
442 void InsertRepresentationChangesForValue(HValue* value); 462 void InsertRepresentationChangesForValue(HValue* value);
443 void InferTypes(ZoneList<HValue*>* worklist); 463 void InferTypes(ZoneList<HValue*>* worklist);
444 void InitializeInferredTypes(int from_inclusive, int to_inclusive); 464 void InitializeInferredTypes(int from_inclusive, int to_inclusive);
445 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); 465 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor);
446 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); 466 void SetupInformativeDefinitionsInBlock(HBasicBlock* block);
447 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); 467 void SetupInformativeDefinitionsRecursively(HBasicBlock* block);
448 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table); 468 void EliminateRedundantBoundsChecks(HBasicBlock* bb, BoundsCheckTable* table);
469 void EliminateRedundantBoundsChecksUsingInductionVariables();
470 void CollectInductionVariableData(HBasicBlock* bb,
titzer 2013/07/02 13:45:06 I think you can move two of these methods to live
471 InductionVariableBlocksTable* table);
472 void EliminateRedundantBoundsChecksUsingInductionVariables(
473 HBasicBlock* bb,
474 InductionVariableBlocksTable* table);
475 void NewJoke();
titzer 2013/07/02 13:45:06 Was ist das?
Massi 2013/07/08 11:55:07 Debugging leftover :-)
449 476
450 Isolate* isolate_; 477 Isolate* isolate_;
451 int next_block_id_; 478 int next_block_id_;
452 HBasicBlock* entry_block_; 479 HBasicBlock* entry_block_;
453 HEnvironment* start_environment_; 480 HEnvironment* start_environment_;
454 ZoneList<HBasicBlock*> blocks_; 481 ZoneList<HBasicBlock*> blocks_;
455 ZoneList<HValue*> values_; 482 ZoneList<HValue*> values_;
456 ZoneList<HPhi*>* phi_list_; 483 ZoneList<HPhi*>* phi_list_;
457 ZoneList<HInstruction*>* uint32_instructions_; 484 ZoneList<HInstruction*>* uint32_instructions_;
458 SetOncePointer<HConstant> undefined_constant_; 485 SetOncePointer<HConstant> undefined_constant_;
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 EmbeddedVector<char, 64> filename_; 2065 EmbeddedVector<char, 64> filename_;
2039 HeapStringAllocator string_allocator_; 2066 HeapStringAllocator string_allocator_;
2040 StringStream trace_; 2067 StringStream trace_;
2041 int indent_; 2068 int indent_;
2042 }; 2069 };
2043 2070
2044 2071
2045 } } // namespace v8::internal 2072 } } // namespace v8::internal
2046 2073
2047 #endif // V8_HYDROGEN_H_ 2074 #endif // V8_HYDROGEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698