| 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/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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 // Insert a newly created value check as a replacement for map checks. | 127 // Insert a newly created value check as a replacement for map checks. |
| 128 HValue* HEscapeAnalysisPhase::NewMapCheckAndInsert(HCapturedObject* state, | 128 HValue* HEscapeAnalysisPhase::NewMapCheckAndInsert(HCapturedObject* state, |
| 129 HCheckMaps* mapcheck) { | 129 HCheckMaps* mapcheck) { |
| 130 Zone* zone = graph()->zone(); | 130 Zone* zone = graph()->zone(); |
| 131 HValue* value = state->map_value(); | 131 HValue* value = state->map_value(); |
| 132 // TODO(mstarzinger): This will narrow a map check against a set of maps | 132 // TODO(mstarzinger): This will narrow a map check against a set of maps |
| 133 // down to the first element in the set. Revisit and fix this. | 133 // down to the first element in the set. Revisit and fix this. |
| 134 HCheckValue* check = HCheckValue::New( | 134 HCheckValue* check = HCheckValue::New(graph()->isolate(), zone, NULL, value, |
| 135 zone, NULL, value, 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 HValue* replacement = load_value; | 145 HValue* replacement = load_value; |
| 146 Representation representation = load->representation(); | 146 Representation representation = load->representation(); |
| 147 if (representation.IsSmiOrInteger32() || representation.IsDouble()) { | 147 if (representation.IsSmiOrInteger32() || representation.IsDouble()) { |
| 148 Zone* zone = graph()->zone(); | 148 Zone* zone = graph()->zone(); |
| 149 HInstruction* new_instr = | 149 HInstruction* new_instr = HForceRepresentation::New( |
| 150 HForceRepresentation::New(zone, NULL, load_value, representation); | 150 graph()->isolate(), zone, NULL, load_value, representation); |
| 151 new_instr->InsertAfter(load); | 151 new_instr->InsertAfter(load); |
| 152 replacement = new_instr; | 152 replacement = new_instr; |
| 153 } | 153 } |
| 154 return replacement; | 154 return replacement; |
| 155 } | 155 } |
| 156 | 156 |
| 157 | 157 |
| 158 // Performs a forward data-flow analysis of all loads and stores on the | 158 // Performs a forward data-flow analysis of all loads and stores on the |
| 159 // given captured allocation. This uses a reverse post-order iteration | 159 // given captured allocation. This uses a reverse post-order iteration |
| 160 // over affected basic blocks. All non-escaping instructions are handled | 160 // over affected basic blocks. All non-escaping instructions are handled |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |