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/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/address-map.h" | 9 #include "src/address-map.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 Node* effect = NodeProperties::GetEffectInput(node); | 1084 Node* effect = NodeProperties::GetEffectInput(node); |
1085 ReplaceEffectControlUses(node, effect, control); | 1085 ReplaceEffectControlUses(node, effect, control); |
1086 node->TrimInputCount(new_op->ValueInputCount()); | 1086 node->TrimInputCount(new_op->ValueInputCount()); |
1087 } else { | 1087 } else { |
1088 DCHECK_EQ(0, node->op()->ControlInputCount()); | 1088 DCHECK_EQ(0, node->op()->ControlInputCount()); |
1089 } | 1089 } |
1090 | 1090 |
1091 NodeProperties::ChangeOp(node, new_op); | 1091 NodeProperties::ChangeOp(node, new_op); |
1092 } | 1092 } |
1093 | 1093 |
1094 void ChangeToInt32OverflowOp(Node* node, const Operator* op) { | 1094 void ChangeToInt32OverflowOp(Node* node, const Operator* new_op) { |
1095 Node* effect = NodeProperties::GetEffectInput(node); | 1095 NodeProperties::ChangeOp(node, new_op); |
1096 Node* control = NodeProperties::GetControlInput(node); | |
1097 Node* arith = graph()->NewNode(op, node->InputAt(0), node->InputAt(1)); | |
1098 Node* overflow = graph()->NewNode(common()->Projection(1), arith); | |
1099 effect = | |
1100 graph()->NewNode(simplified()->CheckIf(), overflow, effect, control); | |
1101 Node* value = graph()->NewNode(common()->Projection(0), arith); | |
1102 ReplaceEffectControlUses(node, effect, control); | |
1103 DeferReplacement(node, value); | |
1104 } | 1096 } |
1105 | 1097 |
1106 void VisitSpeculativeAdditiveOp(Node* node, Truncation truncation, | 1098 void VisitSpeculativeAdditiveOp(Node* node, Truncation truncation, |
1107 SimplifiedLowering* lowering) { | 1099 SimplifiedLowering* lowering) { |
1108 if (BothInputsAre(node, type_cache_.kSigned32OrMinusZero) && | 1100 if (BothInputsAre(node, type_cache_.kSigned32OrMinusZero) && |
1109 NodeProperties::GetType(node)->Is(Type::Signed32())) { | 1101 NodeProperties::GetType(node)->Is(Type::Signed32())) { |
1110 // int32 + int32 = int32 ==> signed Int32Add/Sub | 1102 // int32 + int32 = int32 ==> signed Int32Add/Sub |
1111 VisitInt32Binop(node); | 1103 VisitInt32Binop(node); |
1112 if (lower()) ChangeToPureOp(node, Int32Op(node)); | 1104 if (lower()) ChangeToPureOp(node, Int32Op(node)); |
1113 return; | 1105 return; |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 case IrOpcode::kStateValues: | 2013 case IrOpcode::kStateValues: |
2022 return VisitStateValues(node); | 2014 return VisitStateValues(node); |
2023 | 2015 |
2024 // The following opcodes are not produced before representation | 2016 // The following opcodes are not produced before representation |
2025 // inference runs, so we do not have any real test coverage. | 2017 // inference runs, so we do not have any real test coverage. |
2026 // Simply fail here. | 2018 // Simply fail here. |
2027 case IrOpcode::kChangeFloat64ToInt32: | 2019 case IrOpcode::kChangeFloat64ToInt32: |
2028 case IrOpcode::kChangeFloat64ToUint32: | 2020 case IrOpcode::kChangeFloat64ToUint32: |
2029 case IrOpcode::kTruncateInt64ToInt32: | 2021 case IrOpcode::kTruncateInt64ToInt32: |
2030 case IrOpcode::kChangeFloat32ToFloat64: | 2022 case IrOpcode::kChangeFloat32ToFloat64: |
| 2023 case IrOpcode::kCheckedInt32Add: |
| 2024 case IrOpcode::kCheckedInt32Sub: |
2031 case IrOpcode::kCheckedUint32ToInt32: | 2025 case IrOpcode::kCheckedUint32ToInt32: |
2032 case IrOpcode::kCheckedFloat64ToInt32: | 2026 case IrOpcode::kCheckedFloat64ToInt32: |
2033 case IrOpcode::kCheckedTaggedToInt32: | 2027 case IrOpcode::kCheckedTaggedToInt32: |
2034 case IrOpcode::kCheckedTaggedToFloat64: | 2028 case IrOpcode::kCheckedTaggedToFloat64: |
2035 case IrOpcode::kPlainPrimitiveToWord32: | 2029 case IrOpcode::kPlainPrimitiveToWord32: |
2036 case IrOpcode::kPlainPrimitiveToFloat64: | 2030 case IrOpcode::kPlainPrimitiveToFloat64: |
2037 FATAL("Representation inference: unsupported opcodes."); | 2031 FATAL("Representation inference: unsupported opcodes."); |
2038 break; | 2032 break; |
2039 | 2033 |
2040 default: | 2034 default: |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3056 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3050 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3057 Operator::kNoProperties); | 3051 Operator::kNoProperties); |
3058 to_number_operator_.set(common()->Call(desc)); | 3052 to_number_operator_.set(common()->Call(desc)); |
3059 } | 3053 } |
3060 return to_number_operator_.get(); | 3054 return to_number_operator_.get(); |
3061 } | 3055 } |
3062 | 3056 |
3063 } // namespace compiler | 3057 } // namespace compiler |
3064 } // namespace internal | 3058 } // namespace internal |
3065 } // namespace v8 | 3059 } // namespace v8 |
OLD | NEW |