OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/js-frame-specialization.h" | 5 #include "src/compiler/js-frame-specialization.h" |
6 | 6 |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 Reduction JSFrameSpecialization::Reduce(Node* node) { | 15 Reduction JSFrameSpecialization::Reduce(Node* node) { |
16 switch (node->opcode()) { | 16 switch (node->opcode()) { |
17 case IrOpcode::kOsrValue: | 17 case IrOpcode::kOsrValue: |
18 return ReduceOsrValue(node); | 18 return ReduceOsrValue(node); |
19 case IrOpcode::kOsrGuard: | 19 case IrOpcode::kOsrGuard: |
20 return ReduceOsrGuard(node); | 20 return ReduceOsrGuard(node); |
21 case IrOpcode::kParameter: | 21 case IrOpcode::kParameter: |
22 return ReduceParameter(node); | 22 return ReduceParameter(node); |
23 default: | 23 default: |
24 break; | 24 break; |
25 } | 25 } |
26 return NoChange(); | 26 return NoChange(); |
27 } | 27 } |
28 | 28 |
29 Reduction JSFrameSpecialization::ReduceOsrValue(Node* node) { | 29 Reduction JSFrameSpecialization::ReduceOsrValue(Node* node) { |
| 30 // JSFrameSpecialization should never run on interpreted frames, since the |
| 31 // code below assumes standard stack frame layouts. |
| 32 DCHECK(!frame()->is_interpreted()); |
30 DCHECK_EQ(IrOpcode::kOsrValue, node->opcode()); | 33 DCHECK_EQ(IrOpcode::kOsrValue, node->opcode()); |
31 Handle<Object> value; | 34 Handle<Object> value; |
32 int index = OsrValueIndexOf(node->op()); | 35 int index = OsrValueIndexOf(node->op()); |
33 int const parameters_count = frame()->ComputeParametersCount() + 1; | 36 int const parameters_count = frame()->ComputeParametersCount() + 1; |
34 if (index == Linkage::kOsrContextSpillSlotIndex) { | 37 if (index == Linkage::kOsrContextSpillSlotIndex) { |
35 value = handle(frame()->context(), isolate()); | 38 value = handle(frame()->context(), isolate()); |
36 } else if (index >= parameters_count) { | 39 } else if (index >= parameters_count) { |
37 value = handle(frame()->GetExpression(index - parameters_count), isolate()); | 40 value = handle(frame()->GetExpression(index - parameters_count), isolate()); |
38 } else { | 41 } else { |
39 // The OsrValue index 0 is the receiver. | 42 // The OsrValue index 0 is the receiver. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 76 } |
74 return Replace(jsgraph()->Constant(value)); | 77 return Replace(jsgraph()->Constant(value)); |
75 } | 78 } |
76 | 79 |
77 | 80 |
78 Isolate* JSFrameSpecialization::isolate() const { return jsgraph()->isolate(); } | 81 Isolate* JSFrameSpecialization::isolate() const { return jsgraph()->isolate(); } |
79 | 82 |
80 } // namespace compiler | 83 } // namespace compiler |
81 } // namespace internal | 84 } // namespace internal |
82 } // namespace v8 | 85 } // namespace v8 |
OLD | NEW |