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

Side by Side Diff: src/hydrogen-escape-analysis.cc

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 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/hydrogen-environment-liveness.cc ('k') | src/hydrogen-flow-engine.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-escape-analysis.h" 5 #include "src/hydrogen-escape-analysis.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 9
10 10
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 switch (instr->opcode()) { 182 switch (instr->opcode()) {
183 case HValue::kAllocate: { 183 case HValue::kAllocate: {
184 if (instr != allocate) continue; 184 if (instr != allocate) continue;
185 state = NewStateForAllocation(allocate); 185 state = NewStateForAllocation(allocate);
186 break; 186 break;
187 } 187 }
188 case HValue::kLoadNamedField: { 188 case HValue::kLoadNamedField: {
189 HLoadNamedField* load = HLoadNamedField::cast(instr); 189 HLoadNamedField* load = HLoadNamedField::cast(instr);
190 int index = load->access().offset() / kPointerSize; 190 int index = load->access().offset() / kPointerSize;
191 if (load->object() != allocate) continue; 191 if (load->object() != allocate) continue;
192 ASSERT(load->access().IsInobject()); 192 DCHECK(load->access().IsInobject());
193 HValue* replacement = 193 HValue* replacement =
194 NewLoadReplacement(load, state->OperandAt(index)); 194 NewLoadReplacement(load, state->OperandAt(index));
195 load->DeleteAndReplaceWith(replacement); 195 load->DeleteAndReplaceWith(replacement);
196 if (FLAG_trace_escape_analysis) { 196 if (FLAG_trace_escape_analysis) {
197 PrintF("Replacing load #%d with #%d (%s)\n", load->id(), 197 PrintF("Replacing load #%d with #%d (%s)\n", load->id(),
198 replacement->id(), replacement->Mnemonic()); 198 replacement->id(), replacement->Mnemonic());
199 } 199 }
200 break; 200 break;
201 } 201 }
202 case HValue::kStoreNamedField: { 202 case HValue::kStoreNamedField: {
203 HStoreNamedField* store = HStoreNamedField::cast(instr); 203 HStoreNamedField* store = HStoreNamedField::cast(instr);
204 int index = store->access().offset() / kPointerSize; 204 int index = store->access().offset() / kPointerSize;
205 if (store->object() != allocate) continue; 205 if (store->object() != allocate) continue;
206 ASSERT(store->access().IsInobject()); 206 DCHECK(store->access().IsInobject());
207 state = NewStateCopy(store->previous(), state); 207 state = NewStateCopy(store->previous(), state);
208 state->SetOperandAt(index, store->value()); 208 state->SetOperandAt(index, store->value());
209 if (store->has_transition()) { 209 if (store->has_transition()) {
210 state->SetOperandAt(0, store->transition()); 210 state->SetOperandAt(0, store->transition());
211 } 211 }
212 if (store->HasObservableSideEffects()) { 212 if (store->HasObservableSideEffects()) {
213 state->ReuseSideEffectsFromStore(store); 213 state->ReuseSideEffectsFromStore(store);
214 } 214 }
215 store->DeleteAndReplaceWith(store->ActualValue()); 215 store->DeleteAndReplaceWith(store->ActualValue());
216 if (FLAG_trace_escape_analysis) { 216 if (FLAG_trace_escape_analysis) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 HPhi* phi = NewPhiAndInsert(succ, succ_operand, index); 279 HPhi* phi = NewPhiAndInsert(succ, succ_operand, index);
280 phi->SetOperandAt(succ->PredecessorIndexOf(block), operand); 280 phi->SetOperandAt(succ->PredecessorIndexOf(block), operand);
281 succ_state->SetOperandAt(index, phi); 281 succ_state->SetOperandAt(index, phi);
282 } 282 }
283 } 283 }
284 } 284 }
285 } 285 }
286 } 286 }
287 287
288 // All uses have been handled. 288 // All uses have been handled.
289 ASSERT(allocate->HasNoUses()); 289 DCHECK(allocate->HasNoUses());
290 allocate->DeleteAndReplaceWith(NULL); 290 allocate->DeleteAndReplaceWith(NULL);
291 } 291 }
292 292
293 293
294 void HEscapeAnalysisPhase::PerformScalarReplacement() { 294 void HEscapeAnalysisPhase::PerformScalarReplacement() {
295 for (int i = 0; i < captured_.length(); i++) { 295 for (int i = 0; i < captured_.length(); i++) {
296 HAllocate* allocate = HAllocate::cast(captured_.at(i)); 296 HAllocate* allocate = HAllocate::cast(captured_.at(i));
297 297
298 // Compute number of scalar values and start with clean slate. 298 // Compute number of scalar values and start with clean slate.
299 int size_in_bytes = allocate->size()->GetInteger32Constant(); 299 int size_in_bytes = allocate->size()->GetInteger32Constant();
300 number_of_values_ = size_in_bytes / kPointerSize; 300 number_of_values_ = size_in_bytes / kPointerSize;
301 number_of_objects_++; 301 number_of_objects_++;
302 block_states_.Rewind(0); 302 block_states_.Rewind(0);
303 303
304 // Perform actual analysis step. 304 // Perform actual analysis step.
305 AnalyzeDataFlow(allocate); 305 AnalyzeDataFlow(allocate);
306 306
307 cumulative_values_ += number_of_values_; 307 cumulative_values_ += number_of_values_;
308 ASSERT(allocate->HasNoUses()); 308 DCHECK(allocate->HasNoUses());
309 ASSERT(!allocate->IsLinked()); 309 DCHECK(!allocate->IsLinked());
310 } 310 }
311 } 311 }
312 312
313 313
314 void HEscapeAnalysisPhase::Run() { 314 void HEscapeAnalysisPhase::Run() {
315 // TODO(mstarzinger): We disable escape analysis with OSR for now, because 315 // TODO(mstarzinger): We disable escape analysis with OSR for now, because
316 // spill slots might be uninitialized. Needs investigation. 316 // spill slots might be uninitialized. Needs investigation.
317 if (graph()->has_osr()) return; 317 if (graph()->has_osr()) return;
318 int max_fixpoint_iteration_count = FLAG_escape_analysis_iterations; 318 int max_fixpoint_iteration_count = FLAG_escape_analysis_iterations;
319 for (int i = 0; i < max_fixpoint_iteration_count; i++) { 319 for (int i = 0; i < max_fixpoint_iteration_count; i++) {
320 CollectCapturedValues(); 320 CollectCapturedValues();
321 if (captured_.is_empty()) break; 321 if (captured_.is_empty()) break;
322 PerformScalarReplacement(); 322 PerformScalarReplacement();
323 captured_.Rewind(0); 323 captured_.Rewind(0);
324 } 324 }
325 } 325 }
326 326
327 327
328 } } // namespace v8::internal 328 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-environment-liveness.cc ('k') | src/hydrogen-flow-engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698