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/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 Reduction JSIntrinsicLowering::Reduce(Node* node) { | 27 Reduction JSIntrinsicLowering::Reduce(Node* node) { |
28 if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange(); | 28 if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange(); |
29 const Runtime::Function* const f = | 29 const Runtime::Function* const f = |
30 Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id()); | 30 Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id()); |
31 if (f->intrinsic_type != Runtime::IntrinsicType::INLINE) return NoChange(); | 31 if (f->intrinsic_type != Runtime::IntrinsicType::INLINE) return NoChange(); |
32 switch (f->function_id) { | 32 switch (f->function_id) { |
33 case Runtime::kInlineCreateIterResultObject: | 33 case Runtime::kInlineCreateIterResultObject: |
34 return ReduceCreateIterResultObject(node); | 34 return ReduceCreateIterResultObject(node); |
35 case Runtime::kInlineDeoptimizeNow: | 35 case Runtime::kInlineDeoptimizeNow: |
36 return ReduceDeoptimizeNow(node); | 36 return ReduceDeoptimizeNow(node); |
37 case Runtime::kInlineDoubleHi: | |
38 return ReduceDoubleHi(node); | |
39 case Runtime::kInlineDoubleLo: | |
40 return ReduceDoubleLo(node); | |
41 case Runtime::kInlineGeneratorClose: | 37 case Runtime::kInlineGeneratorClose: |
42 return ReduceGeneratorClose(node); | 38 return ReduceGeneratorClose(node); |
43 case Runtime::kInlineGeneratorGetInputOrDebugPos: | 39 case Runtime::kInlineGeneratorGetInputOrDebugPos: |
44 return ReduceGeneratorGetInputOrDebugPos(node); | 40 return ReduceGeneratorGetInputOrDebugPos(node); |
45 case Runtime::kInlineGeneratorGetResumeMode: | 41 case Runtime::kInlineGeneratorGetResumeMode: |
46 return ReduceGeneratorGetResumeMode(node); | 42 return ReduceGeneratorGetResumeMode(node); |
47 case Runtime::kInlineIsArray: | 43 case Runtime::kInlineIsArray: |
48 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); | 44 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); |
49 case Runtime::kInlineIsTypedArray: | 45 case Runtime::kInlineIsTypedArray: |
50 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); | 46 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), | 114 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), |
119 frame_state, effect, control); | 115 frame_state, effect, control); |
120 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); | 116 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); |
121 Revisit(graph()->end()); | 117 Revisit(graph()->end()); |
122 | 118 |
123 node->TrimInputCount(0); | 119 node->TrimInputCount(0); |
124 NodeProperties::ChangeOp(node, common()->Dead()); | 120 NodeProperties::ChangeOp(node, common()->Dead()); |
125 return Changed(node); | 121 return Changed(node); |
126 } | 122 } |
127 | 123 |
128 | |
129 Reduction JSIntrinsicLowering::ReduceDoubleHi(Node* node) { | |
130 // Tell the compiler to assume number input. | |
131 Node* renamed = graph()->NewNode(simplified()->TypeGuard(Type::Number()), | |
132 node->InputAt(0), graph()->start()); | |
133 node->ReplaceInput(0, renamed); | |
134 return Change(node, machine()->Float64ExtractHighWord32()); | |
135 } | |
136 | |
137 | |
138 Reduction JSIntrinsicLowering::ReduceDoubleLo(Node* node) { | |
139 // Tell the compiler to assume number input. | |
140 Node* renamed = graph()->NewNode(simplified()->TypeGuard(Type::Number()), | |
141 node->InputAt(0), graph()->start()); | |
142 node->ReplaceInput(0, renamed); | |
143 return Change(node, machine()->Float64ExtractLowWord32()); | |
144 } | |
145 | |
146 Reduction JSIntrinsicLowering::ReduceGeneratorClose(Node* node) { | 124 Reduction JSIntrinsicLowering::ReduceGeneratorClose(Node* node) { |
147 Node* const generator = NodeProperties::GetValueInput(node, 0); | 125 Node* const generator = NodeProperties::GetValueInput(node, 0); |
148 Node* const effect = NodeProperties::GetEffectInput(node); | 126 Node* const effect = NodeProperties::GetEffectInput(node); |
149 Node* const control = NodeProperties::GetControlInput(node); | 127 Node* const control = NodeProperties::GetControlInput(node); |
150 Node* const closed = jsgraph()->Constant(JSGeneratorObject::kGeneratorClosed); | 128 Node* const closed = jsgraph()->Constant(JSGeneratorObject::kGeneratorClosed); |
151 Node* const undefined = jsgraph()->UndefinedConstant(); | 129 Node* const undefined = jsgraph()->UndefinedConstant(); |
152 Operator const* const op = simplified()->StoreField( | 130 Operator const* const op = simplified()->StoreField( |
153 AccessBuilder::ForJSGeneratorObjectContinuation()); | 131 AccessBuilder::ForJSGeneratorObjectContinuation()); |
154 | 132 |
155 ReplaceWithValue(node, undefined, node); | 133 ReplaceWithValue(node, undefined, node); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 } | 479 } |
502 | 480 |
503 | 481 |
504 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 482 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
505 return jsgraph()->simplified(); | 483 return jsgraph()->simplified(); |
506 } | 484 } |
507 | 485 |
508 } // namespace compiler | 486 } // namespace compiler |
509 } // namespace internal | 487 } // namespace internal |
510 } // namespace v8 | 488 } // namespace v8 |
OLD | NEW |