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-intrinsic-lowering.h" | 5 #include "src/compiler/js-intrinsic-lowering.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 | 8 |
9 #include "src/compiler/access-builder.h" | 9 #include "src/compiler/access-builder.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
11 #include "src/compiler/node-matchers.h" | 11 #include "src/compiler/node-matchers.h" |
12 #include "src/compiler/node-properties.h" | 12 #include "src/compiler/node-properties.h" |
13 #include "src/compiler/operator-properties.h" | 13 #include "src/compiler/operator-properties.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
17 namespace compiler { | 17 namespace compiler { |
18 | 18 |
19 JSIntrinsicLowering::JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph) | 19 JSIntrinsicLowering::JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph, |
| 20 DeoptimizationMode mode) |
20 : AdvancedReducer(editor), | 21 : AdvancedReducer(editor), |
21 jsgraph_(jsgraph), | 22 jsgraph_(jsgraph), |
| 23 mode_(mode), |
22 simplified_(jsgraph->zone()) {} | 24 simplified_(jsgraph->zone()) {} |
23 | 25 |
24 | 26 |
25 Reduction JSIntrinsicLowering::Reduce(Node* node) { | 27 Reduction JSIntrinsicLowering::Reduce(Node* node) { |
26 if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange(); | 28 if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange(); |
27 const Runtime::Function* const f = | 29 const Runtime::Function* const f = |
28 Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id()); | 30 Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id()); |
29 if (f->intrinsic_type != Runtime::IntrinsicType::INLINE) return NoChange(); | 31 if (f->intrinsic_type != Runtime::IntrinsicType::INLINE) return NoChange(); |
30 switch (f->function_id) { | 32 switch (f->function_id) { |
31 case Runtime::kInlineConstructDouble: | 33 case Runtime::kInlineConstructDouble: |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 graph()->NewNode(machine()->Float64InsertHighWord32(), | 98 graph()->NewNode(machine()->Float64InsertHighWord32(), |
97 graph()->NewNode(machine()->Float64InsertLowWord32(), | 99 graph()->NewNode(machine()->Float64InsertLowWord32(), |
98 jsgraph()->Constant(0), low), | 100 jsgraph()->Constant(0), low), |
99 high); | 101 high); |
100 ReplaceWithValue(node, value); | 102 ReplaceWithValue(node, value); |
101 return Replace(value); | 103 return Replace(value); |
102 } | 104 } |
103 | 105 |
104 | 106 |
105 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) { | 107 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) { |
106 // TODO(jarin): This should not depend on the global flag. | 108 if (mode() != kDeoptimizationEnabled) return NoChange(); |
107 if (!FLAG_turbo_deoptimization) return NoChange(); | |
108 | |
109 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); | 109 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); |
110 DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState); | 110 DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState); |
111 | 111 |
112 Node* effect = NodeProperties::GetEffectInput(node); | 112 Node* effect = NodeProperties::GetEffectInput(node); |
113 Node* control = NodeProperties::GetControlInput(node); | 113 Node* control = NodeProperties::GetControlInput(node); |
114 | 114 |
115 // We are making the continuation after the call dead. To | 115 // We are making the continuation after the call dead. To |
116 // model this, we generate if (true) statement with deopt | 116 // model this, we generate if (true) statement with deopt |
117 // in the true branch and continuation in the false branch. | 117 // in the true branch and continuation in the false branch. |
118 Node* branch = | 118 Node* branch = |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 } | 492 } |
493 | 493 |
494 | 494 |
495 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { | 495 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { |
496 return jsgraph()->machine(); | 496 return jsgraph()->machine(); |
497 } | 497 } |
498 | 498 |
499 } // namespace compiler | 499 } // namespace compiler |
500 } // namespace internal | 500 } // namespace internal |
501 } // namespace v8 | 501 } // namespace v8 |
OLD | NEW |