| 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::kInlineIsRegExp: | 52 case Runtime::kInlineIsRegExp: |
| 53 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); | 53 return ReduceIsInstanceType(node, JS_REGEXP_TYPE); |
| 54 case Runtime::kInlineIsJSReceiver: | 54 case Runtime::kInlineIsJSReceiver: |
| 55 return ReduceIsJSReceiver(node); | 55 return ReduceIsJSReceiver(node); |
| 56 case Runtime::kInlineIsSmi: | 56 case Runtime::kInlineIsSmi: |
| 57 return ReduceIsSmi(node); | 57 return ReduceIsSmi(node); |
| 58 case Runtime::kInlineMathClz32: | 58 case Runtime::kInlineMathClz32: |
| 59 return ReduceMathClz32(node); | 59 return ReduceMathClz32(node); |
| 60 case Runtime::kInlineMathFloor: | 60 case Runtime::kInlineMathFloor: |
| 61 return ReduceMathFloor(node); | 61 return ReduceMathFloor(node); |
| 62 case Runtime::kInlineMathSqrt: | |
| 63 return ReduceMathSqrt(node); | |
| 64 case Runtime::kInlineValueOf: | 62 case Runtime::kInlineValueOf: |
| 65 return ReduceValueOf(node); | 63 return ReduceValueOf(node); |
| 66 case Runtime::kInlineFixedArrayGet: | 64 case Runtime::kInlineFixedArrayGet: |
| 67 return ReduceFixedArrayGet(node); | 65 return ReduceFixedArrayGet(node); |
| 68 case Runtime::kInlineFixedArraySet: | 66 case Runtime::kInlineFixedArraySet: |
| 69 return ReduceFixedArraySet(node); | 67 return ReduceFixedArraySet(node); |
| 70 case Runtime::kInlineRegExpConstructResult: | 68 case Runtime::kInlineRegExpConstructResult: |
| 71 return ReduceRegExpConstructResult(node); | 69 return ReduceRegExpConstructResult(node); |
| 72 case Runtime::kInlineRegExpExec: | 70 case Runtime::kInlineRegExpExec: |
| 73 return ReduceRegExpExec(node); | 71 return ReduceRegExpExec(node); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 return Change(node, machine()->Word32Clz()); | 215 return Change(node, machine()->Word32Clz()); |
| 218 } | 216 } |
| 219 | 217 |
| 220 | 218 |
| 221 Reduction JSIntrinsicLowering::ReduceMathFloor(Node* node) { | 219 Reduction JSIntrinsicLowering::ReduceMathFloor(Node* node) { |
| 222 if (!machine()->Float64RoundDown().IsSupported()) return NoChange(); | 220 if (!machine()->Float64RoundDown().IsSupported()) return NoChange(); |
| 223 return Change(node, machine()->Float64RoundDown().op()); | 221 return Change(node, machine()->Float64RoundDown().op()); |
| 224 } | 222 } |
| 225 | 223 |
| 226 | 224 |
| 227 Reduction JSIntrinsicLowering::ReduceMathSqrt(Node* node) { | |
| 228 // Tell the compiler to assume number input. | |
| 229 Node* renamed = graph()->NewNode(common()->Guard(Type::Number()), | |
| 230 node->InputAt(0), graph()->start()); | |
| 231 node->ReplaceInput(0, renamed); | |
| 232 return Change(node, machine()->Float64Sqrt()); | |
| 233 } | |
| 234 | |
| 235 | |
| 236 Reduction JSIntrinsicLowering::ReduceValueOf(Node* node) { | 225 Reduction JSIntrinsicLowering::ReduceValueOf(Node* node) { |
| 237 // if (%_IsSmi(value)) { | 226 // if (%_IsSmi(value)) { |
| 238 // return value; | 227 // return value; |
| 239 // } else if (%_GetInstanceType(%_GetMap(value)) == JS_VALUE_TYPE) { | 228 // } else if (%_GetInstanceType(%_GetMap(value)) == JS_VALUE_TYPE) { |
| 240 // return %_GetValue(value); | 229 // return %_GetValue(value); |
| 241 // } else { | 230 // } else { |
| 242 // return value; | 231 // return value; |
| 243 // } | 232 // } |
| 244 const Operator* const merge_op = common()->Merge(2); | 233 const Operator* const merge_op = common()->Merge(2); |
| 245 const Operator* const ephi_op = common()->EffectPhi(2); | 234 const Operator* const ephi_op = common()->EffectPhi(2); |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 } | 582 } |
| 594 | 583 |
| 595 | 584 |
| 596 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { | 585 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { |
| 597 return jsgraph()->simplified(); | 586 return jsgraph()->simplified(); |
| 598 } | 587 } |
| 599 | 588 |
| 600 } // namespace compiler | 589 } // namespace compiler |
| 601 } // namespace internal | 590 } // namespace internal |
| 602 } // namespace v8 | 591 } // namespace v8 |
| OLD | NEW |