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