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