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

Side by Side Diff: src/hydrogen-load-elimination.cc

Issue 336483002: remove this == null (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/heap.cc ('k') | src/spaces.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/hydrogen-alias-analysis.h" 5 #include "src/hydrogen-alias-analysis.h"
6 #include "src/hydrogen-load-elimination.h" 6 #include "src/hydrogen-load-elimination.h"
7 #include "src/hydrogen-instructions.h" 7 #include "src/hydrogen-instructions.h"
8 #include "src/hydrogen-flow-engine.h" 8 #include "src/hydrogen-flow-engine.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 #define GLOBAL true 13 #define GLOBAL true
14 #define TRACE(x) if (FLAG_trace_load_elimination) PrintF x 14 #define TRACE(x) if (FLAG_trace_load_elimination) PrintF x
15 15
16 static const int kMaxTrackedFields = 16; 16 static const int kMaxTrackedFields = 16;
17 static const int kMaxTrackedObjects = 5; 17 static const int kMaxTrackedObjects = 5;
18 18
19 // An element in the field approximation list. 19 // An element in the field approximation list.
20 class HFieldApproximation : public ZoneObject { 20 class HFieldApproximation : public ZoneObject {
21 public: // Just a data blob. 21 public: // Just a data blob.
22 HValue* object_; 22 HValue* object_;
23 HValue* last_value_; 23 HValue* last_value_;
24 HFieldApproximation* next_; 24 HFieldApproximation* next_;
25 25
26 // Recursively copy the entire linked list of field approximations. 26 // Recursively copy the entire linked list of field approximations.
27 HFieldApproximation* Copy(Zone* zone) { 27 HFieldApproximation* Copy(Zone* zone) {
28 if (this == NULL) return NULL;
29 HFieldApproximation* copy = new(zone) HFieldApproximation(); 28 HFieldApproximation* copy = new(zone) HFieldApproximation();
30 copy->object_ = this->object_; 29 copy->object_ = this->object_;
31 copy->last_value_ = this->last_value_; 30 copy->last_value_ = this->last_value_;
32 copy->next_ = this->next_->Copy(zone); 31 copy->next_ = this->next_ == NULL ? NULL : this->next_->Copy(zone);
33 return copy; 32 return copy;
34 } 33 }
35 }; 34 };
36 35
37 36
38 // The main datastructure used during load/store elimination. Each in-object 37 // The main datastructure used during load/store elimination. Each in-object
39 // field is tracked separately. For each field, store a list of known field 38 // field is tracked separately. For each field, store a list of known field
40 // values for known objects. 39 // values for known objects.
41 class HLoadEliminationTable : public ZoneObject { 40 class HLoadEliminationTable : public ZoneObject {
42 public: 41 public:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 140 }
142 141
143 private: 142 private:
144 // Copy state to successor block. 143 // Copy state to successor block.
145 HLoadEliminationTable* Copy(HBasicBlock* succ, HBasicBlock* from_block, 144 HLoadEliminationTable* Copy(HBasicBlock* succ, HBasicBlock* from_block,
146 Zone* zone) { 145 Zone* zone) {
147 HLoadEliminationTable* copy = 146 HLoadEliminationTable* copy =
148 new(zone) HLoadEliminationTable(zone, aliasing_); 147 new(zone) HLoadEliminationTable(zone, aliasing_);
149 copy->EnsureFields(fields_.length()); 148 copy->EnsureFields(fields_.length());
150 for (int i = 0; i < fields_.length(); i++) { 149 for (int i = 0; i < fields_.length(); i++) {
151 copy->fields_[i] = fields_[i]->Copy(zone); 150 copy->fields_[i] = fields_[i] == NULL ? NULL : fields_[i]->Copy(zone);
152 } 151 }
153 if (FLAG_trace_load_elimination) { 152 if (FLAG_trace_load_elimination) {
154 TRACE((" copy-to B%d\n", succ->block_id())); 153 TRACE((" copy-to B%d\n", succ->block_id()));
155 copy->Print(); 154 copy->Print();
156 } 155 }
157 return copy; 156 return copy;
158 } 157 }
159 158
160 // Merge this state with the other incoming state. 159 // Merge this state with the other incoming state.
161 HLoadEliminationTable* Merge(HBasicBlock* succ, HLoadEliminationTable* that, 160 HLoadEliminationTable* Merge(HBasicBlock* succ, HLoadEliminationTable* that,
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 } else { 502 } else {
504 // Perform only local analysis. 503 // Perform only local analysis.
505 for (int i = 0; i < graph()->blocks()->length(); i++) { 504 for (int i = 0; i < graph()->blocks()->length(); i++) {
506 table->Kill(); 505 table->Kill();
507 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table); 506 engine.AnalyzeOneBlock(graph()->blocks()->at(i), table);
508 } 507 }
509 } 508 }
510 } 509 }
511 510
512 } } // namespace v8::internal 511 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698