| 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/js-typed-lowering.h" | 5 #include "src/compiler/js-typed-lowering.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compilation-dependencies.h" | 8 #include "src/compilation-dependencies.h" |
| 9 #include "src/compiler/access-builder.h" | 9 #include "src/compiler/access-builder.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class JSBinopReduction final { | 26 class JSBinopReduction final { |
| 27 public: | 27 public: |
| 28 JSBinopReduction(JSTypedLowering* lowering, Node* node) | 28 JSBinopReduction(JSTypedLowering* lowering, Node* node) |
| 29 : lowering_(lowering), node_(node) {} | 29 : lowering_(lowering), node_(node) {} |
| 30 | 30 |
| 31 bool GetBinaryNumberOperationHint(NumberOperationHint* hint) { | 31 bool GetBinaryNumberOperationHint(NumberOperationHint* hint) { |
| 32 if (lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) { | 32 if (lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) { |
| 33 DCHECK_NE(0, node_->op()->ControlOutputCount()); | 33 DCHECK_NE(0, node_->op()->ControlOutputCount()); |
| 34 DCHECK_EQ(1, node_->op()->EffectOutputCount()); | 34 DCHECK_EQ(1, node_->op()->EffectOutputCount()); |
| 35 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node_->op())); | 35 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node_->op())); |
| 36 BinaryOperationHints hints = BinaryOperationHintsOf(node_->op()); | 36 switch (BinaryOperationHintOf(node_->op())) { |
| 37 switch (hints.combined()) { | 37 case BinaryOperationHint::kSignedSmall: |
| 38 case BinaryOperationHints::kSignedSmall: | |
| 39 *hint = NumberOperationHint::kSignedSmall; | 38 *hint = NumberOperationHint::kSignedSmall; |
| 40 return true; | 39 return true; |
| 41 case BinaryOperationHints::kSigned32: | 40 case BinaryOperationHint::kSigned32: |
| 42 *hint = NumberOperationHint::kSigned32; | 41 *hint = NumberOperationHint::kSigned32; |
| 43 return true; | 42 return true; |
| 44 case BinaryOperationHints::kNumberOrOddball: | 43 case BinaryOperationHint::kNumberOrOddball: |
| 45 *hint = NumberOperationHint::kNumberOrOddball; | 44 *hint = NumberOperationHint::kNumberOrOddball; |
| 46 return true; | 45 return true; |
| 47 case BinaryOperationHints::kAny: | 46 case BinaryOperationHint::kAny: |
| 48 case BinaryOperationHints::kNone: | 47 case BinaryOperationHint::kNone: |
| 49 case BinaryOperationHints::kString: | |
| 50 break; | 48 break; |
| 51 } | 49 } |
| 52 } | 50 } |
| 53 return false; | 51 return false; |
| 54 } | 52 } |
| 55 | 53 |
| 56 bool GetCompareNumberOperationHint(NumberOperationHint* hint) { | 54 bool GetCompareNumberOperationHint(NumberOperationHint* hint) { |
| 57 if (lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) { | 55 if (lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) { |
| 58 DCHECK_EQ(1, node_->op()->EffectOutputCount()); | 56 DCHECK_EQ(1, node_->op()->EffectOutputCount()); |
| 59 CompareOperationHints hints = CompareOperationHintsOf(node_->op()); | 57 switch (CompareOperationHintOf(node_->op())) { |
| 60 switch (hints.combined()) { | 58 case CompareOperationHint::kSignedSmall: |
| 61 case CompareOperationHints::kSignedSmall: | |
| 62 *hint = NumberOperationHint::kSignedSmall; | 59 *hint = NumberOperationHint::kSignedSmall; |
| 63 return true; | 60 return true; |
| 64 case CompareOperationHints::kNumber: | 61 case CompareOperationHint::kNumber: |
| 65 *hint = NumberOperationHint::kNumber; | 62 *hint = NumberOperationHint::kNumber; |
| 66 return true; | 63 return true; |
| 67 case CompareOperationHints::kNumberOrOddball: | 64 case CompareOperationHint::kNumberOrOddball: |
| 68 *hint = NumberOperationHint::kNumberOrOddball; | 65 *hint = NumberOperationHint::kNumberOrOddball; |
| 69 return true; | 66 return true; |
| 70 case CompareOperationHints::kAny: | 67 case CompareOperationHint::kAny: |
| 71 case CompareOperationHints::kNone: | 68 case CompareOperationHint::kNone: |
| 72 case CompareOperationHints::kString: | |
| 73 case CompareOperationHints::kBoolean: | |
| 74 case CompareOperationHints::kUniqueName: | |
| 75 case CompareOperationHints::kInternalizedString: | |
| 76 case CompareOperationHints::kReceiver: | |
| 77 break; | 69 break; |
| 78 } | 70 } |
| 79 } | 71 } |
| 80 return false; | 72 return false; |
| 81 } | 73 } |
| 82 | 74 |
| 83 void ConvertInputsToNumber() { | 75 void ConvertInputsToNumber() { |
| 84 // To convert the inputs to numbers, we have to provide frame states | 76 // To convert the inputs to numbers, we have to provide frame states |
| 85 // for lazy bailouts in the ToNumber conversions. | 77 // for lazy bailouts in the ToNumber conversions. |
| 86 // We use a little hack here: we take the frame state before the binary | 78 // We use a little hack here: we take the frame state before the binary |
| (...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2164 } | 2156 } |
| 2165 | 2157 |
| 2166 | 2158 |
| 2167 CompilationDependencies* JSTypedLowering::dependencies() const { | 2159 CompilationDependencies* JSTypedLowering::dependencies() const { |
| 2168 return dependencies_; | 2160 return dependencies_; |
| 2169 } | 2161 } |
| 2170 | 2162 |
| 2171 } // namespace compiler | 2163 } // namespace compiler |
| 2172 } // namespace internal | 2164 } // namespace internal |
| 2173 } // namespace v8 | 2165 } // namespace v8 |
| OLD | NEW |