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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 case Runtime::kInlineIsArray: | 43 case Runtime::kInlineIsArray: |
44 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); | 44 return ReduceIsInstanceType(node, JS_ARRAY_TYPE); |
45 case Runtime::kInlineIsTypedArray: | 45 case Runtime::kInlineIsTypedArray: |
46 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); | 46 return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE); |
47 case Runtime::kInlineIsRegExp: | 47 case Runtime::kInlineIsRegExp: |
48 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); | 48 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); |
49 case Runtime::kInlineIsJSReceiver: | 49 case Runtime::kInlineIsJSReceiver: |
50 return ReduceIsJSReceiver(node); | 50 return ReduceIsJSReceiver(node); |
51 case Runtime::kInlineIsSmi: | 51 case Runtime::kInlineIsSmi: |
52 return ReduceIsSmi(node); | 52 return ReduceIsSmi(node); |
53 case Runtime::kInlineMathClz32: | |
54 return ReduceMathClz32(node); | |
55 case Runtime::kInlineValueOf: | 53 case Runtime::kInlineValueOf: |
56 return ReduceValueOf(node); | 54 return ReduceValueOf(node); |
57 case Runtime::kInlineFixedArrayGet: | 55 case Runtime::kInlineFixedArrayGet: |
58 return ReduceFixedArrayGet(node); | 56 return ReduceFixedArrayGet(node); |
59 case Runtime::kInlineFixedArraySet: | 57 case Runtime::kInlineFixedArraySet: |
60 return ReduceFixedArraySet(node); | 58 return ReduceFixedArraySet(node); |
61 case Runtime::kInlineRegExpConstructResult: | 59 case Runtime::kInlineRegExpConstructResult: |
62 return ReduceRegExpConstructResult(node); | 60 return ReduceRegExpConstructResult(node); |
63 case Runtime::kInlineRegExpExec: | 61 case Runtime::kInlineRegExpExec: |
64 return ReduceRegExpExec(node); | 62 return ReduceRegExpExec(node); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 Reduction JSIntrinsicLowering::ReduceIsJSReceiver(Node* node) { | 195 Reduction JSIntrinsicLowering::ReduceIsJSReceiver(Node* node) { |
198 return Change(node, simplified()->ObjectIsReceiver()); | 196 return Change(node, simplified()->ObjectIsReceiver()); |
199 } | 197 } |
200 | 198 |
201 | 199 |
202 Reduction JSIntrinsicLowering::ReduceIsSmi(Node* node) { | 200 Reduction JSIntrinsicLowering::ReduceIsSmi(Node* node) { |
203 return Change(node, simplified()->ObjectIsSmi()); | 201 return Change(node, simplified()->ObjectIsSmi()); |
204 } | 202 } |
205 | 203 |
206 | 204 |
207 Reduction JSIntrinsicLowering::ReduceMathClz32(Node* node) { | |
208 return Change(node, machine()->Word32Clz()); | |
209 } | |
210 | |
211 | |
212 Reduction JSIntrinsicLowering::ReduceValueOf(Node* node) { | 205 Reduction JSIntrinsicLowering::ReduceValueOf(Node* node) { |
213 // if (%_IsSmi(value)) { | 206 // if (%_IsSmi(value)) { |
214 // return value; | 207 // return value; |
215 // } else if (%_GetInstanceType(%_GetMap(value)) == JS_VALUE_TYPE) { | 208 // } else if (%_GetInstanceType(%_GetMap(value)) == JS_VALUE_TYPE) { |
216 // return %_GetValue(value); | 209 // return %_GetValue(value); |
217 // } else { | 210 // } else { |
218 // return value; | 211 // return value; |
219 // } | 212 // } |
220 const Operator* const merge_op = common()->Merge(2); | 213 const Operator* const merge_op = common()->Merge(2); |
221 const Operator* const ephi_op = common()->EffectPhi(2); | 214 const Operator* const ephi_op = common()->EffectPhi(2); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 491 } |
499 | 492 |
500 | 493 |
501 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 494 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
502 return jsgraph()->simplified(); | 495 return jsgraph()->simplified(); |
503 } | 496 } |
504 | 497 |
505 } // namespace compiler | 498 } // namespace compiler |
506 } // namespace internal | 499 } // namespace internal |
507 } // namespace v8 | 500 } // namespace v8 |
OLD | NEW |