Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: src/hydrogen-instructions.h

Issue 6072009: Don't emit a write barrier when storing a known old space value. (Closed)
Patch Set: Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object") 1762 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object")
1763 }; 1763 };
1764 1764
1765 1765
1766 class HConstant: public HInstruction { 1766 class HConstant: public HInstruction {
1767 public: 1767 public:
1768 HConstant(Handle<Object> handle, Representation r); 1768 HConstant(Handle<Object> handle, Representation r);
1769 1769
1770 Handle<Object> handle() const { return handle_; } 1770 Handle<Object> handle() const { return handle_; }
1771 1771
1772 bool InOldSpace() const { return !Heap::InNewSpace(*handle_); }
1773
1772 virtual bool EmitAtUses() const { return !representation().IsDouble(); } 1774 virtual bool EmitAtUses() const { return !representation().IsDouble(); }
1773 virtual void PrintDataTo(StringStream* stream) const; 1775 virtual void PrintDataTo(StringStream* stream) const;
1774 virtual HType CalculateInferredType() const; 1776 virtual HType CalculateInferredType() const;
1775 bool IsInteger() const { return handle_->IsSmi(); } 1777 bool IsInteger() const { return handle_->IsSmi(); }
1776 HConstant* CopyToRepresentation(Representation r) const; 1778 HConstant* CopyToRepresentation(Representation r) const;
1777 HConstant* CopyToTruncatedInt32() const; 1779 HConstant* CopyToTruncatedInt32() const;
1778 bool HasInteger32Value() const { return has_int32_value_; } 1780 bool HasInteger32Value() const { return has_int32_value_; }
1779 int32_t Integer32Value() const { 1781 int32_t Integer32Value() const {
1780 ASSERT(HasInteger32Value()); 1782 ASSERT(HasInteger32Value());
1781 return int32_value_; 1783 return int32_value_;
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
2680 class HLoadKeyedGeneric: public HLoadKeyed { 2682 class HLoadKeyedGeneric: public HLoadKeyed {
2681 public: 2683 public:
2682 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { 2684 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) {
2683 SetFlagMask(AllSideEffects()); 2685 SetFlagMask(AllSideEffects());
2684 } 2686 }
2685 2687
2686 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") 2688 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic")
2687 }; 2689 };
2688 2690
2689 2691
2692 static inline bool StoringValueNeedsWriteBarrier(HValue* value) {
2693 return !value->type().IsSmi() &&
2694 !(value->IsConstant() && HConstant::cast(value)->InOldSpace());
2695 }
2696
2697
2690 class HStoreNamed: public HBinaryOperation { 2698 class HStoreNamed: public HBinaryOperation {
2691 public: 2699 public:
2692 HStoreNamed(HValue* obj, Handle<Object> name, HValue* val) 2700 HStoreNamed(HValue* obj, Handle<Object> name, HValue* val)
2693 : HBinaryOperation(obj, val), name_(name) { 2701 : HBinaryOperation(obj, val), name_(name) {
2694 } 2702 }
2695 2703
2696 virtual Representation RequiredInputRepresentation(int index) const { 2704 virtual Representation RequiredInputRepresentation(int index) const {
2697 return Representation::Tagged(); 2705 return Representation::Tagged();
2698 } 2706 }
2699 2707
2700 virtual void PrintDataTo(StringStream* stream) const; 2708 virtual void PrintDataTo(StringStream* stream) const;
2701 2709
2702 HValue* object() const { return OperandAt(0); } 2710 HValue* object() const { return OperandAt(0); }
2703 Handle<Object> name() const { return name_; } 2711 Handle<Object> name() const { return name_; }
2704 HValue* value() const { return OperandAt(1); } 2712 HValue* value() const { return OperandAt(1); }
2705 void set_value(HValue* value) { SetOperandAt(1, value); } 2713 void set_value(HValue* value) { SetOperandAt(1, value); }
2706 2714
2715 bool NeedsWriteBarrier() const {
2716 return StoringValueNeedsWriteBarrier(value());
2717 }
2718
2707 DECLARE_INSTRUCTION(StoreNamed) 2719 DECLARE_INSTRUCTION(StoreNamed)
2708 2720
2709 protected: 2721 protected:
2710 virtual bool DataEquals(HValue* other) const { 2722 virtual bool DataEquals(HValue* other) const {
2711 HStoreNamed* b = HStoreNamed::cast(other); 2723 HStoreNamed* b = HStoreNamed::cast(other);
2712 return name_.is_identical_to(b->name_); 2724 return name_.is_identical_to(b->name_);
2713 } 2725 }
2714 2726
2715 private: 2727 private:
2716 Handle<Object> name_; 2728 Handle<Object> name_;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 virtual HValue* OperandAt(int index) const { return operands_[index]; } 2789 virtual HValue* OperandAt(int index) const { return operands_[index]; }
2778 2790
2779 virtual Representation RequiredInputRepresentation(int index) const { 2791 virtual Representation RequiredInputRepresentation(int index) const {
2780 return Representation::Tagged(); 2792 return Representation::Tagged();
2781 } 2793 }
2782 2794
2783 HValue* object() const { return OperandAt(0); } 2795 HValue* object() const { return OperandAt(0); }
2784 HValue* key() const { return OperandAt(1); } 2796 HValue* key() const { return OperandAt(1); }
2785 HValue* value() const { return OperandAt(2); } 2797 HValue* value() const { return OperandAt(2); }
2786 2798
2799 bool NeedsWriteBarrier() const {
2800 return StoringValueNeedsWriteBarrier(value());
2801 }
2802
2787 DECLARE_INSTRUCTION(StoreKeyed) 2803 DECLARE_INSTRUCTION(StoreKeyed)
2788 2804
2789 protected: 2805 protected:
2790 virtual void InternalSetOperandAt(int index, HValue* value) { 2806 virtual void InternalSetOperandAt(int index, HValue* value) {
2791 operands_[index] = value; 2807 operands_[index] = value;
2792 } 2808 }
2793 2809
2794 private: 2810 private:
2795 HOperandVector<3> operands_; 2811 HOperandVector<3> operands_;
2796 }; 2812 };
2797 2813
2798 2814
2799 class HStoreKeyedFastElement: public HStoreKeyed { 2815 class HStoreKeyedFastElement: public HStoreKeyed {
2800 public: 2816 public:
2801 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) 2817 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val)
2802 : HStoreKeyed(obj, key, val) { 2818 : HStoreKeyed(obj, key, val) {
2803 SetFlag(kChangesArrayElements); 2819 SetFlag(kChangesArrayElements);
2804 } 2820 }
2805 2821
2806 bool NeedsWriteBarrier() const {
2807 return !value()->type().IsSmi();
2808 }
2809
2810 virtual Representation RequiredInputRepresentation(int index) const { 2822 virtual Representation RequiredInputRepresentation(int index) const {
2811 // The key is supposed to be Integer32. 2823 // The key is supposed to be Integer32.
2812 return (index == 1) ? Representation::Integer32() 2824 return (index == 1) ? Representation::Integer32()
2813 : Representation::Tagged(); 2825 : Representation::Tagged();
2814 } 2826 }
2815 2827
2816 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, 2828 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
2817 "store_keyed_fast_element") 2829 "store_keyed_fast_element")
2818 }; 2830 };
2819 2831
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2968 HValue* object() const { return left(); } 2980 HValue* object() const { return left(); }
2969 HValue* key() const { return right(); } 2981 HValue* key() const { return right(); }
2970 }; 2982 };
2971 2983
2972 #undef DECLARE_INSTRUCTION 2984 #undef DECLARE_INSTRUCTION
2973 #undef DECLARE_CONCRETE_INSTRUCTION 2985 #undef DECLARE_CONCRETE_INSTRUCTION
2974 2986
2975 } } // namespace v8::internal 2987 } } // namespace v8::internal
2976 2988
2977 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 2989 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698