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

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

Issue 297763006: Improve write barriers in optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ 6 #define V8_HYDROGEN_INSTRUCTIONS_H_
7 7
8 #include "v8.h" 8 #include "v8.h"
9 9
10 #include "allocation.h" 10 #include "allocation.h"
(...skipping 5684 matching lines...) Expand 10 before | Expand all | Expand 10 after
5695 } 5695 }
5696 if (value->IsAllocate() && 5696 if (value->IsAllocate() &&
5697 !HAllocate::cast(value)->IsNewSpaceAllocation()) { 5697 !HAllocate::cast(value)->IsNewSpaceAllocation()) {
5698 return false; 5698 return false;
5699 } 5699 }
5700 } 5700 }
5701 return true; 5701 return true;
5702 } 5702 }
5703 5703
5704 5704
5705 inline bool ObjectIsInNewSpace(HValue* object,
5706 HValue* dominator) {
5707 while (object->IsInnerAllocatedObject()) {
5708 object = HInnerAllocatedObject::cast(object)->base_object();
5709 }
5710 if (object != dominator) return false;
5711 return (object->IsAllocate() &&
5712 HAllocate::cast(object)->IsNewSpaceAllocation());
5713 }
5714
5715
5705 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { 5716 class HStoreGlobalCell V8_FINAL : public HUnaryOperation {
5706 public: 5717 public:
5707 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, 5718 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*,
5708 Handle<PropertyCell>, PropertyDetails); 5719 Handle<PropertyCell>, PropertyDetails);
5709 5720
5710 Unique<PropertyCell> cell() const { return cell_; } 5721 Unique<PropertyCell> cell() const { return cell_; }
5711 bool RequiresHoleCheck() { 5722 bool RequiresHoleCheck() {
5712 return !details_.IsDontDelete() || details_.IsReadOnly(); 5723 return !details_.IsDontDelete() || details_.IsReadOnly();
5713 } 5724 }
5714 bool NeedsWriteBarrier() { 5725 bool NeedsWriteBarrier() {
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
6713 return ReceiverObjectNeedsWriteBarrier(object(), transition(), 6724 return ReceiverObjectNeedsWriteBarrier(object(), transition(),
6714 new_space_dominator()); 6725 new_space_dominator());
6715 } 6726 }
6716 6727
6717 SmiCheck SmiCheckForWriteBarrier() const { 6728 SmiCheck SmiCheckForWriteBarrier() const {
6718 if (field_representation().IsHeapObject()) return OMIT_SMI_CHECK; 6729 if (field_representation().IsHeapObject()) return OMIT_SMI_CHECK;
6719 if (value()->type().IsHeapObject()) return OMIT_SMI_CHECK; 6730 if (value()->type().IsHeapObject()) return OMIT_SMI_CHECK;
6720 return INLINE_SMI_CHECK; 6731 return INLINE_SMI_CHECK;
6721 } 6732 }
6722 6733
6734 bool ValueIsInNewSpace() const {
6735 return ObjectIsInNewSpace(value(), new_space_dominator());
6736 }
6737
6723 Representation field_representation() const { 6738 Representation field_representation() const {
6724 return access_.representation(); 6739 return access_.representation();
6725 } 6740 }
6726 6741
6727 void UpdateValue(HValue* value) { 6742 void UpdateValue(HValue* value) {
6728 SetOperandAt(1, value); 6743 SetOperandAt(1, value);
6729 } 6744 }
6730 6745
6731 bool CanBeReplacedWith(HStoreNamedField* that) const { 6746 bool CanBeReplacedWith(HStoreNamedField* that) const {
6732 if (!this->access().Equals(that->access())) return false; 6747 if (!this->access().Equals(that->access())) return false;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
6871 if (IsFastSmiElementsKind(elements_kind())) { 6886 if (IsFastSmiElementsKind(elements_kind())) {
6872 return Representation::Smi(); 6887 return Representation::Smi();
6873 } 6888 }
6874 if (is_typed_elements()) { 6889 if (is_typed_elements()) {
6875 return Representation::Integer32(); 6890 return Representation::Integer32();
6876 } 6891 }
6877 // For fast object elements kinds, don't assume anything. 6892 // For fast object elements kinds, don't assume anything.
6878 return Representation::None(); 6893 return Representation::None();
6879 } 6894 }
6880 6895
6881 HValue* elements() { return OperandAt(0); } 6896 HValue* elements() const { return OperandAt(0); }
6882 HValue* key() { return OperandAt(1); } 6897 HValue* key() const { return OperandAt(1); }
6883 HValue* value() { return OperandAt(2); } 6898 HValue* value() const { return OperandAt(2); }
6884 bool value_is_smi() const { 6899 bool value_is_smi() const {
6885 return IsFastSmiElementsKind(elements_kind_); 6900 return IsFastSmiElementsKind(elements_kind_);
6886 } 6901 }
6887 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } 6902 StoreFieldOrKeyedMode store_mode() const { return store_mode_; }
6888 ElementsKind elements_kind() const { return elements_kind_; } 6903 ElementsKind elements_kind() const { return elements_kind_; }
6889 uint32_t base_offset() { return base_offset_; } 6904 uint32_t base_offset() { return base_offset_; }
6890 void IncreaseBaseOffset(uint32_t base_offset) { 6905 void IncreaseBaseOffset(uint32_t base_offset) {
6891 base_offset_ += base_offset; 6906 base_offset_ += base_offset;
6892 } 6907 }
6893 virtual int MaxBaseOffsetBits() { 6908 virtual int MaxBaseOffsetBits() {
(...skipping 24 matching lines...) Expand all
6918 bool NeedsWriteBarrier() { 6933 bool NeedsWriteBarrier() {
6919 if (value_is_smi()) { 6934 if (value_is_smi()) {
6920 return false; 6935 return false;
6921 } else { 6936 } else {
6922 return StoringValueNeedsWriteBarrier(value()) && 6937 return StoringValueNeedsWriteBarrier(value()) &&
6923 ReceiverObjectNeedsWriteBarrier(elements(), value(), 6938 ReceiverObjectNeedsWriteBarrier(elements(), value(),
6924 new_space_dominator()); 6939 new_space_dominator());
6925 } 6940 }
6926 } 6941 }
6927 6942
6943 bool ValueIsInNewSpace() const {
6944 return ObjectIsInNewSpace(value(), new_space_dominator());
6945 }
6946
6928 bool NeedsCanonicalization(); 6947 bool NeedsCanonicalization();
6929 6948
6930 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6949 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6931 6950
6932 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) 6951 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed)
6933 6952
6934 private: 6953 private:
6935 HStoreKeyed(HValue* obj, HValue* key, HValue* val, 6954 HStoreKeyed(HValue* obj, HValue* key, HValue* val,
6936 ElementsKind elements_kind, 6955 ElementsKind elements_kind,
6937 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE, 6956 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE,
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
7714 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7733 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7715 }; 7734 };
7716 7735
7717 7736
7718 #undef DECLARE_INSTRUCTION 7737 #undef DECLARE_INSTRUCTION
7719 #undef DECLARE_CONCRETE_INSTRUCTION 7738 #undef DECLARE_CONCRETE_INSTRUCTION
7720 7739
7721 } } // namespace v8::internal 7740 } } // namespace v8::internal
7722 7741
7723 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7742 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698