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" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 case Runtime::kInlineIncrementStatsCounter: | 45 case Runtime::kInlineIncrementStatsCounter: |
46 return ReduceIncrementStatsCounter(node); | 46 return ReduceIncrementStatsCounter(node); |
47 case Runtime::kInlineIsArray: | 47 case Runtime::kInlineIsArray: |
48 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); | 48 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); |
49 case Runtime::kInlineIsDate: | 49 case Runtime::kInlineIsDate: |
50 return ReduceIsInstanceType(node, JS_DATE_TYPE); | 50 return ReduceIsInstanceType(node, JS_DATE_TYPE); |
51 case Runtime::kInlineIsTypedArray: | 51 case Runtime::kInlineIsTypedArray: |
52 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); | 52 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); |
53 case Runtime::kInlineIsFunction: | 53 case Runtime::kInlineIsFunction: |
54 return ReduceIsInstanceType(node, JS_FUNCTION_TYPE); | 54 return ReduceIsInstanceType(node, JS_FUNCTION_TYPE); |
55 case Runtime::kInlineIsNonNegativeSmi: | |
56 return ReduceIsNonNegativeSmi(node); | |
57 case Runtime::kInlineIsRegExp: | 55 case Runtime::kInlineIsRegExp: |
58 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); | 56 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); |
59 case Runtime::kInlineIsSmi: | 57 case Runtime::kInlineIsSmi: |
60 return ReduceIsSmi(node); | 58 return ReduceIsSmi(node); |
61 case Runtime::kInlineJSValueGetValue: | 59 case Runtime::kInlineJSValueGetValue: |
62 return ReduceJSValueGetValue(node); | 60 return ReduceJSValueGetValue(node); |
63 case Runtime::kInlineLikely: | 61 case Runtime::kInlineLikely: |
64 return ReduceUnLikely(node, BranchHint::kTrue); | 62 return ReduceUnLikely(node, BranchHint::kTrue); |
65 case Runtime::kInlineMapGetInstanceType: | 63 case Runtime::kInlineMapGetInstanceType: |
66 return ReduceMapGetInstanceType(node); | 64 return ReduceMapGetInstanceType(node); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 230 |
233 // Replace all effect uses of {node} with the {ephi}. | 231 // Replace all effect uses of {node} with the {ephi}. |
234 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge); | 232 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge); |
235 ReplaceWithValue(node, node, ephi); | 233 ReplaceWithValue(node, node, ephi); |
236 | 234 |
237 // Turn the {node} into a Phi. | 235 // Turn the {node} into a Phi. |
238 return Change(node, common()->Phi(type, 2), vtrue, vfalse, merge); | 236 return Change(node, common()->Phi(type, 2), vtrue, vfalse, merge); |
239 } | 237 } |
240 | 238 |
241 | 239 |
242 Reduction JSIntrinsicLowering::ReduceIsNonNegativeSmi(Node* node) { | |
243 return Change(node, simplified()->ObjectIsNonNegativeSmi()); | |
244 } | |
245 | |
246 | |
247 Reduction JSIntrinsicLowering::ReduceIsSmi(Node* node) { | 240 Reduction JSIntrinsicLowering::ReduceIsSmi(Node* node) { |
248 return Change(node, simplified()->ObjectIsSmi()); | 241 return Change(node, simplified()->ObjectIsSmi()); |
249 } | 242 } |
250 | 243 |
251 | 244 |
252 Reduction JSIntrinsicLowering::ReduceJSValueGetValue(Node* node) { | 245 Reduction JSIntrinsicLowering::ReduceJSValueGetValue(Node* node) { |
253 Node* value = NodeProperties::GetValueInput(node, 0); | 246 Node* value = NodeProperties::GetValueInput(node, 0); |
254 Node* effect = NodeProperties::GetEffectInput(node); | 247 Node* effect = NodeProperties::GetEffectInput(node); |
255 Node* control = NodeProperties::GetControlInput(node); | 248 Node* control = NodeProperties::GetControlInput(node); |
256 return Change(node, simplified()->LoadField(AccessBuilder::ForValue()), value, | 249 return Change(node, simplified()->LoadField(AccessBuilder::ForValue()), value, |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 } | 598 } |
606 | 599 |
607 | 600 |
608 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { | 601 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { |
609 return jsgraph()->machine(); | 602 return jsgraph()->machine(); |
610 } | 603 } |
611 | 604 |
612 } // namespace compiler | 605 } // namespace compiler |
613 } // namespace internal | 606 } // namespace internal |
614 } // namespace v8 | 607 } // namespace v8 |
OLD | NEW |