| 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 24 matching lines...) Expand all Loading... |
| 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: | 43 case Runtime::kInlineGeneratorClose: |
| 44 return ReduceGeneratorClose(node); | 44 return ReduceGeneratorClose(node); |
| 45 case Runtime::kInlineGeneratorGetInput: |
| 46 return ReduceGeneratorGetInput(node); |
| 47 case Runtime::kInlineGeneratorGetResumeMode: |
| 48 return ReduceGeneratorGetResumeMode(node); |
| 45 case Runtime::kInlineIsArray: | 49 case Runtime::kInlineIsArray: |
| 46 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); | 50 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); |
| 47 case Runtime::kInlineIsTypedArray: | 51 case Runtime::kInlineIsTypedArray: |
| 48 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); | 52 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); |
| 49 case Runtime::kInlineIsRegExp: | 53 case Runtime::kInlineIsRegExp: |
| 50 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); | 54 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); |
| 51 case Runtime::kInlineIsJSReceiver: | 55 case Runtime::kInlineIsJSReceiver: |
| 52 return ReduceIsJSReceiver(node); | 56 return ReduceIsJSReceiver(node); |
| 53 case Runtime::kInlineIsSmi: | 57 case Runtime::kInlineIsSmi: |
| 54 return ReduceIsSmi(node); | 58 return ReduceIsSmi(node); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 Node* const closed = jsgraph()->Constant(JSGeneratorObject::kGeneratorClosed); | 165 Node* const closed = jsgraph()->Constant(JSGeneratorObject::kGeneratorClosed); |
| 162 Node* const undefined = jsgraph()->UndefinedConstant(); | 166 Node* const undefined = jsgraph()->UndefinedConstant(); |
| 163 Operator const* const op = simplified()->StoreField( | 167 Operator const* const op = simplified()->StoreField( |
| 164 AccessBuilder::ForJSGeneratorObjectContinuation()); | 168 AccessBuilder::ForJSGeneratorObjectContinuation()); |
| 165 | 169 |
| 166 ReplaceWithValue(node, undefined, node); | 170 ReplaceWithValue(node, undefined, node); |
| 167 NodeProperties::RemoveType(node); | 171 NodeProperties::RemoveType(node); |
| 168 return Change(node, op, generator, closed, effect, control); | 172 return Change(node, op, generator, closed, effect, control); |
| 169 } | 173 } |
| 170 | 174 |
| 175 Reduction JSIntrinsicLowering::ReduceGeneratorGetInput(Node* node) { |
| 176 Node* const generator = NodeProperties::GetValueInput(node, 0); |
| 177 Node* const effect = NodeProperties::GetEffectInput(node); |
| 178 Node* const control = NodeProperties::GetControlInput(node); |
| 179 Operator const* const op = |
| 180 simplified()->LoadField(AccessBuilder::ForJSGeneratorObjectInput()); |
| 181 |
| 182 return Change(node, op, generator, effect, control); |
| 183 } |
| 184 |
| 185 Reduction JSIntrinsicLowering::ReduceGeneratorGetResumeMode(Node* node) { |
| 186 Node* const generator = NodeProperties::GetValueInput(node, 0); |
| 187 Node* const effect = NodeProperties::GetEffectInput(node); |
| 188 Node* const control = NodeProperties::GetControlInput(node); |
| 189 Operator const* const op = |
| 190 simplified()->LoadField(AccessBuilder::ForJSGeneratorObjectResumeMode()); |
| 191 |
| 192 return Change(node, op, generator, effect, control); |
| 193 } |
| 194 |
| 171 Reduction JSIntrinsicLowering::ReduceIsInstanceType( | 195 Reduction JSIntrinsicLowering::ReduceIsInstanceType( |
| 172 Node* node, InstanceType instance_type) { | 196 Node* node, InstanceType instance_type) { |
| 173 // if (%_IsSmi(value)) { | 197 // if (%_IsSmi(value)) { |
| 174 // return false; | 198 // return false; |
| 175 // } else { | 199 // } else { |
| 176 // return %_GetInstanceType(%_GetMap(value)) == instance_type; | 200 // return %_GetInstanceType(%_GetMap(value)) == instance_type; |
| 177 // } | 201 // } |
| 178 Node* value = NodeProperties::GetValueInput(node, 0); | 202 Node* value = NodeProperties::GetValueInput(node, 0); |
| 179 Node* effect = NodeProperties::GetEffectInput(node); | 203 Node* effect = NodeProperties::GetEffectInput(node); |
| 180 Node* control = NodeProperties::GetControlInput(node); | 204 Node* control = NodeProperties::GetControlInput(node); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 } | 516 } |
| 493 | 517 |
| 494 | 518 |
| 495 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 519 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
| 496 return jsgraph()->simplified(); | 520 return jsgraph()->simplified(); |
| 497 } | 521 } |
| 498 | 522 |
| 499 } // namespace compiler | 523 } // namespace compiler |
| 500 } // namespace internal | 524 } // namespace internal |
| 501 } // namespace v8 | 525 } // namespace v8 |
| OLD | NEW |