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

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

Issue 1188433010: [turbofan] Move graph trimming functionality to dedicated GraphTrimmer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/node-marker.cc ('k') | src/compiler/pipeline.cc » ('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 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"
11 #include "src/compiler/graph-trimmer.h"
11 #include "src/compiler/graph-visualizer.h" 12 #include "src/compiler/graph-visualizer.h"
12 #include "src/compiler/js-graph.h" 13 #include "src/compiler/js-graph.h"
13 #include "src/compiler/loop-analysis.h" 14 #include "src/compiler/loop-analysis.h"
14 #include "src/compiler/node.h" 15 #include "src/compiler/node.h"
15 #include "src/compiler/node-marker.h" 16 #include "src/compiler/node-marker.h"
16 #include "src/compiler/osr.h" 17 #include "src/compiler/osr.h"
17 #include "src/scopes.h" 18 #include "src/scopes.h"
18 19
19 namespace v8 { 20 namespace v8 {
20 namespace internal { 21 namespace internal {
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 osr_loop_entry->ReplaceUses(graph->start()); 331 osr_loop_entry->ReplaceUses(graph->start());
331 osr_loop_entry->Kill(); 332 osr_loop_entry->Kill();
332 333
333 // Normally the control reducer removes loops whose first input is dead, 334 // Normally the control reducer removes loops whose first input is dead,
334 // but we need to avoid that because the osr_loop is reachable through 335 // but we need to avoid that because the osr_loop is reachable through
335 // the second input, so reduce it and its phis manually. 336 // the second input, so reduce it and its phis manually.
336 osr_loop->ReplaceInput(0, dead); 337 osr_loop->ReplaceInput(0, dead);
337 Node* node = ControlReducer::ReduceMerge(jsgraph, osr_loop); 338 Node* node = ControlReducer::ReduceMerge(jsgraph, osr_loop);
338 if (node != osr_loop) osr_loop->ReplaceUses(node); 339 if (node != osr_loop) osr_loop->ReplaceUses(node);
339 340
340 // Run the normal control reduction, which naturally trims away the dead 341 // Run control reduction and graph trimming.
341 // parts of the graph.
342 ControlReducer::ReduceGraph(tmp_zone, jsgraph); 342 ControlReducer::ReduceGraph(tmp_zone, jsgraph);
343 GraphTrimmer trimmer(tmp_zone, jsgraph->graph());
344 NodeVector roots(tmp_zone);
345 jsgraph->GetCachedNodes(&roots);
346 trimmer.TrimGraph(roots.begin(), roots.end());
343 } 347 }
344 348
345 349
346 void OsrHelper::SetupFrame(Frame* frame) { 350 void OsrHelper::SetupFrame(Frame* frame) {
347 // The optimized frame will subsume the unoptimized frame. Do so by reserving 351 // The optimized frame will subsume the unoptimized frame. Do so by reserving
348 // the first spill slots. 352 // the first spill slots.
349 frame->ReserveSpillSlots(UnoptimizedFrameSlots()); 353 frame->ReserveSpillSlots(UnoptimizedFrameSlots());
350 // The frame needs to be adjusted by the number of unoptimized frame slots. 354 // The frame needs to be adjusted by the number of unoptimized frame slots.
351 frame->SetOsrStackSlotCount(static_cast<int>(UnoptimizedFrameSlots())); 355 frame->SetOsrStackSlotCount(static_cast<int>(UnoptimizedFrameSlots()));
352 } 356 }
353 357
354
355 } // namespace compiler 358 } // namespace compiler
356 } // namespace internal 359 } // namespace internal
357 } // namespace v8 360 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/node-marker.cc ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698