OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 | 868 |
869 // Updated the inferred type of this instruction and returns true if | 869 // Updated the inferred type of this instruction and returns true if |
870 // it has changed. | 870 // it has changed. |
871 bool UpdateInferredType(); | 871 bool UpdateInferredType(); |
872 | 872 |
873 virtual HType CalculateInferredType(); | 873 virtual HType CalculateInferredType(); |
874 | 874 |
875 // This function must be overridden for instructions which have the | 875 // This function must be overridden for instructions which have the |
876 // kTrackSideEffectDominators flag set, to track instructions that are | 876 // kTrackSideEffectDominators flag set, to track instructions that are |
877 // dominating side effects. | 877 // dominating side effects. |
878 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 878 // It returns true if it removed an instruction which had side effects. |
| 879 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
879 HValue* dominator) { | 880 HValue* dominator) { |
880 UNREACHABLE(); | 881 UNREACHABLE(); |
| 882 return false; |
881 } | 883 } |
882 | 884 |
883 // Check if this instruction has some reason that prevents elimination. | 885 // Check if this instruction has some reason that prevents elimination. |
884 bool CannotBeEliminated() const { | 886 bool CannotBeEliminated() const { |
885 return HasObservableSideEffects() || !IsDeletable(); | 887 return HasObservableSideEffects() || !IsDeletable(); |
886 } | 888 } |
887 | 889 |
888 #ifdef DEBUG | 890 #ifdef DEBUG |
889 virtual void Verify() = 0; | 891 virtual void Verify() = 0; |
890 #endif | 892 #endif |
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2657 } | 2659 } |
2658 return check_map; | 2660 return check_map; |
2659 } | 2661 } |
2660 | 2662 |
2661 bool CanOmitMapChecks() { return omit_; } | 2663 bool CanOmitMapChecks() { return omit_; } |
2662 | 2664 |
2663 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } | 2665 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } |
2664 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2666 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
2665 return Representation::Tagged(); | 2667 return Representation::Tagged(); |
2666 } | 2668 } |
2667 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 2669 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
2668 HValue* dominator) V8_OVERRIDE; | 2670 HValue* dominator) V8_OVERRIDE; |
2669 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2671 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
2670 | 2672 |
2671 HValue* value() { return OperandAt(0); } | 2673 HValue* value() { return OperandAt(0); } |
2672 | 2674 |
2673 Unique<Map> first_map() const { return map_set_.at(0); } | 2675 Unique<Map> first_map() const { return map_set_.at(0); } |
2674 UniqueSet<Map> map_set() const { return map_set_; } | 2676 UniqueSet<Map> map_set() const { return map_set_; } |
2675 | 2677 |
2676 bool has_migration_target() const { | 2678 bool has_migration_target() const { |
2677 return has_migration_target_; | 2679 return has_migration_target_; |
(...skipping 2647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5325 } | 5327 } |
5326 | 5328 |
5327 bool MustClearNextMapWord() const { | 5329 bool MustClearNextMapWord() const { |
5328 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0; | 5330 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0; |
5329 } | 5331 } |
5330 | 5332 |
5331 void MakeDoubleAligned() { | 5333 void MakeDoubleAligned() { |
5332 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); | 5334 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); |
5333 } | 5335 } |
5334 | 5336 |
5335 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 5337 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
5336 HValue* dominator) V8_OVERRIDE; | 5338 HValue* dominator) V8_OVERRIDE; |
5337 | 5339 |
5338 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5340 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
5339 | 5341 |
5340 DECLARE_CONCRETE_INSTRUCTION(Allocate) | 5342 DECLARE_CONCRETE_INSTRUCTION(Allocate) |
5341 | 5343 |
5342 private: | 5344 private: |
5343 enum Flags { | 5345 enum Flags { |
5344 ALLOCATE_IN_NEW_SPACE = 1 << 0, | 5346 ALLOCATE_IN_NEW_SPACE = 1 << 0, |
5345 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, | 5347 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6437 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { | 6439 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { |
6438 return Representation::Integer32(); | 6440 return Representation::Integer32(); |
6439 } | 6441 } |
6440 return field_representation(); | 6442 return field_representation(); |
6441 } else if (field_representation().IsExternal()) { | 6443 } else if (field_representation().IsExternal()) { |
6442 return Representation::External(); | 6444 return Representation::External(); |
6443 } | 6445 } |
6444 } | 6446 } |
6445 return Representation::Tagged(); | 6447 return Representation::Tagged(); |
6446 } | 6448 } |
6447 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 6449 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
6448 HValue* dominator) V8_OVERRIDE { | 6450 HValue* dominator) V8_OVERRIDE { |
6449 ASSERT(side_effect == kChangesNewSpacePromotion); | 6451 ASSERT(side_effect == kChangesNewSpacePromotion); |
6450 new_space_dominator_ = dominator; | 6452 new_space_dominator_ = dominator; |
| 6453 return false; |
6451 } | 6454 } |
6452 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6455 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
6453 | 6456 |
6454 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } | 6457 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } |
6455 bool IsSkipWriteBarrier() const { | 6458 bool IsSkipWriteBarrier() const { |
6456 return write_barrier_mode_ == SKIP_WRITE_BARRIER; | 6459 return write_barrier_mode_ == SKIP_WRITE_BARRIER; |
6457 } | 6460 } |
6458 | 6461 |
6459 HValue* object() const { return OperandAt(0); } | 6462 HValue* object() const { return OperandAt(0); } |
6460 HValue* value() const { return OperandAt(1); } | 6463 HValue* value() const { return OperandAt(1); } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6667 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } | 6670 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
6668 bool IsUninitialized() { return is_uninitialized_; } | 6671 bool IsUninitialized() { return is_uninitialized_; } |
6669 void SetUninitialized(bool is_uninitialized) { | 6672 void SetUninitialized(bool is_uninitialized) { |
6670 is_uninitialized_ = is_uninitialized; | 6673 is_uninitialized_ = is_uninitialized; |
6671 } | 6674 } |
6672 | 6675 |
6673 bool IsConstantHoleStore() { | 6676 bool IsConstantHoleStore() { |
6674 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); | 6677 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); |
6675 } | 6678 } |
6676 | 6679 |
6677 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 6680 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
6678 HValue* dominator) V8_OVERRIDE { | 6681 HValue* dominator) V8_OVERRIDE { |
6679 ASSERT(side_effect == kChangesNewSpacePromotion); | 6682 ASSERT(side_effect == kChangesNewSpacePromotion); |
6680 new_space_dominator_ = dominator; | 6683 new_space_dominator_ = dominator; |
| 6684 return false; |
6681 } | 6685 } |
6682 | 6686 |
6683 HValue* new_space_dominator() const { return new_space_dominator_; } | 6687 HValue* new_space_dominator() const { return new_space_dominator_; } |
6684 | 6688 |
6685 bool NeedsWriteBarrier() { | 6689 bool NeedsWriteBarrier() { |
6686 if (value_is_smi()) { | 6690 if (value_is_smi()) { |
6687 return false; | 6691 return false; |
6688 } else { | 6692 } else { |
6689 return StoringValueNeedsWriteBarrier(value()) && | 6693 return StoringValueNeedsWriteBarrier(value()) && |
6690 ReceiverObjectNeedsWriteBarrier(elements(), value(), | 6694 ReceiverObjectNeedsWriteBarrier(elements(), value(), |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7420 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7424 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7421 }; | 7425 }; |
7422 | 7426 |
7423 | 7427 |
7424 #undef DECLARE_INSTRUCTION | 7428 #undef DECLARE_INSTRUCTION |
7425 #undef DECLARE_CONCRETE_INSTRUCTION | 7429 #undef DECLARE_CONCRETE_INSTRUCTION |
7426 | 7430 |
7427 } } // namespace v8::internal | 7431 } } // namespace v8::internal |
7428 | 7432 |
7429 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7433 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |