OLD | NEW |
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/crankshaft/hydrogen-escape-analysis.h" | 5 #include "src/crankshaft/hydrogen-escape-analysis.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 | 9 |
10 | 10 |
(...skipping 124 matching lines...) Loading... |
135 mapcheck->maps()->at(0), false); | 135 mapcheck->maps()->at(0), false); |
136 check->InsertBefore(mapcheck); | 136 check->InsertBefore(mapcheck); |
137 return check; | 137 return check; |
138 } | 138 } |
139 | 139 |
140 | 140 |
141 // Replace a field load with a given value, forcing Smi representation if | 141 // Replace a field load with a given value, forcing Smi representation if |
142 // necessary. | 142 // necessary. |
143 HValue* HEscapeAnalysisPhase::NewLoadReplacement( | 143 HValue* HEscapeAnalysisPhase::NewLoadReplacement( |
144 HLoadNamedField* load, HValue* load_value) { | 144 HLoadNamedField* load, HValue* load_value) { |
| 145 isolate()->counters()->crankshaft_escape_loads_replaced()->Increment(); |
145 HValue* replacement = load_value; | 146 HValue* replacement = load_value; |
146 Representation representation = load->representation(); | 147 Representation representation = load->representation(); |
147 if (representation.IsSmiOrInteger32() || representation.IsDouble()) { | 148 if (representation.IsSmiOrInteger32() || representation.IsDouble()) { |
148 Zone* zone = graph()->zone(); | 149 Zone* zone = graph()->zone(); |
149 HInstruction* new_instr = HForceRepresentation::New( | 150 HInstruction* new_instr = HForceRepresentation::New( |
150 graph()->isolate(), zone, NULL, load_value, representation); | 151 graph()->isolate(), zone, NULL, load_value, representation); |
151 new_instr->InsertAfter(load); | 152 new_instr->InsertAfter(load); |
152 replacement = new_instr; | 153 replacement = new_instr; |
153 } | 154 } |
154 return replacement; | 155 return replacement; |
(...skipping 157 matching lines...) Loading... |
312 | 313 |
313 | 314 |
314 void HEscapeAnalysisPhase::Run() { | 315 void HEscapeAnalysisPhase::Run() { |
315 // TODO(mstarzinger): We disable escape analysis with OSR for now, because | 316 // TODO(mstarzinger): We disable escape analysis with OSR for now, because |
316 // spill slots might be uninitialized. Needs investigation. | 317 // spill slots might be uninitialized. Needs investigation. |
317 if (graph()->has_osr()) return; | 318 if (graph()->has_osr()) return; |
318 int max_fixpoint_iteration_count = FLAG_escape_analysis_iterations; | 319 int max_fixpoint_iteration_count = FLAG_escape_analysis_iterations; |
319 for (int i = 0; i < max_fixpoint_iteration_count; i++) { | 320 for (int i = 0; i < max_fixpoint_iteration_count; i++) { |
320 CollectCapturedValues(); | 321 CollectCapturedValues(); |
321 if (captured_.is_empty()) break; | 322 if (captured_.is_empty()) break; |
| 323 isolate()->counters()->crankshaft_escape_allocs_replaced()->Increment( |
| 324 captured_.length()); |
322 PerformScalarReplacement(); | 325 PerformScalarReplacement(); |
323 captured_.Rewind(0); | 326 captured_.Rewind(0); |
324 } | 327 } |
325 } | 328 } |
326 | 329 |
327 | 330 |
328 } // namespace internal | 331 } // namespace internal |
329 } // namespace v8 | 332 } // namespace v8 |
OLD | NEW |