| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 case Runtime::kInlineIsArray: | 52 case Runtime::kInlineIsArray: |
| 53 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); | 53 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); |
| 54 case Runtime::kInlineIsDate: | 54 case Runtime::kInlineIsDate: |
| 55 return ReduceIsInstanceType(node, JS_DATE_TYPE); | 55 return ReduceIsInstanceType(node, JS_DATE_TYPE); |
| 56 case Runtime::kInlineIsTypedArray: | 56 case Runtime::kInlineIsTypedArray: |
| 57 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); | 57 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); |
| 58 case Runtime::kInlineIsFunction: | 58 case Runtime::kInlineIsFunction: |
| 59 return ReduceIsInstanceType(node, JS_FUNCTION_TYPE); | 59 return ReduceIsInstanceType(node, JS_FUNCTION_TYPE); |
| 60 case Runtime::kInlineIsRegExp: | 60 case Runtime::kInlineIsRegExp: |
| 61 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); | 61 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); |
| 62 case Runtime::kInlineIsSpecObject: | 62 case Runtime::kInlineIsJSReceiver: |
| 63 // TODO(bmeurer): Rename %_IsSpecObject to %_IsReceiver. | 63 return ReduceIsJSReceiver(node); |
| 64 return ReduceIsSpecObject(node); | |
| 65 case Runtime::kInlineIsSmi: | 64 case Runtime::kInlineIsSmi: |
| 66 return ReduceIsSmi(node); | 65 return ReduceIsSmi(node); |
| 67 case Runtime::kInlineJSValueGetValue: | 66 case Runtime::kInlineJSValueGetValue: |
| 68 return ReduceJSValueGetValue(node); | 67 return ReduceJSValueGetValue(node); |
| 69 case Runtime::kInlineMapGetInstanceType: | 68 case Runtime::kInlineMapGetInstanceType: |
| 70 return ReduceMapGetInstanceType(node); | 69 return ReduceMapGetInstanceType(node); |
| 71 case Runtime::kInlineMathClz32: | 70 case Runtime::kInlineMathClz32: |
| 72 return ReduceMathClz32(node); | 71 return ReduceMathClz32(node); |
| 73 case Runtime::kInlineMathFloor: | 72 case Runtime::kInlineMathFloor: |
| 74 return ReduceMathFloor(node); | 73 return ReduceMathFloor(node); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 239 |
| 241 // Replace all effect uses of {node} with the {ephi}. | 240 // Replace all effect uses of {node} with the {ephi}. |
| 242 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge); | 241 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge); |
| 243 ReplaceWithValue(node, node, ephi); | 242 ReplaceWithValue(node, node, ephi); |
| 244 | 243 |
| 245 // Turn the {node} into a Phi. | 244 // Turn the {node} into a Phi. |
| 246 return Change(node, common()->Phi(type, 2), vtrue, vfalse, merge); | 245 return Change(node, common()->Phi(type, 2), vtrue, vfalse, merge); |
| 247 } | 246 } |
| 248 | 247 |
| 249 | 248 |
| 250 Reduction JSIntrinsicLowering::ReduceIsSpecObject(Node* node) { | 249 Reduction JSIntrinsicLowering::ReduceIsJSReceiver(Node* node) { |
| 251 // if (%_IsSmi(value)) { | 250 // if (%_IsSmi(value)) { |
| 252 // return false; | 251 // return false; |
| 253 // } else { | 252 // } else { |
| 254 // return FIRST_JS_RECEIVER_TYPE <= %_GetInstanceType(%_GetMap(value)) | 253 // return FIRST_JS_RECEIVER_TYPE <= %_GetInstanceType(%_GetMap(value)) |
| 255 // } | 254 // } |
| 256 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); | 255 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); |
| 257 MachineType const type = static_cast<MachineType>(kTypeBool | kRepTagged); | 256 MachineType const type = static_cast<MachineType>(kTypeBool | kRepTagged); |
| 258 | 257 |
| 259 Node* value = NodeProperties::GetValueInput(node, 0); | 258 Node* value = NodeProperties::GetValueInput(node, 0); |
| 260 Node* effect = NodeProperties::GetEffectInput(node); | 259 Node* effect = NodeProperties::GetEffectInput(node); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 } | 684 } |
| 686 | 685 |
| 687 | 686 |
| 688 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 687 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
| 689 return jsgraph()->simplified(); | 688 return jsgraph()->simplified(); |
| 690 } | 689 } |
| 691 | 690 |
| 692 } // namespace compiler | 691 } // namespace compiler |
| 693 } // namespace internal | 692 } // namespace internal |
| 694 } // namespace v8 | 693 } // namespace v8 |
| OLD | NEW |