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

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

Issue 1016803002: Remove PropertyCell space (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | « src/hydrogen-gvn.cc ('k') | src/hydrogen-instructions.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 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 <cstring> 8 #include <cstring>
9 #include <iosfwd> 9 #include <iosfwd>
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 V(InvokeFunction) \ 110 V(InvokeFunction) \
111 V(IsConstructCallAndBranch) \ 111 V(IsConstructCallAndBranch) \
112 V(IsObjectAndBranch) \ 112 V(IsObjectAndBranch) \
113 V(IsStringAndBranch) \ 113 V(IsStringAndBranch) \
114 V(IsSmiAndBranch) \ 114 V(IsSmiAndBranch) \
115 V(IsUndetectableAndBranch) \ 115 V(IsUndetectableAndBranch) \
116 V(LeaveInlined) \ 116 V(LeaveInlined) \
117 V(LoadContextSlot) \ 117 V(LoadContextSlot) \
118 V(LoadFieldByIndex) \ 118 V(LoadFieldByIndex) \
119 V(LoadFunctionPrototype) \ 119 V(LoadFunctionPrototype) \
120 V(LoadGlobalCell) \
121 V(LoadGlobalGeneric) \ 120 V(LoadGlobalGeneric) \
122 V(LoadKeyed) \ 121 V(LoadKeyed) \
123 V(LoadKeyedGeneric) \ 122 V(LoadKeyedGeneric) \
124 V(LoadNamedField) \ 123 V(LoadNamedField) \
125 V(LoadNamedGeneric) \ 124 V(LoadNamedGeneric) \
126 V(LoadRoot) \ 125 V(LoadRoot) \
127 V(MapEnumLength) \ 126 V(MapEnumLength) \
128 V(MathFloorOfDiv) \ 127 V(MathFloorOfDiv) \
129 V(MathMinMax) \ 128 V(MathMinMax) \
130 V(Mod) \ 129 V(Mod) \
131 V(Mul) \ 130 V(Mul) \
132 V(OsrEntry) \ 131 V(OsrEntry) \
133 V(Parameter) \ 132 V(Parameter) \
134 V(Power) \ 133 V(Power) \
135 V(PushArguments) \ 134 V(PushArguments) \
136 V(RegExpLiteral) \ 135 V(RegExpLiteral) \
137 V(Return) \ 136 V(Return) \
138 V(Ror) \ 137 V(Ror) \
139 V(Sar) \ 138 V(Sar) \
140 V(SeqStringGetChar) \ 139 V(SeqStringGetChar) \
141 V(SeqStringSetChar) \ 140 V(SeqStringSetChar) \
142 V(Shl) \ 141 V(Shl) \
143 V(Shr) \ 142 V(Shr) \
144 V(Simulate) \ 143 V(Simulate) \
145 V(StackCheck) \ 144 V(StackCheck) \
146 V(StoreCodeEntry) \ 145 V(StoreCodeEntry) \
147 V(StoreContextSlot) \ 146 V(StoreContextSlot) \
148 V(StoreFrameContext) \ 147 V(StoreFrameContext) \
149 V(StoreGlobalCell) \
150 V(StoreKeyed) \ 148 V(StoreKeyed) \
151 V(StoreKeyedGeneric) \ 149 V(StoreKeyedGeneric) \
152 V(StoreNamedField) \ 150 V(StoreNamedField) \
153 V(StoreNamedGeneric) \ 151 V(StoreNamedGeneric) \
154 V(StringAdd) \ 152 V(StringAdd) \
155 V(StringCharCodeAt) \ 153 V(StringCharCodeAt) \
156 V(StringCharFromCode) \ 154 V(StringCharFromCode) \
157 V(StringCompareAndBranch) \ 155 V(StringCompareAndBranch) \
158 V(Sub) \ 156 V(Sub) \
159 V(TailCallThroughMegamorphicCache) \ 157 V(TailCallThroughMegamorphicCache) \
(...skipping 3334 matching lines...) Expand 10 before | Expand all | Expand 10 after
3494 } 3492 }
3495 3493
3496 bool NotInNewSpace() const { 3494 bool NotInNewSpace() const {
3497 return IsNotInNewSpaceField::decode(bit_field_); 3495 return IsNotInNewSpaceField::decode(bit_field_);
3498 } 3496 }
3499 3497
3500 bool ImmortalImmovable() const; 3498 bool ImmortalImmovable() const;
3501 3499
3502 bool IsCell() const { 3500 bool IsCell() const {
3503 InstanceType instance_type = GetInstanceType(); 3501 InstanceType instance_type = GetInstanceType();
3504 return instance_type == CELL_TYPE || instance_type == PROPERTY_CELL_TYPE; 3502 return instance_type == CELL_TYPE;
3505 } 3503 }
3506 3504
3507 Representation RequiredInputRepresentation(int index) OVERRIDE { 3505 Representation RequiredInputRepresentation(int index) OVERRIDE {
3508 return Representation::None(); 3506 return Representation::None();
3509 } 3507 }
3510 3508
3511 Representation KnownOptimalRepresentation() OVERRIDE { 3509 Representation KnownOptimalRepresentation() OVERRIDE {
3512 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); 3510 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi();
3513 if (HasInteger32Value()) return Representation::Integer32(); 3511 if (HasInteger32Value()) return Representation::Integer32();
3514 if (HasNumberValue()) return Representation::Double(); 3512 if (HasNumberValue()) return Representation::Double();
(...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after
5407 incoming_value_(NULL) { 5405 incoming_value_(NULL) {
5408 set_representation(Representation::Tagged()); 5406 set_representation(Representation::Tagged());
5409 } 5407 }
5410 5408
5411 HEnvironment* environment_; 5409 HEnvironment* environment_;
5412 int index_; 5410 int index_;
5413 HPhi* incoming_value_; 5411 HPhi* incoming_value_;
5414 }; 5412 };
5415 5413
5416 5414
5417 class HLoadGlobalCell FINAL : public HTemplateInstruction<0> {
5418 public:
5419 DECLARE_INSTRUCTION_FACTORY_P2(HLoadGlobalCell, Handle<Cell>,
5420 PropertyDetails);
5421
5422 Unique<Cell> cell() const { return cell_; }
5423 // TODO(dcarney): remove this.
5424 bool RequiresHoleCheck() const { return false; }
5425
5426 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
5427
5428 intptr_t Hashcode() OVERRIDE { return cell_.Hashcode(); }
5429
5430 void FinalizeUniqueness() OVERRIDE { cell_ = Unique<Cell>(cell_.handle()); }
5431
5432 Representation RequiredInputRepresentation(int index) OVERRIDE {
5433 return Representation::None();
5434 }
5435
5436 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell)
5437
5438 protected:
5439 bool DataEquals(HValue* other) OVERRIDE {
5440 return cell_ == HLoadGlobalCell::cast(other)->cell_;
5441 }
5442
5443 private:
5444 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details)
5445 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) {
5446 set_representation(Representation::Tagged());
5447 SetFlag(kUseGVN);
5448 SetDependsOnFlag(kGlobalVars);
5449 }
5450
5451 bool IsDeletable() const OVERRIDE { return true; }
5452
5453 Unique<Cell> cell_;
5454 PropertyDetails details_;
5455 };
5456
5457
5458 class HLoadGlobalGeneric FINAL : public HTemplateInstruction<2> { 5415 class HLoadGlobalGeneric FINAL : public HTemplateInstruction<2> {
5459 public: 5416 public:
5460 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*, 5417 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*,
5461 Handle<String>, bool); 5418 Handle<String>, bool);
5462 5419
5463 HValue* context() { return OperandAt(0); } 5420 HValue* context() { return OperandAt(0); }
5464 HValue* global_object() { return OperandAt(1); } 5421 HValue* global_object() { return OperandAt(1); }
5465 Handle<String> name() const { return name_; } 5422 Handle<String> name() const { return name_; }
5466 bool for_typeof() const { return for_typeof_; } 5423 bool for_typeof() const { return for_typeof_; }
5467 FeedbackVectorICSlot slot() const { return slot_; } 5424 FeedbackVectorICSlot slot() const { return slot_; }
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
5790 } 5747 }
5791 if (object == dominator && 5748 if (object == dominator &&
5792 object->IsAllocate() && 5749 object->IsAllocate() &&
5793 HAllocate::cast(object)->IsNewSpaceAllocation()) { 5750 HAllocate::cast(object)->IsNewSpaceAllocation()) {
5794 return kPointersToHereAreAlwaysInteresting; 5751 return kPointersToHereAreAlwaysInteresting;
5795 } 5752 }
5796 return kPointersToHereMaybeInteresting; 5753 return kPointersToHereMaybeInteresting;
5797 } 5754 }
5798 5755
5799 5756
5800 class HStoreGlobalCell FINAL : public HUnaryOperation {
5801 public:
5802 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*,
5803 Handle<PropertyCell>, PropertyDetails);
5804
5805 Unique<PropertyCell> cell() const { return cell_; }
5806 // TODO(dcarney): remove
5807 bool RequiresHoleCheck() const { return false; }
5808 bool NeedsWriteBarrier() {
5809 return StoringValueNeedsWriteBarrier(value());
5810 }
5811
5812 void FinalizeUniqueness() OVERRIDE {
5813 cell_ = Unique<PropertyCell>(cell_.handle());
5814 }
5815
5816 Representation RequiredInputRepresentation(int index) OVERRIDE {
5817 return Representation::Tagged();
5818 }
5819 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
5820
5821 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell)
5822
5823 private:
5824 HStoreGlobalCell(HValue* value,
5825 Handle<PropertyCell> cell,
5826 PropertyDetails details)
5827 : HUnaryOperation(value),
5828 cell_(Unique<PropertyCell>::CreateUninitialized(cell)),
5829 details_(details) {
5830 SetChangesFlag(kGlobalVars);
5831 }
5832
5833 Unique<PropertyCell> cell_;
5834 PropertyDetails details_;
5835 };
5836
5837
5838 class HLoadContextSlot FINAL : public HUnaryOperation { 5757 class HLoadContextSlot FINAL : public HUnaryOperation {
5839 public: 5758 public:
5840 enum Mode { 5759 enum Mode {
5841 // Perform a normal load of the context slot without checking its value. 5760 // Perform a normal load of the context slot without checking its value.
5842 kNoCheck, 5761 kNoCheck,
5843 // Load and check the value of the context slot. Deoptimize if it's the 5762 // Load and check the value of the context slot. Deoptimize if it's the
5844 // hole value. This is used for checking for loading of uninitialized 5763 // hole value. This is used for checking for loading of uninitialized
5845 // harmony bindings where we deoptimize into full-codegen generated code 5764 // harmony bindings where we deoptimize into full-codegen generated code
5846 // which will subsequently throw a reference error. 5765 // which will subsequently throw a reference error.
5847 kCheckDeoptimize, 5766 kCheckDeoptimize,
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
6918 } 6837 }
6919 } 6838 }
6920 6839
6921 void SetTransition(HConstant* transition) { 6840 void SetTransition(HConstant* transition) {
6922 DCHECK(!has_transition()); // Only set once. 6841 DCHECK(!has_transition()); // Only set once.
6923 SetOperandAt(2, transition); 6842 SetOperandAt(2, transition);
6924 bit_field_ = HasTransitionField::update(bit_field_, true); 6843 bit_field_ = HasTransitionField::update(bit_field_, true);
6925 SetChangesFlag(kMaps); 6844 SetChangesFlag(kMaps);
6926 } 6845 }
6927 6846
6928 void MarkReceiverAsCell() {
6929 bit_field_ = ReceiverIsCellField::update(bit_field_, true);
6930 }
6931
6932 bool receiver_is_cell() const {
6933 return ReceiverIsCellField::decode(bit_field_);
6934 }
6935
6936 bool NeedsWriteBarrier() const { 6847 bool NeedsWriteBarrier() const {
6937 DCHECK(!field_representation().IsDouble() || 6848 DCHECK(!field_representation().IsDouble() ||
6938 (FLAG_unbox_double_fields && access_.IsInobject()) || 6849 (FLAG_unbox_double_fields && access_.IsInobject()) ||
6939 !has_transition()); 6850 !has_transition());
6940 if (field_representation().IsDouble()) return false; 6851 if (field_representation().IsDouble()) return false;
6941 if (field_representation().IsSmi()) return false; 6852 if (field_representation().IsSmi()) return false;
6942 if (field_representation().IsInteger32()) return false; 6853 if (field_representation().IsInteger32()) return false;
6943 if (field_representation().IsExternal()) return false; 6854 if (field_representation().IsExternal()) return false;
6944 if (receiver_is_cell()) return false;
6945 return StoringValueNeedsWriteBarrier(value()) && 6855 return StoringValueNeedsWriteBarrier(value()) &&
6946 ReceiverObjectNeedsWriteBarrier(object(), value(), dominator()); 6856 ReceiverObjectNeedsWriteBarrier(object(), value(), dominator());
6947 } 6857 }
6948 6858
6949 bool NeedsWriteBarrierForMap() { 6859 bool NeedsWriteBarrierForMap() {
6950 return ReceiverObjectNeedsWriteBarrier(object(), transition(), 6860 return ReceiverObjectNeedsWriteBarrier(object(), transition(),
6951 dominator()); 6861 dominator());
6952 } 6862 }
6953 6863
6954 SmiCheck SmiCheckForWriteBarrier() const { 6864 SmiCheck SmiCheckForWriteBarrier() const {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
6994 DCHECK(!access.IsInobject() || access.existing_inobject_property() || 6904 DCHECK(!access.IsInobject() || access.existing_inobject_property() ||
6995 obj->IsAllocate() || obj->IsInnerAllocatedObject()); 6905 obj->IsAllocate() || obj->IsInnerAllocatedObject());
6996 SetOperandAt(0, obj); 6906 SetOperandAt(0, obj);
6997 SetOperandAt(1, val); 6907 SetOperandAt(1, val);
6998 SetOperandAt(2, obj); 6908 SetOperandAt(2, obj);
6999 access.SetGVNFlags(this, STORE); 6909 access.SetGVNFlags(this, STORE);
7000 } 6910 }
7001 6911
7002 class HasTransitionField : public BitField<bool, 0, 1> {}; 6912 class HasTransitionField : public BitField<bool, 0, 1> {};
7003 class StoreModeField : public BitField<StoreFieldOrKeyedMode, 1, 1> {}; 6913 class StoreModeField : public BitField<StoreFieldOrKeyedMode, 1, 1> {};
7004 class ReceiverIsCellField : public BitField<bool, 2, 1> {};
7005 6914
7006 HObjectAccess access_; 6915 HObjectAccess access_;
7007 HValue* dominator_; 6916 HValue* dominator_;
7008 uint32_t bit_field_; 6917 uint32_t bit_field_;
7009 }; 6918 };
7010 6919
7011 6920
7012 class HStoreNamedGeneric FINAL : public HTemplateInstruction<3> { 6921 class HStoreNamedGeneric FINAL : public HTemplateInstruction<3> {
7013 public: 6922 public:
7014 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(HStoreNamedGeneric, HValue*, 6923 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(HStoreNamedGeneric, HValue*,
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
7970 }; 7879 };
7971 7880
7972 7881
7973 7882
7974 #undef DECLARE_INSTRUCTION 7883 #undef DECLARE_INSTRUCTION
7975 #undef DECLARE_CONCRETE_INSTRUCTION 7884 #undef DECLARE_CONCRETE_INSTRUCTION
7976 7885
7977 } } // namespace v8::internal 7886 } } // namespace v8::internal
7978 7887
7979 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7888 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-gvn.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698