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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // A helper class to simplify the process of reducing a single binop node with a | 21 // A helper class to simplify the process of reducing a single binop node with a |
22 // JSOperator. This class manages the rewriting of context, control, and effect | 22 // JSOperator. This class manages the rewriting of context, control, and effect |
23 // dependencies during lowering of a binop and contains numerous helper | 23 // dependencies during lowering of a binop and contains numerous helper |
24 // functions for matching the types of inputs to an operation. | 24 // functions for matching the types of inputs to an operation. |
25 class JSBinopReduction final { | 25 class JSBinopReduction final { |
26 public: | 26 public: |
27 JSBinopReduction(JSTypedLowering* lowering, Node* node) | 27 JSBinopReduction(JSTypedLowering* lowering, Node* node) |
28 : lowering_(lowering), node_(node) {} | 28 : lowering_(lowering), node_(node) {} |
29 | 29 |
30 BinaryOperationHints::Hint GetNumberBinaryOperationFeedback() { | 30 BinaryOperationHints::Hint GetNumberBinaryOperationFeedback() { |
31 if (!(lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) || | 31 if (lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) { |
32 !(lowering_->flags() & JSTypedLowering::kTypeFeedbackEnabled)) { | 32 DCHECK_NE(0, node_->op()->ControlOutputCount()); |
33 return BinaryOperationHints::kAny; | 33 DCHECK_EQ(1, node_->op()->EffectOutputCount()); |
34 } | 34 DCHECK_LE(1, OperatorProperties::GetFrameStateInputCount(node_->op())); |
35 DCHECK_NE(0, node_->op()->ControlOutputCount()); | 35 BinaryOperationHints hints = BinaryOperationHintsOf(node_->op()); |
36 DCHECK_EQ(1, node_->op()->EffectOutputCount()); | 36 BinaryOperationHints::Hint combined = hints.combined(); |
37 DCHECK_LE(1, OperatorProperties::GetFrameStateInputCount(node_->op())); | 37 if (combined == BinaryOperationHints::kSignedSmall || |
38 BinaryOperationHints hints = BinaryOperationHintsOf(node_->op()); | 38 combined == BinaryOperationHints::kSigned32 || |
39 BinaryOperationHints::Hint combined = hints.combined(); | 39 combined == BinaryOperationHints::kNumberOrOddball) { |
40 if (combined == BinaryOperationHints::kSignedSmall || | 40 return combined; |
41 combined == BinaryOperationHints::kSigned32 || | 41 } |
42 combined == BinaryOperationHints::kNumberOrOddball) { | |
43 return combined; | |
44 } | 42 } |
45 return BinaryOperationHints::kAny; | 43 return BinaryOperationHints::kAny; |
46 } | 44 } |
47 | 45 |
48 CompareOperationHints::Hint GetNumberCompareOperationFeedback() { | 46 CompareOperationHints::Hint GetNumberCompareOperationFeedback() { |
49 if (!(lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) || | 47 if (lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) { |
50 !(lowering_->flags() & JSTypedLowering::kTypeFeedbackEnabled)) { | 48 DCHECK_NE(0, node_->op()->ControlOutputCount()); |
51 return CompareOperationHints::kAny; | 49 DCHECK_EQ(1, node_->op()->EffectOutputCount()); |
52 } | 50 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node_->op())); |
53 DCHECK_NE(0, node_->op()->ControlOutputCount()); | 51 CompareOperationHints hints = CompareOperationHintsOf(node_->op()); |
54 DCHECK_EQ(1, node_->op()->EffectOutputCount()); | 52 CompareOperationHints::Hint combined = hints.combined(); |
55 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node_->op())); | 53 if (combined == CompareOperationHints::kSignedSmall || |
56 CompareOperationHints hints = CompareOperationHintsOf(node_->op()); | 54 combined == CompareOperationHints::kNumberOrOddball) { |
57 CompareOperationHints::Hint combined = hints.combined(); | 55 return combined; |
58 if (combined == CompareOperationHints::kSignedSmall || | 56 } |
59 combined == CompareOperationHints::kNumberOrOddball) { | |
60 return combined; | |
61 } | 57 } |
62 return CompareOperationHints::kAny; | 58 return CompareOperationHints::kAny; |
63 } | 59 } |
64 | 60 |
65 void ConvertInputsToNumber() { | 61 void ConvertInputsToNumber() { |
66 // To convert the inputs to numbers, we have to provide frame states | 62 // To convert the inputs to numbers, we have to provide frame states |
67 // for lazy bailouts in the ToNumber conversions. | 63 // for lazy bailouts in the ToNumber conversions. |
68 // We use a little hack here: we take the frame state before the binary | 64 // We use a little hack here: we take the frame state before the binary |
69 // operation and use it to construct the frame states for the conversion | 65 // operation and use it to construct the frame states for the conversion |
70 // so that after the deoptimization, the binary operation IC gets | 66 // so that after the deoptimization, the binary operation IC gets |
(...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2059 } | 2055 } |
2060 | 2056 |
2061 | 2057 |
2062 CompilationDependencies* JSTypedLowering::dependencies() const { | 2058 CompilationDependencies* JSTypedLowering::dependencies() const { |
2063 return dependencies_; | 2059 return dependencies_; |
2064 } | 2060 } |
2065 | 2061 |
2066 } // namespace compiler | 2062 } // namespace compiler |
2067 } // namespace internal | 2063 } // namespace internal |
2068 } // namespace v8 | 2064 } // namespace v8 |
OLD | NEW |