Index: src/crankshaft/hydrogen-instructions.h |
diff --git a/src/crankshaft/hydrogen-instructions.h b/src/crankshaft/hydrogen-instructions.h |
index ea9be601a771760bd2fdd4e4fcbcf115d02bbebe..0386855c42b4b0380341aa186d1967b28929d958 100644 |
--- a/src/crankshaft/hydrogen-instructions.h |
+++ b/src/crankshaft/hydrogen-instructions.h |
@@ -56,7 +56,6 @@ class LChunkBuilder; |
V(Bitwise) \ |
V(BlockEntry) \ |
V(BoundsCheck) \ |
- V(BoundsCheckBaseIndexInformation) \ |
V(Branch) \ |
V(CallWithDescriptor) \ |
V(CallNewArray) \ |
@@ -732,14 +731,6 @@ class HValue : public ZoneObject { |
virtual void Verify() = 0; |
#endif |
- virtual bool TryDecompose(DecompositionResult* decomposition) { |
- if (RedefinedOperand() != NULL) { |
- return RedefinedOperand()->TryDecompose(decomposition); |
- } else { |
- return false; |
- } |
- } |
- |
// Returns true conservatively if the program might be able to observe a |
// ToString() operation on this value. |
bool ToStringCanBeObserved() const { |
@@ -2948,226 +2939,6 @@ class HCheckHeapObject final : public HUnaryOperation { |
}; |
-class InductionVariableData; |
- |
- |
-struct InductionVariableLimitUpdate { |
- InductionVariableData* updated_variable; |
- HValue* limit; |
- bool limit_is_upper; |
- bool limit_is_included; |
- |
- InductionVariableLimitUpdate() |
- : updated_variable(NULL), limit(NULL), |
- limit_is_upper(false), limit_is_included(false) {} |
-}; |
- |
- |
-class HBoundsCheck; |
-class HPhi; |
-class HBitwise; |
- |
- |
-class InductionVariableData final : public ZoneObject { |
- public: |
- class InductionVariableCheck : public ZoneObject { |
- public: |
- HBoundsCheck* check() { return check_; } |
- InductionVariableCheck* next() { return next_; } |
- bool HasUpperLimit() { return upper_limit_ >= 0; } |
- int32_t upper_limit() { |
- DCHECK(HasUpperLimit()); |
- return upper_limit_; |
- } |
- void set_upper_limit(int32_t upper_limit) { |
- upper_limit_ = upper_limit; |
- } |
- |
- bool processed() { return processed_; } |
- void set_processed() { processed_ = true; } |
- |
- InductionVariableCheck(HBoundsCheck* check, |
- InductionVariableCheck* next, |
- int32_t upper_limit = kNoLimit) |
- : check_(check), next_(next), upper_limit_(upper_limit), |
- processed_(false) {} |
- |
- private: |
- HBoundsCheck* check_; |
- InductionVariableCheck* next_; |
- int32_t upper_limit_; |
- bool processed_; |
- }; |
- |
- class ChecksRelatedToLength : public ZoneObject { |
- public: |
- HValue* length() { return length_; } |
- ChecksRelatedToLength* next() { return next_; } |
- InductionVariableCheck* checks() { return checks_; } |
- |
- void AddCheck(HBoundsCheck* check, int32_t upper_limit = kNoLimit); |
- void CloseCurrentBlock(); |
- |
- ChecksRelatedToLength(HValue* length, ChecksRelatedToLength* next) |
- : length_(length), next_(next), checks_(NULL), |
- first_check_in_block_(NULL), |
- added_index_(NULL), |
- added_constant_(NULL), |
- current_and_mask_in_block_(0), |
- current_or_mask_in_block_(0) {} |
- |
- private: |
- void UseNewIndexInCurrentBlock(Token::Value token, |
- int32_t mask, |
- HValue* index_base, |
- HValue* context); |
- |
- HBoundsCheck* first_check_in_block() { return first_check_in_block_; } |
- HBitwise* added_index() { return added_index_; } |
- void set_added_index(HBitwise* index) { added_index_ = index; } |
- HConstant* added_constant() { return added_constant_; } |
- void set_added_constant(HConstant* constant) { added_constant_ = constant; } |
- int32_t current_and_mask_in_block() { return current_and_mask_in_block_; } |
- int32_t current_or_mask_in_block() { return current_or_mask_in_block_; } |
- int32_t current_upper_limit() { return current_upper_limit_; } |
- |
- HValue* length_; |
- ChecksRelatedToLength* next_; |
- InductionVariableCheck* checks_; |
- |
- HBoundsCheck* first_check_in_block_; |
- HBitwise* added_index_; |
- HConstant* added_constant_; |
- int32_t current_and_mask_in_block_; |
- int32_t current_or_mask_in_block_; |
- int32_t current_upper_limit_; |
- }; |
- |
- struct LimitFromPredecessorBlock { |
- InductionVariableData* variable; |
- Token::Value token; |
- HValue* limit; |
- HBasicBlock* other_target; |
- |
- bool LimitIsValid() { return token != Token::ILLEGAL; } |
- |
- bool LimitIsIncluded() { |
- return Token::IsEqualityOp(token) || |
- token == Token::GTE || token == Token::LTE; |
- } |
- bool LimitIsUpper() { |
- return token == Token::LTE || token == Token::LT || token == Token::NE; |
- } |
- |
- LimitFromPredecessorBlock() |
- : variable(NULL), |
- token(Token::ILLEGAL), |
- limit(NULL), |
- other_target(NULL) {} |
- }; |
- |
- static const int32_t kNoLimit = -1; |
- |
- static InductionVariableData* ExaminePhi(HPhi* phi); |
- static void ComputeLimitFromPredecessorBlock( |
- HBasicBlock* block, |
- LimitFromPredecessorBlock* result); |
- static bool ComputeInductionVariableLimit( |
- HBasicBlock* block, |
- InductionVariableLimitUpdate* additional_limit); |
- |
- struct BitwiseDecompositionResult { |
- HValue* base; |
- int32_t and_mask; |
- int32_t or_mask; |
- HValue* context; |
- |
- BitwiseDecompositionResult() |
- : base(NULL), and_mask(0), or_mask(0), context(NULL) {} |
- }; |
- static void DecomposeBitwise(HValue* value, |
- BitwiseDecompositionResult* result); |
- |
- void AddCheck(HBoundsCheck* check, int32_t upper_limit = kNoLimit); |
- |
- bool CheckIfBranchIsLoopGuard(Token::Value token, |
- HBasicBlock* current_branch, |
- HBasicBlock* other_branch); |
- |
- void UpdateAdditionalLimit(InductionVariableLimitUpdate* update); |
- |
- HPhi* phi() { return phi_; } |
- HValue* base() { return base_; } |
- int32_t increment() { return increment_; } |
- HValue* limit() { return limit_; } |
- bool limit_included() { return limit_included_; } |
- HBasicBlock* limit_validity() { return limit_validity_; } |
- HBasicBlock* induction_exit_block() { return induction_exit_block_; } |
- HBasicBlock* induction_exit_target() { return induction_exit_target_; } |
- ChecksRelatedToLength* checks() { return checks_; } |
- HValue* additional_upper_limit() { return additional_upper_limit_; } |
- bool additional_upper_limit_is_included() { |
- return additional_upper_limit_is_included_; |
- } |
- HValue* additional_lower_limit() { return additional_lower_limit_; } |
- bool additional_lower_limit_is_included() { |
- return additional_lower_limit_is_included_; |
- } |
- |
- bool LowerLimitIsNonNegativeConstant() { |
- if (base()->IsInteger32Constant() && base()->GetInteger32Constant() >= 0) { |
- return true; |
- } |
- if (additional_lower_limit() != NULL && |
- additional_lower_limit()->IsInteger32Constant() && |
- additional_lower_limit()->GetInteger32Constant() >= 0) { |
- // Ignoring the corner case of !additional_lower_limit_is_included() |
- // is safe, handling it adds unneeded complexity. |
- return true; |
- } |
- return false; |
- } |
- |
- int32_t ComputeUpperLimit(int32_t and_mask, int32_t or_mask); |
- |
- private: |
- template <class T> void swap(T* a, T* b) { |
- T c(*a); |
- *a = *b; |
- *b = c; |
- } |
- |
- InductionVariableData(HPhi* phi, HValue* base, int32_t increment) |
- : phi_(phi), base_(IgnoreOsrValue(base)), increment_(increment), |
- limit_(NULL), limit_included_(false), limit_validity_(NULL), |
- induction_exit_block_(NULL), induction_exit_target_(NULL), |
- checks_(NULL), |
- additional_upper_limit_(NULL), |
- additional_upper_limit_is_included_(false), |
- additional_lower_limit_(NULL), |
- additional_lower_limit_is_included_(false) {} |
- |
- static int32_t ComputeIncrement(HPhi* phi, HValue* phi_operand); |
- |
- static HValue* IgnoreOsrValue(HValue* v); |
- static InductionVariableData* GetInductionVariableData(HValue* v); |
- |
- HPhi* phi_; |
- HValue* base_; |
- int32_t increment_; |
- HValue* limit_; |
- bool limit_included_; |
- HBasicBlock* limit_validity_; |
- HBasicBlock* induction_exit_block_; |
- HBasicBlock* induction_exit_target_; |
- ChecksRelatedToLength* checks_; |
- HValue* additional_upper_limit_; |
- bool additional_upper_limit_is_included_; |
- HValue* additional_lower_limit_; |
- bool additional_lower_limit_is_included_; |
-}; |
- |
- |
class HPhi final : public HValue { |
public: |
HPhi(int merged_index, Zone* zone) |
@@ -3201,21 +2972,6 @@ class HPhi final : public HValue { |
int merged_index() const { return merged_index_; } |
- InductionVariableData* induction_variable_data() { |
- return induction_variable_data_; |
- } |
- bool IsInductionVariable() { |
- return induction_variable_data_ != NULL; |
- } |
- bool IsLimitedInductionVariable() { |
- return IsInductionVariable() && |
- induction_variable_data_->limit() != NULL; |
- } |
- void DetectInductionVariable() { |
- DCHECK(induction_variable_data_ == NULL); |
- induction_variable_data_ = InductionVariableData::ExaminePhi(this); |
- } |
- |
std::ostream& PrintTo(std::ostream& os) const override; // NOLINT |
#ifdef DEBUG |
@@ -3261,7 +3017,6 @@ class HPhi final : public HValue { |
int merged_index_ = 0; |
int phi_id_ = -1; |
- InductionVariableData* induction_variable_data_ = nullptr; |
Representation representation_from_indirect_uses_ = Representation::None(); |
Representation representation_from_non_phi_uses_ = Representation::None(); |
@@ -3938,9 +3693,6 @@ class HAccessArgumentsAt final : public HTemplateInstruction<3> { |
}; |
-class HBoundsCheckBaseIndexInformation; |
- |
- |
class HBoundsCheck final : public HTemplateInstruction<2> { |
public: |
DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*); |
@@ -3952,24 +3704,6 @@ class HBoundsCheck final : public HTemplateInstruction<2> { |
int offset() const { return offset_; } |
int scale() const { return scale_; } |
- void ApplyIndexChange(); |
- bool DetectCompoundIndex() { |
- DCHECK(base() == NULL); |
- |
- DecompositionResult decomposition; |
- if (index()->TryDecompose(&decomposition)) { |
- base_ = decomposition.base(); |
- offset_ = decomposition.offset(); |
- scale_ = decomposition.scale(); |
- return true; |
- } else { |
- base_ = index(); |
- offset_ = 0; |
- scale_ = 0; |
- return false; |
- } |
- } |
- |
Representation RequiredInputRepresentation(int index) override { |
return representation(); |
} |
@@ -3988,8 +3722,6 @@ class HBoundsCheck final : public HTemplateInstruction<2> { |
DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
protected: |
- friend class HBoundsCheckBaseIndexInformation; |
- |
Range* InferRange(Zone* zone) override; |
bool DataEquals(HValue* other) override { return true; } |
@@ -4018,34 +3750,6 @@ class HBoundsCheck final : public HTemplateInstruction<2> { |
}; |
-class HBoundsCheckBaseIndexInformation final : public HTemplateInstruction<2> { |
- public: |
- explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) { |
- DecompositionResult decomposition; |
- if (check->index()->TryDecompose(&decomposition)) { |
- SetOperandAt(0, decomposition.base()); |
- SetOperandAt(1, check); |
- } else { |
- UNREACHABLE(); |
- } |
- } |
- |
- HValue* base_index() const { return OperandAt(0); } |
- HBoundsCheck* bounds_check() { return HBoundsCheck::cast(OperandAt(1)); } |
- |
- DECLARE_CONCRETE_INSTRUCTION(BoundsCheckBaseIndexInformation) |
- |
- Representation RequiredInputRepresentation(int index) override { |
- return representation(); |
- } |
- |
- std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
- |
- int RedefinedOperandIndex() override { return 0; } |
- bool IsPurelyInformativeDefinition() override { return true; } |
-}; |
- |
- |
class HBitwiseBinaryOperation : public HBinaryOperation { |
public: |
HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, |
@@ -4668,18 +4372,6 @@ class HAdd final : public HArithmeticBinaryOperation { |
HValue* Canonicalize() override; |
- bool TryDecompose(DecompositionResult* decomposition) override { |
- if (left()->IsInteger32Constant()) { |
- decomposition->Apply(right(), left()->GetInteger32Constant()); |
- return true; |
- } else if (right()->IsInteger32Constant()) { |
- decomposition->Apply(left(), right()->GetInteger32Constant()); |
- return true; |
- } else { |
- return false; |
- } |
- } |
- |
void RepresentationChanged(Representation to) override { |
if (to.IsTagged() && |
(left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || |
@@ -4759,15 +4451,6 @@ class HSub final : public HArithmeticBinaryOperation { |
HValue* Canonicalize() override; |
- bool TryDecompose(DecompositionResult* decomposition) override { |
- if (right()->IsInteger32Constant()) { |
- decomposition->Apply(left(), -right()->GetInteger32Constant()); |
- return true; |
- } else { |
- return false; |
- } |
- } |
- |
DECLARE_CONCRETE_INSTRUCTION(Sub) |
protected: |
@@ -5022,18 +4705,6 @@ class HShr final : public HBitwiseBinaryOperation { |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
HValue* left, HValue* right); |
- bool TryDecompose(DecompositionResult* decomposition) override { |
- if (right()->IsInteger32Constant()) { |
- if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
- // This is intended to look for HAdd and HSub, to handle compounds |
- // like ((base + offset) >> scale) with one single decomposition. |
- left()->TryDecompose(decomposition); |
- return true; |
- } |
- } |
- return false; |
- } |
- |
Range* InferRange(Zone* zone) override; |
void UpdateRepresentation(Representation new_rep, |
@@ -5059,18 +4730,6 @@ class HSar final : public HBitwiseBinaryOperation { |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
HValue* left, HValue* right); |
- bool TryDecompose(DecompositionResult* decomposition) override { |
- if (right()->IsInteger32Constant()) { |
- if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
- // This is intended to look for HAdd and HSub, to handle compounds |
- // like ((base + offset) >> scale) with one single decomposition. |
- left()->TryDecompose(decomposition); |
- return true; |
- } |
- } |
- return false; |
- } |
- |
Range* InferRange(Zone* zone) override; |
void UpdateRepresentation(Representation new_rep, |