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

Side by Side Diff: src/compiler/osr.cc

Issue 929123002: Move DeadControl into the JSGraph so that it can be reused. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/compiler/js-graph.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler.h" 5 #include "src/compiler.h"
6 #include "src/compiler/all-nodes.h" 6 #include "src/compiler/all-nodes.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/control-reducer.h" 8 #include "src/compiler/control-reducer.h"
9 #include "src/compiler/frame.h" 9 #include "src/compiler/frame.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 CHECK(!osr_loop); // should be only one OSR loop. 200 CHECK(!osr_loop); // should be only one OSR loop.
201 osr_loop = use; // found the OSR loop. 201 osr_loop = use; // found the OSR loop.
202 } 202 }
203 } 203 }
204 204
205 CHECK(osr_loop); // Should have found the OSR loop. 205 CHECK(osr_loop); // Should have found the OSR loop.
206 206
207 // Analyze the graph to determine how deeply nested the OSR loop is. 207 // Analyze the graph to determine how deeply nested the OSR loop is.
208 LoopTree* loop_tree = LoopFinder::BuildLoopTree(graph, tmp_zone); 208 LoopTree* loop_tree = LoopFinder::BuildLoopTree(graph, tmp_zone);
209 209
210 Node* dead = graph->NewNode(common->Dead()); 210 Node* dead = jsgraph->DeadControl();
211 LoopTree::Loop* loop = loop_tree->ContainingLoop(osr_loop); 211 LoopTree::Loop* loop = loop_tree->ContainingLoop(osr_loop);
212 if (loop->depth() > 0) { 212 if (loop->depth() > 0) {
213 PeelOuterLoopsForOsr(graph, common, tmp_zone, dead, loop_tree, loop, 213 PeelOuterLoopsForOsr(graph, common, tmp_zone, dead, loop_tree, loop,
214 osr_normal_entry, osr_loop_entry); 214 osr_normal_entry, osr_loop_entry);
215 } 215 }
216 216
217 // Replace the normal entry with {Dead} and the loop entry with {Start} 217 // Replace the normal entry with {Dead} and the loop entry with {Start}
218 // and run the control reducer to clean up the graph. 218 // and run the control reducer to clean up the graph.
219 osr_normal_entry->ReplaceUses(dead); 219 osr_normal_entry->ReplaceUses(dead);
220 osr_loop_entry->ReplaceUses(graph->start()); 220 osr_loop_entry->ReplaceUses(graph->start());
221 ControlReducer::ReduceGraph(tmp_zone, jsgraph, common); 221 ControlReducer::ReduceGraph(tmp_zone, jsgraph, common);
222 222
223 return true; 223 return true;
224 } 224 }
225 225
226 226
227 void OsrHelper::SetupFrame(Frame* frame) { 227 void OsrHelper::SetupFrame(Frame* frame) {
228 // The optimized frame will subsume the unoptimized frame. Do so by reserving 228 // The optimized frame will subsume the unoptimized frame. Do so by reserving
229 // the first spill slots. 229 // the first spill slots.
230 frame->ReserveSpillSlots(UnoptimizedFrameSlots()); 230 frame->ReserveSpillSlots(UnoptimizedFrameSlots());
231 // The frame needs to be adjusted by the number of unoptimized frame slots. 231 // The frame needs to be adjusted by the number of unoptimized frame slots.
232 frame->SetOsrStackSlotCount(static_cast<int>(UnoptimizedFrameSlots())); 232 frame->SetOsrStackSlotCount(static_cast<int>(UnoptimizedFrameSlots()));
233 } 233 }
234 234
235 235
236 } // namespace compiler 236 } // namespace compiler
237 } // namespace internal 237 } // namespace internal
238 } // namespace v8 238 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-graph.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698