OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "src/compiler.h" |
| 6 #include "src/compiler/common-operator.h" |
| 7 #include "src/compiler/control-reducer.h" |
| 8 #include "src/compiler/frame.h" |
| 9 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/js-graph.h" |
| 11 #include "src/compiler/node.h" |
| 12 #include "src/compiler/node-marker.h" |
| 13 #include "src/compiler/osr.h" |
| 14 #include "src/scopes.h" |
| 15 |
| 16 namespace v8 { |
| 17 namespace internal { |
| 18 namespace compiler { |
| 19 |
| 20 OsrHelper::OsrHelper(CompilationInfo* info) |
| 21 : parameter_count_(info->scope()->num_parameters()), |
| 22 stack_slot_count_(info->scope()->num_stack_slots()) {} |
| 23 |
| 24 |
| 25 void OsrHelper::Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common, |
| 26 Zone* tmp_zone) { |
| 27 NodeDeque queue(tmp_zone); |
| 28 Graph* graph = jsgraph->graph(); |
| 29 NodeMarker<bool> marker(graph, 2); |
| 30 queue.push_back(graph->end()); |
| 31 marker.Set(graph->end(), true); |
| 32 |
| 33 while (!queue.empty()) { |
| 34 Node* node = queue.front(); |
| 35 queue.pop_front(); |
| 36 |
| 37 // Rewrite OSR-related nodes. |
| 38 switch (node->opcode()) { |
| 39 case IrOpcode::kOsrNormalEntry: |
| 40 node->ReplaceUses(graph->NewNode(common->Dead())); |
| 41 break; |
| 42 case IrOpcode::kOsrLoopEntry: |
| 43 node->ReplaceUses(graph->start()); |
| 44 break; |
| 45 default: |
| 46 break; |
| 47 } |
| 48 for (Node* const input : node->inputs()) { |
| 49 if (!marker.Get(input)) { |
| 50 marker.Set(input, true); |
| 51 queue.push_back(input); |
| 52 } |
| 53 } |
| 54 } |
| 55 |
| 56 ControlReducer::ReduceGraph(tmp_zone, jsgraph, common); |
| 57 } |
| 58 |
| 59 |
| 60 void OsrHelper::SetupFrame(Frame* frame) { |
| 61 // The optimized frame will subsume the unoptimized frame. Do so by reserving |
| 62 // the first spill slots. |
| 63 frame->ReserveSpillSlots(UnoptimizedFrameSlots()); |
| 64 } |
| 65 |
| 66 |
| 67 } // namespace compiler |
| 68 } // namespace internal |
| 69 } // namespace v8 |
OLD | NEW |