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