| 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 "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
| 8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 case Runtime::kInlineIsFunction: | 33 case Runtime::kInlineIsFunction: |
| 34 return ReduceInlineIsInstanceType(node, JS_FUNCTION_TYPE); | 34 return ReduceInlineIsInstanceType(node, JS_FUNCTION_TYPE); |
| 35 case Runtime::kInlineConstructDouble: | 35 case Runtime::kInlineConstructDouble: |
| 36 return ReduceInlineConstructDouble(node); | 36 return ReduceInlineConstructDouble(node); |
| 37 case Runtime::kInlineDoubleLo: | 37 case Runtime::kInlineDoubleLo: |
| 38 return ReduceInlineDoubleLo(node); | 38 return ReduceInlineDoubleLo(node); |
| 39 case Runtime::kInlineDoubleHi: | 39 case Runtime::kInlineDoubleHi: |
| 40 return ReduceInlineDoubleHi(node); | 40 return ReduceInlineDoubleHi(node); |
| 41 case Runtime::kInlineIsRegExp: | 41 case Runtime::kInlineIsRegExp: |
| 42 return ReduceInlineIsInstanceType(node, JS_REGEXP_TYPE); | 42 return ReduceInlineIsInstanceType(node, JS_REGEXP_TYPE); |
| 43 case Runtime::kInlineMathFloor: |
| 44 return ReduceInlineMathFloor(node); |
| 43 case Runtime::kInlineValueOf: | 45 case Runtime::kInlineValueOf: |
| 44 return ReduceInlineValueOf(node); | 46 return ReduceInlineValueOf(node); |
| 45 default: | 47 default: |
| 46 break; | 48 break; |
| 47 } | 49 } |
| 48 return NoChange(); | 50 return NoChange(); |
| 49 } | 51 } |
| 50 | 52 |
| 51 | 53 |
| 52 Reduction JSIntrinsicLowering::ReduceInlineDeoptimizeNow(Node* node) { | 54 Reduction JSIntrinsicLowering::ReduceInlineDeoptimizeNow(Node* node) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 157 |
| 156 // Replace all effect uses of {node} with the {ephi}. | 158 // Replace all effect uses of {node} with the {ephi}. |
| 157 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge); | 159 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge); |
| 158 NodeProperties::ReplaceWithValue(node, node, ephi); | 160 NodeProperties::ReplaceWithValue(node, node, ephi); |
| 159 | 161 |
| 160 // Turn the {node} into a Phi. | 162 // Turn the {node} into a Phi. |
| 161 return Change(node, common()->Phi(type, 2), vtrue, vfalse, merge); | 163 return Change(node, common()->Phi(type, 2), vtrue, vfalse, merge); |
| 162 } | 164 } |
| 163 | 165 |
| 164 | 166 |
| 167 Reduction JSIntrinsicLowering::ReduceInlineMathFloor(Node* node) { |
| 168 if (!machine()->HasFloat64RoundDown()) return NoChange(); |
| 169 return Change(node, machine()->Float64RoundDown()); |
| 170 } |
| 171 |
| 172 |
| 165 Reduction JSIntrinsicLowering::ReduceInlineValueOf(Node* node) { | 173 Reduction JSIntrinsicLowering::ReduceInlineValueOf(Node* node) { |
| 166 // if (%_IsSmi(value)) { | 174 // if (%_IsSmi(value)) { |
| 167 // return value; | 175 // return value; |
| 168 // } else if (%_GetInstanceType(%_GetMap(value)) == JS_VALUE_TYPE) { | 176 // } else if (%_GetInstanceType(%_GetMap(value)) == JS_VALUE_TYPE) { |
| 169 // return %_GetValue(value); | 177 // return %_GetValue(value); |
| 170 // } else { | 178 // } else { |
| 171 // return value; | 179 // return value; |
| 172 // } | 180 // } |
| 173 const Operator* const merge_op = common()->Merge(2); | 181 const Operator* const merge_op = common()->Merge(2); |
| 174 const Operator* const ephi_op = common()->EffectPhi(2); | 182 const Operator* const ephi_op = common()->EffectPhi(2); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 263 } |
| 256 | 264 |
| 257 | 265 |
| 258 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { | 266 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { |
| 259 return jsgraph()->machine(); | 267 return jsgraph()->machine(); |
| 260 } | 268 } |
| 261 | 269 |
| 262 } // namespace compiler | 270 } // namespace compiler |
| 263 } // namespace internal | 271 } // namespace internal |
| 264 } // namespace v8 | 272 } // namespace v8 |
| OLD | NEW |