Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 case HValue::kAllocate: { | 189 case HValue::kAllocate: { |
| 190 if (instr != allocate) continue; | 190 if (instr != allocate) continue; |
| 191 state = NewStateForAllocation(allocate); | 191 state = NewStateForAllocation(allocate); |
| 192 break; | 192 break; |
| 193 } | 193 } |
| 194 case HValue::kLoadNamedField: { | 194 case HValue::kLoadNamedField: { |
| 195 HLoadNamedField* load = HLoadNamedField::cast(instr); | 195 HLoadNamedField* load = HLoadNamedField::cast(instr); |
| 196 int index = load->access().offset() / kPointerSize; | 196 int index = load->access().offset() / kPointerSize; |
| 197 if (load->object() != allocate) continue; | 197 if (load->object() != allocate) continue; |
| 198 ASSERT(load->access().IsInobject()); | 198 ASSERT(load->access().IsInobject()); |
| 199 HValue* replacement = state->OperandAt(index); | 199 HValue* load_value = state->OperandAt(index); |
| 200 HValue* replacement = load_value; | |
| 201 Representation representation = load->representation(); | |
| 202 if (representation.IsSmi()) { | |
|
Michael Starzinger
2014/04/25 08:35:10
Can we factor this out into a NewLoadReplacement h
Jarin
2014/04/25 11:05:07
Done.
| |
| 203 Zone* zone = graph()->zone(); | |
| 204 HInstruction* new_instr = | |
| 205 new(zone) HForceRepresentation(load_value, representation); | |
| 206 new_instr->InsertAfter(load); | |
| 207 replacement = new_instr; | |
| 208 } | |
| 200 load->DeleteAndReplaceWith(replacement); | 209 load->DeleteAndReplaceWith(replacement); |
| 201 if (FLAG_trace_escape_analysis) { | 210 if (FLAG_trace_escape_analysis) { |
| 202 PrintF("Replacing load #%d with #%d (%s)\n", instr->id(), | 211 PrintF("Replacing load #%d with #%d (%s)\n", instr->id(), |
| 203 replacement->id(), replacement->Mnemonic()); | 212 load_value->id(), load_value->Mnemonic()); |
|
Michael Starzinger
2014/04/25 08:35:10
nit: The logging should print the actual replaceme
Jarin
2014/04/25 11:05:07
Done.
| |
| 204 } | 213 } |
| 205 break; | 214 break; |
| 206 } | 215 } |
| 207 case HValue::kStoreNamedField: { | 216 case HValue::kStoreNamedField: { |
| 208 HStoreNamedField* store = HStoreNamedField::cast(instr); | 217 HStoreNamedField* store = HStoreNamedField::cast(instr); |
| 209 int index = store->access().offset() / kPointerSize; | 218 int index = store->access().offset() / kPointerSize; |
| 210 if (store->object() != allocate) continue; | 219 if (store->object() != allocate) continue; |
| 211 ASSERT(store->access().IsInobject()); | 220 ASSERT(store->access().IsInobject()); |
| 212 state = NewStateCopy(store->previous(), state); | 221 state = NewStateCopy(store->previous(), state); |
| 213 state->SetOperandAt(index, store->value()); | 222 state->SetOperandAt(index, store->value()); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 for (int i = 0; i < max_fixpoint_iteration_count; i++) { | 333 for (int i = 0; i < max_fixpoint_iteration_count; i++) { |
| 325 CollectCapturedValues(); | 334 CollectCapturedValues(); |
| 326 if (captured_.is_empty()) break; | 335 if (captured_.is_empty()) break; |
| 327 PerformScalarReplacement(); | 336 PerformScalarReplacement(); |
| 328 captured_.Clear(); | 337 captured_.Clear(); |
| 329 } | 338 } |
| 330 } | 339 } |
| 331 | 340 |
| 332 | 341 |
| 333 } } // namespace v8::internal | 342 } } // namespace v8::internal |
| OLD | NEW |