| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 if (TryWireInStateEffect(node, effect, control)) { | 283 if (TryWireInStateEffect(node, effect, control)) { |
| 284 return; | 284 return; |
| 285 } | 285 } |
| 286 | 286 |
| 287 // Remove the end markers of 'atomic' allocation region because the | 287 // Remove the end markers of 'atomic' allocation region because the |
| 288 // region should be wired-in now. | 288 // region should be wired-in now. |
| 289 if (node->opcode() == IrOpcode::kFinishRegion || | 289 if (node->opcode() == IrOpcode::kFinishRegion || |
| 290 node->opcode() == IrOpcode::kBeginRegion) { | 290 node->opcode() == IrOpcode::kBeginRegion) { |
| 291 // Update the value uses to the value input of the finish node and | 291 // Update the value uses to the value input of the finish node and |
| 292 // the effect uses to the effect input. | 292 // the effect uses to the effect input. |
| 293 | 293 return RemoveRegionNode(node); |
| 294 // TODO(jarin) Enable this once we make sure everything with side effects | |
| 295 // is marked as effectful. | |
| 296 if (false) { | |
| 297 return RemoveRegionNode(node); | |
| 298 } | |
| 299 } | 294 } |
| 300 | 295 |
| 301 if (node->opcode() == IrOpcode::kIfSuccess) { | 296 if (node->opcode() == IrOpcode::kIfSuccess) { |
| 302 // We always schedule IfSuccess with its call, so skip it here. | 297 // We always schedule IfSuccess with its call, so skip it here. |
| 303 DCHECK_EQ(IrOpcode::kCall, node->InputAt(0)->opcode()); | 298 DCHECK_EQ(IrOpcode::kCall, node->InputAt(0)->opcode()); |
| 304 // The IfSuccess node should not belong to an exceptional call node | 299 // The IfSuccess node should not belong to an exceptional call node |
| 305 // because such IfSuccess nodes should only start a basic block (and | 300 // because such IfSuccess nodes should only start a basic block (and |
| 306 // basic block start nodes are not handled in the ProcessNode method). | 301 // basic block start nodes are not handled in the ProcessNode method). |
| 307 DCHECK(!NodeProperties::IsExceptionalCall(node->InputAt(0))); | 302 DCHECK(!NodeProperties::IsExceptionalCall(node->InputAt(0))); |
| 308 return; | 303 return; |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); | 896 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); |
| 902 value = graph()->NewNode(common()->Phi(MachineRepresentation::kBit, 2), vtrue, | 897 value = graph()->NewNode(common()->Phi(MachineRepresentation::kBit, 2), vtrue, |
| 903 vfalse, control); | 898 vfalse, control); |
| 904 | 899 |
| 905 return ValueEffectControl(value, effect, control); | 900 return ValueEffectControl(value, effect, control); |
| 906 } | 901 } |
| 907 | 902 |
| 908 EffectControlLinearizer::ValueEffectControl | 903 EffectControlLinearizer::ValueEffectControl |
| 909 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect, | 904 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect, |
| 910 Node* control) { | 905 Node* control) { |
| 911 effect = graph()->NewNode(common()->BeginRegion(), effect); | |
| 912 Node* result = effect = graph()->NewNode( | 906 Node* result = effect = graph()->NewNode( |
| 913 simplified()->Allocate(NOT_TENURED), | 907 simplified()->Allocate(NOT_TENURED), |
| 914 jsgraph()->Int32Constant(HeapNumber::kSize), effect, control); | 908 jsgraph()->Int32Constant(HeapNumber::kSize), effect, control); |
| 915 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), | 909 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), |
| 916 result, jsgraph()->HeapNumberMapConstant(), effect, | 910 result, jsgraph()->HeapNumberMapConstant(), effect, |
| 917 control); | 911 control); |
| 918 effect = graph()->NewNode( | 912 effect = graph()->NewNode( |
| 919 simplified()->StoreField(AccessBuilder::ForHeapNumberValue()), result, | 913 simplified()->StoreField(AccessBuilder::ForHeapNumberValue()), result, |
| 920 value, effect, control); | 914 value, effect, control); |
| 921 result = effect = graph()->NewNode(common()->FinishRegion(), result, effect); | |
| 922 return ValueEffectControl(result, effect, control); | 915 return ValueEffectControl(result, effect, control); |
| 923 } | 916 } |
| 924 | 917 |
| 925 Node* EffectControlLinearizer::ChangeInt32ToSmi(Node* value) { | 918 Node* EffectControlLinearizer::ChangeInt32ToSmi(Node* value) { |
| 926 if (machine()->Is64()) { | 919 if (machine()->Is64()) { |
| 927 value = graph()->NewNode(machine()->ChangeInt32ToInt64(), value); | 920 value = graph()->NewNode(machine()->ChangeInt32ToInt64(), value); |
| 928 } | 921 } |
| 929 return graph()->NewNode(machine()->WordShl(), value, SmiShiftBitsConstant()); | 922 return graph()->NewNode(machine()->WordShl(), value, SmiShiftBitsConstant()); |
| 930 } | 923 } |
| 931 | 924 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 return jsgraph()->Int32Constant(Smi::kMaxValue); | 957 return jsgraph()->Int32Constant(Smi::kMaxValue); |
| 965 } | 958 } |
| 966 | 959 |
| 967 Node* EffectControlLinearizer::SmiShiftBitsConstant() { | 960 Node* EffectControlLinearizer::SmiShiftBitsConstant() { |
| 968 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize); | 961 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize); |
| 969 } | 962 } |
| 970 | 963 |
| 971 } // namespace compiler | 964 } // namespace compiler |
| 972 } // namespace internal | 965 } // namespace internal |
| 973 } // namespace v8 | 966 } // namespace v8 |
| OLD | NEW |