OLD | NEW |
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // and run the control reducer to clean up the graph. | 332 // and run the control reducer to clean up the graph. |
333 osr_normal_entry->ReplaceUses(dead); | 333 osr_normal_entry->ReplaceUses(dead); |
334 osr_normal_entry->Kill(); | 334 osr_normal_entry->Kill(); |
335 osr_loop_entry->ReplaceUses(graph->start()); | 335 osr_loop_entry->ReplaceUses(graph->start()); |
336 osr_loop_entry->Kill(); | 336 osr_loop_entry->Kill(); |
337 | 337 |
338 // Normally the control reducer removes loops whose first input is dead, | 338 // Normally the control reducer removes loops whose first input is dead, |
339 // but we need to avoid that because the osr_loop is reachable through | 339 // but we need to avoid that because the osr_loop is reachable through |
340 // the second input, so reduce it and its phis manually. | 340 // the second input, so reduce it and its phis manually. |
341 osr_loop->ReplaceInput(0, dead); | 341 osr_loop->ReplaceInput(0, dead); |
342 Node* node = ControlReducer::ReduceMerge(jsgraph, common, osr_loop); | 342 Node* node = ControlReducer::ReduceMerge(jsgraph, osr_loop); |
343 if (node != osr_loop) osr_loop->ReplaceUses(node); | 343 if (node != osr_loop) osr_loop->ReplaceUses(node); |
344 | 344 |
345 // Run the normal control reduction, which naturally trims away the dead | 345 // Run the normal control reduction, which naturally trims away the dead |
346 // parts of the graph. | 346 // parts of the graph. |
347 ControlReducer::ReduceGraph(tmp_zone, jsgraph, common); | 347 ControlReducer::ReduceGraph(tmp_zone, jsgraph); |
348 } | 348 } |
349 | 349 |
350 | 350 |
351 void OsrHelper::SetupFrame(Frame* frame) { | 351 void OsrHelper::SetupFrame(Frame* frame) { |
352 // The optimized frame will subsume the unoptimized frame. Do so by reserving | 352 // The optimized frame will subsume the unoptimized frame. Do so by reserving |
353 // the first spill slots. | 353 // the first spill slots. |
354 frame->ReserveSpillSlots(UnoptimizedFrameSlots()); | 354 frame->ReserveSpillSlots(UnoptimizedFrameSlots()); |
355 // The frame needs to be adjusted by the number of unoptimized frame slots. | 355 // The frame needs to be adjusted by the number of unoptimized frame slots. |
356 frame->SetOsrStackSlotCount(static_cast<int>(UnoptimizedFrameSlots())); | 356 frame->SetOsrStackSlotCount(static_cast<int>(UnoptimizedFrameSlots())); |
357 } | 357 } |
358 | 358 |
359 | 359 |
360 } // namespace compiler | 360 } // namespace compiler |
361 } // namespace internal | 361 } // namespace internal |
362 } // namespace v8 | 362 } // namespace v8 |
OLD | NEW |