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

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

Issue 151163005: A64: Synchronize with r16356. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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-escape-analysis.h ('k') | src/hydrogen-instructions.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 // 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (instr->IsAllocate()) { 58 if (instr->IsAllocate()) {
59 CollectIfNoEscapingUses(instr); 59 CollectIfNoEscapingUses(instr);
60 } 60 }
61 } 61 }
62 } 62 }
63 } 63 }
64 64
65 65
66 HCapturedObject* HEscapeAnalysisPhase::NewState(HInstruction* previous) { 66 HCapturedObject* HEscapeAnalysisPhase::NewState(HInstruction* previous) {
67 Zone* zone = graph()->zone(); 67 Zone* zone = graph()->zone();
68 HCapturedObject* state = new(zone) HCapturedObject(number_of_values_, zone); 68 HCapturedObject* state =
69 new(zone) HCapturedObject(number_of_values_, number_of_objects_, zone);
69 state->InsertAfter(previous); 70 state->InsertAfter(previous);
70 return state; 71 return state;
71 } 72 }
72 73
73 74
74 // Create a new state for replacing HAllocate instructions. 75 // Create a new state for replacing HAllocate instructions.
75 HCapturedObject* HEscapeAnalysisPhase::NewStateForAllocation( 76 HCapturedObject* HEscapeAnalysisPhase::NewStateForAllocation(
76 HInstruction* previous) { 77 HInstruction* previous) {
77 HConstant* undefined = graph()->GetConstantUndefined(); 78 HConstant* undefined = graph()->GetConstantUndefined();
78 HCapturedObject* state = NewState(previous); 79 HCapturedObject* state = NewState(previous);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (store->has_transition()) { 177 if (store->has_transition()) {
177 state->SetOperandAt(0, store->transition()); 178 state->SetOperandAt(0, store->transition());
178 } 179 }
179 store->DeleteAndReplaceWith(NULL); 180 store->DeleteAndReplaceWith(NULL);
180 if (FLAG_trace_escape_analysis) { 181 if (FLAG_trace_escape_analysis) {
181 PrintF("Replacing store #%d%s\n", instr->id(), 182 PrintF("Replacing store #%d%s\n", instr->id(),
182 store->has_transition() ? " (with transition)" : ""); 183 store->has_transition() ? " (with transition)" : "");
183 } 184 }
184 break; 185 break;
185 } 186 }
186 case HValue::kSimulate: {
187 HSimulate* simulate = HSimulate::cast(instr);
188 // TODO(mstarzinger): This doesn't track deltas for values on the
189 // operand stack yet. Find a repro test case and fix this.
190 for (int i = 0; i < simulate->OperandCount(); i++) {
191 if (simulate->OperandAt(i) != allocate) continue;
192 simulate->SetOperandAt(i, state);
193 }
194 break;
195 }
196 case HValue::kArgumentsObject: 187 case HValue::kArgumentsObject:
197 case HValue::kCapturedObject: { 188 case HValue::kCapturedObject:
189 case HValue::kSimulate: {
198 for (int i = 0; i < instr->OperandCount(); i++) { 190 for (int i = 0; i < instr->OperandCount(); i++) {
199 if (instr->OperandAt(i) != allocate) continue; 191 if (instr->OperandAt(i) != allocate) continue;
200 instr->SetOperandAt(i, state); 192 instr->SetOperandAt(i, state);
201 } 193 }
202 break; 194 break;
203 } 195 }
204 case HValue::kCheckHeapObject: { 196 case HValue::kCheckHeapObject: {
205 HCheckHeapObject* check = HCheckHeapObject::cast(instr); 197 HCheckHeapObject* check = HCheckHeapObject::cast(instr);
206 if (check->value() != allocate) continue; 198 if (check->value() != allocate) continue;
207 check->DeleteAndReplaceWith(NULL); 199 check->DeleteAndReplaceWith(NULL);
208 break; 200 break;
209 } 201 }
210 case HValue::kCheckMaps: { 202 case HValue::kCheckMaps: {
211 HCheckMaps* mapcheck = HCheckMaps::cast(instr); 203 HCheckMaps* mapcheck = HCheckMaps::cast(instr);
212 if (mapcheck->value() != allocate) continue; 204 if (mapcheck->value() != allocate) continue;
213 // TODO(mstarzinger): This approach breaks if the tracked map value 205 // TODO(mstarzinger): This approach breaks if the tracked map value
214 // is not a HConstant. Find a repro test case and fix this. 206 // is not a HConstant. Find a repro test case and fix this.
215 for (HUseIterator it(mapcheck->uses()); !it.Done(); it.Advance()) { 207 ASSERT(mapcheck->ActualValue() == allocate);
216 if (!it.value()->IsLoadNamedField()) continue; 208 mapcheck->DeleteAndReplaceWith(mapcheck->ActualValue());
217 HLoadNamedField* load = HLoadNamedField::cast(it.value());
218 ASSERT(load->typecheck() == mapcheck);
219 load->ClearTypeCheck();
220 }
221 ASSERT(mapcheck->HasNoUses());
222
223 mapcheck->DeleteAndReplaceWith(NULL);
224 break; 209 break;
225 } 210 }
226 default: 211 default:
227 // Nothing to see here, move along ... 212 // Nothing to see here, move along ...
228 break; 213 break;
229 } 214 }
230 } 215 }
231 216
232 // Propagate the block state forward to all successor blocks. 217 // Propagate the block state forward to all successor blocks.
233 for (int i = 0; i < block->end()->SuccessorCount(); i++) { 218 for (int i = 0; i < block->end()->SuccessorCount(); i++) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 259
275 260
276 void HEscapeAnalysisPhase::PerformScalarReplacement() { 261 void HEscapeAnalysisPhase::PerformScalarReplacement() {
277 for (int i = 0; i < captured_.length(); i++) { 262 for (int i = 0; i < captured_.length(); i++) {
278 HAllocate* allocate = HAllocate::cast(captured_.at(i)); 263 HAllocate* allocate = HAllocate::cast(captured_.at(i));
279 264
280 // Compute number of scalar values and start with clean slate. 265 // Compute number of scalar values and start with clean slate.
281 if (!allocate->size()->IsInteger32Constant()) continue; 266 if (!allocate->size()->IsInteger32Constant()) continue;
282 int size_in_bytes = allocate->size()->GetInteger32Constant(); 267 int size_in_bytes = allocate->size()->GetInteger32Constant();
283 number_of_values_ = size_in_bytes / kPointerSize; 268 number_of_values_ = size_in_bytes / kPointerSize;
269 number_of_objects_++;
284 block_states_.Clear(); 270 block_states_.Clear();
285 271
286 // Perform actual analysis steps. 272 // Perform actual analysis steps.
287 AnalyzeDataFlow(allocate); 273 AnalyzeDataFlow(allocate);
288 274
289 cumulative_values_ += number_of_values_; 275 cumulative_values_ += number_of_values_;
290 ASSERT(allocate->HasNoUses()); 276 ASSERT(allocate->HasNoUses());
291 ASSERT(!allocate->IsLinked()); 277 ASSERT(!allocate->IsLinked());
292 } 278 }
293 } 279 }
294 280
295 281
296 } } // namespace v8::internal 282 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-escape-analysis.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698