| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/change-lowering.h" | 5 #include "src/compiler/change-lowering.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 Reduction ChangeLowering::ChangeTaggedToFloat64(Node* value, Node* control) { | 235 Reduction ChangeLowering::ChangeTaggedToFloat64(Node* value, Node* control) { |
| 236 if (CanCover(value, IrOpcode::kJSToNumber)) { | 236 if (CanCover(value, IrOpcode::kJSToNumber)) { |
| 237 // ChangeTaggedToFloat64(JSToNumber(x)) => | 237 // ChangeTaggedToFloat64(JSToNumber(x)) => |
| 238 // if IsSmi(x) then ChangeSmiToFloat64(x) | 238 // if IsSmi(x) then ChangeSmiToFloat64(x) |
| 239 // else let y = JSToNumber(x) in | 239 // else let y = JSToNumber(x) in |
| 240 // if IsSmi(y) then ChangeSmiToFloat64(y) | 240 // if IsSmi(y) then ChangeSmiToFloat64(y) |
| 241 // else LoadHeapNumberValue(y) | 241 // else LoadHeapNumberValue(y) |
| 242 Node* const object = NodeProperties::GetValueInput(value, 0); | 242 Node* const object = NodeProperties::GetValueInput(value, 0); |
| 243 Node* const context = NodeProperties::GetContextInput(value); | 243 Node* const context = NodeProperties::GetContextInput(value); |
| 244 Node* const frame_state = NodeProperties::GetFrameStateInput(value, 0); |
| 244 Node* const effect = NodeProperties::GetEffectInput(value); | 245 Node* const effect = NodeProperties::GetEffectInput(value); |
| 245 Node* const control = NodeProperties::GetControlInput(value); | 246 Node* const control = NodeProperties::GetControlInput(value); |
| 246 | 247 |
| 247 const Operator* merge_op = common()->Merge(2); | 248 const Operator* merge_op = common()->Merge(2); |
| 248 const Operator* ephi_op = common()->EffectPhi(2); | 249 const Operator* ephi_op = common()->EffectPhi(2); |
| 249 const Operator* phi_op = common()->Phi(kMachFloat64, 2); | 250 const Operator* phi_op = common()->Phi(kMachFloat64, 2); |
| 250 | 251 |
| 251 Node* check1 = TestNotSmi(object); | 252 Node* check1 = TestNotSmi(object); |
| 252 Node* branch1 = | 253 Node* branch1 = |
| 253 graph()->NewNode(common()->Branch(BranchHint::kFalse), check1, control); | 254 graph()->NewNode(common()->Branch(BranchHint::kFalse), check1, control); |
| 254 | 255 |
| 255 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); | 256 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); |
| 256 Node* vtrue1 = | 257 Node* vtrue1 = graph()->NewNode(value->op(), object, context, frame_state, |
| 257 FLAG_turbo_deoptimization | 258 effect, if_true1); |
| 258 ? graph()->NewNode(value->op(), object, context, | |
| 259 NodeProperties::GetFrameStateInput(value, 0), | |
| 260 effect, if_true1) | |
| 261 : graph()->NewNode(value->op(), object, context, effect, if_true1); | |
| 262 Node* etrue1 = vtrue1; | 259 Node* etrue1 = vtrue1; |
| 263 { | 260 { |
| 264 Node* check2 = TestNotSmi(vtrue1); | 261 Node* check2 = TestNotSmi(vtrue1); |
| 265 Node* branch2 = graph()->NewNode(common()->Branch(), check2, if_true1); | 262 Node* branch2 = graph()->NewNode(common()->Branch(), check2, if_true1); |
| 266 | 263 |
| 267 Node* if_true2 = graph()->NewNode(common()->IfTrue(), branch2); | 264 Node* if_true2 = graph()->NewNode(common()->IfTrue(), branch2); |
| 268 Node* vtrue2 = LoadHeapNumberValue(vtrue1, if_true2); | 265 Node* vtrue2 = LoadHeapNumberValue(vtrue1, if_true2); |
| 269 | 266 |
| 270 Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2); | 267 Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2); |
| 271 Node* vfalse2 = ChangeSmiToFloat64(vtrue1); | 268 Node* vfalse2 = ChangeSmiToFloat64(vtrue1); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 } | 337 } |
| 341 | 338 |
| 342 | 339 |
| 343 MachineOperatorBuilder* ChangeLowering::machine() const { | 340 MachineOperatorBuilder* ChangeLowering::machine() const { |
| 344 return jsgraph()->machine(); | 341 return jsgraph()->machine(); |
| 345 } | 342 } |
| 346 | 343 |
| 347 } // namespace compiler | 344 } // namespace compiler |
| 348 } // namespace internal | 345 } // namespace internal |
| 349 } // namespace v8 | 346 } // namespace v8 |
| OLD | NEW |