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 22 matching lines...) Expand all Loading... |
33 case Runtime::kInlineConstructDouble: | 33 case Runtime::kInlineConstructDouble: |
34 return ReduceConstructDouble(node); | 34 return ReduceConstructDouble(node); |
35 case Runtime::kInlineCreateIterResultObject: | 35 case Runtime::kInlineCreateIterResultObject: |
36 return ReduceCreateIterResultObject(node); | 36 return ReduceCreateIterResultObject(node); |
37 case Runtime::kInlineDeoptimizeNow: | 37 case Runtime::kInlineDeoptimizeNow: |
38 return ReduceDeoptimizeNow(node); | 38 return ReduceDeoptimizeNow(node); |
39 case Runtime::kInlineDoubleHi: | 39 case Runtime::kInlineDoubleHi: |
40 return ReduceDoubleHi(node); | 40 return ReduceDoubleHi(node); |
41 case Runtime::kInlineDoubleLo: | 41 case Runtime::kInlineDoubleLo: |
42 return ReduceDoubleLo(node); | 42 return ReduceDoubleLo(node); |
| 43 case Runtime::kInlineGeneratorClose: |
| 44 return ReduceGeneratorClose(node); |
43 case Runtime::kInlineIsArray: | 45 case Runtime::kInlineIsArray: |
44 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); | 46 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); |
45 case Runtime::kInlineIsTypedArray: | 47 case Runtime::kInlineIsTypedArray: |
46 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); | 48 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); |
47 case Runtime::kInlineIsRegExp: | 49 case Runtime::kInlineIsRegExp: |
48 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); | 50 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); |
49 case Runtime::kInlineIsJSReceiver: | 51 case Runtime::kInlineIsJSReceiver: |
50 return ReduceIsJSReceiver(node); | 52 return ReduceIsJSReceiver(node); |
51 case Runtime::kInlineIsSmi: | 53 case Runtime::kInlineIsSmi: |
52 return ReduceIsSmi(node); | 54 return ReduceIsSmi(node); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 147 |
146 | 148 |
147 Reduction JSIntrinsicLowering::ReduceDoubleLo(Node* node) { | 149 Reduction JSIntrinsicLowering::ReduceDoubleLo(Node* node) { |
148 // Tell the compiler to assume number input. | 150 // Tell the compiler to assume number input. |
149 Node* renamed = graph()->NewNode(simplified()->TypeGuard(Type::Number()), | 151 Node* renamed = graph()->NewNode(simplified()->TypeGuard(Type::Number()), |
150 node->InputAt(0), graph()->start()); | 152 node->InputAt(0), graph()->start()); |
151 node->ReplaceInput(0, renamed); | 153 node->ReplaceInput(0, renamed); |
152 return Change(node, machine()->Float64ExtractLowWord32()); | 154 return Change(node, machine()->Float64ExtractLowWord32()); |
153 } | 155 } |
154 | 156 |
| 157 Reduction JSIntrinsicLowering::ReduceGeneratorClose(Node* node) { |
| 158 Node* const generator = NodeProperties::GetValueInput(node, 0); |
| 159 Node* const effect = NodeProperties::GetEffectInput(node); |
| 160 Node* const control = NodeProperties::GetControlInput(node); |
| 161 Node* const closed = jsgraph()->Constant(JSGeneratorObject::kGeneratorClosed); |
| 162 Node* const undefined = jsgraph()->UndefinedConstant(); |
| 163 Operator const* const op = simplified()->StoreField( |
| 164 AccessBuilder::ForJSGeneratorObjectContinuation()); |
| 165 |
| 166 ReplaceWithValue(node, undefined, node); |
| 167 NodeProperties::RemoveType(node); |
| 168 return Change(node, op, generator, closed, effect, control); |
| 169 } |
155 | 170 |
156 Reduction JSIntrinsicLowering::ReduceIsInstanceType( | 171 Reduction JSIntrinsicLowering::ReduceIsInstanceType( |
157 Node* node, InstanceType instance_type) { | 172 Node* node, InstanceType instance_type) { |
158 // if (%_IsSmi(value)) { | 173 // if (%_IsSmi(value)) { |
159 // return false; | 174 // return false; |
160 // } else { | 175 // } else { |
161 // return %_GetInstanceType(%_GetMap(value)) == instance_type; | 176 // return %_GetInstanceType(%_GetMap(value)) == instance_type; |
162 // } | 177 // } |
163 Node* value = NodeProperties::GetValueInput(node, 0); | 178 Node* value = NodeProperties::GetValueInput(node, 0); |
164 Node* effect = NodeProperties::GetEffectInput(node); | 179 Node* effect = NodeProperties::GetEffectInput(node); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 } | 492 } |
478 | 493 |
479 | 494 |
480 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 495 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
481 return jsgraph()->simplified(); | 496 return jsgraph()->simplified(); |
482 } | 497 } |
483 | 498 |
484 } // namespace compiler | 499 } // namespace compiler |
485 } // namespace internal | 500 } // namespace internal |
486 } // namespace v8 | 501 } // namespace v8 |
OLD | NEW |