| 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/effect-control-linearizer.h" | 5 #include "src/compiler/effect-control-linearizer.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 // Schedule the call's IfSuccess node (if there is no exception use). | 335 // Schedule the call's IfSuccess node (if there is no exception use). |
| 336 TryScheduleCallIfSuccess(node, control); | 336 TryScheduleCallIfSuccess(node, control); |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 } | 339 } |
| 340 | 340 |
| 341 bool EffectControlLinearizer::TryWireInStateEffect(Node* node, Node** effect, | 341 bool EffectControlLinearizer::TryWireInStateEffect(Node* node, Node** effect, |
| 342 Node** control) { | 342 Node** control) { |
| 343 ValueEffectControl state(nullptr, nullptr, nullptr); | 343 ValueEffectControl state(nullptr, nullptr, nullptr); |
| 344 switch (node->opcode()) { | 344 switch (node->opcode()) { |
| 345 case IrOpcode::kGuard: |
| 346 state = LowerGuard(node, *effect, *control); |
| 347 break; |
| 345 case IrOpcode::kChangeBitToTagged: | 348 case IrOpcode::kChangeBitToTagged: |
| 346 state = LowerChangeBitToTagged(node, *effect, *control); | 349 state = LowerChangeBitToTagged(node, *effect, *control); |
| 347 break; | 350 break; |
| 348 case IrOpcode::kChangeInt31ToTaggedSigned: | 351 case IrOpcode::kChangeInt31ToTaggedSigned: |
| 349 state = LowerChangeInt31ToTaggedSigned(node, *effect, *control); | 352 state = LowerChangeInt31ToTaggedSigned(node, *effect, *control); |
| 350 break; | 353 break; |
| 351 case IrOpcode::kChangeInt32ToTagged: | 354 case IrOpcode::kChangeInt32ToTagged: |
| 352 state = LowerChangeInt32ToTagged(node, *effect, *control); | 355 state = LowerChangeInt32ToTagged(node, *effect, *control); |
| 353 break; | 356 break; |
| 354 case IrOpcode::kChangeUint32ToTagged: | 357 case IrOpcode::kChangeUint32ToTagged: |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 break; | 398 break; |
| 396 default: | 399 default: |
| 397 return false; | 400 return false; |
| 398 } | 401 } |
| 399 NodeProperties::ReplaceUses(node, state.value); | 402 NodeProperties::ReplaceUses(node, state.value); |
| 400 *effect = state.effect; | 403 *effect = state.effect; |
| 401 *control = state.control; | 404 *control = state.control; |
| 402 return true; | 405 return true; |
| 403 } | 406 } |
| 404 | 407 |
| 408 EffectControlLinearizer::ValueEffectControl EffectControlLinearizer::LowerGuard( |
| 409 Node* node, Node* effect, Node* control) { |
| 410 Node* value = node->InputAt(0); |
| 411 return ValueEffectControl(value, effect, control); |
| 412 } |
| 413 |
| 405 EffectControlLinearizer::ValueEffectControl | 414 EffectControlLinearizer::ValueEffectControl |
| 406 EffectControlLinearizer::LowerChangeFloat64ToTagged(Node* node, Node* effect, | 415 EffectControlLinearizer::LowerChangeFloat64ToTagged(Node* node, Node* effect, |
| 407 Node* control) { | 416 Node* control) { |
| 408 Node* value = node->InputAt(0); | 417 Node* value = node->InputAt(0); |
| 409 | 418 |
| 410 Node* value32 = graph()->NewNode(machine()->RoundFloat64ToInt32(), value); | 419 Node* value32 = graph()->NewNode(machine()->RoundFloat64ToInt32(), value); |
| 411 Node* check_same = graph()->NewNode( | 420 Node* check_same = graph()->NewNode( |
| 412 machine()->Float64Equal(), value, | 421 machine()->Float64Equal(), value, |
| 413 graph()->NewNode(machine()->ChangeInt32ToFloat64(), value32)); | 422 graph()->NewNode(machine()->ChangeInt32ToFloat64(), value32)); |
| 414 Node* branch_same = graph()->NewNode(common()->Branch(), check_same, control); | 423 Node* branch_same = graph()->NewNode(common()->Branch(), check_same, control); |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 return jsgraph()->Int32Constant(Smi::kMaxValue); | 964 return jsgraph()->Int32Constant(Smi::kMaxValue); |
| 956 } | 965 } |
| 957 | 966 |
| 958 Node* EffectControlLinearizer::SmiShiftBitsConstant() { | 967 Node* EffectControlLinearizer::SmiShiftBitsConstant() { |
| 959 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize); | 968 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize); |
| 960 } | 969 } |
| 961 | 970 |
| 962 } // namespace compiler | 971 } // namespace compiler |
| 963 } // namespace internal | 972 } // namespace internal |
| 964 } // namespace v8 | 973 } // namespace v8 |
| OLD | NEW |