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

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

Issue 2622783002: [crankshaft] Remove dead Variable hole-checking code (Closed)
Patch Set: Update golden files Created 3 years, 11 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/crankshaft/hydrogen.cc ('k') | src/crankshaft/ia32/lithium-codegen-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 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_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ 5 #ifndef V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_
6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ 6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_
7 7
8 #include <cstring> 8 #include <cstring>
9 #include <iosfwd> 9 #include <iosfwd>
10 10
(...skipping 4929 matching lines...) Expand 10 before | Expand all | Expand 10 after
4940 object->IsAllocate() && 4940 object->IsAllocate() &&
4941 HAllocate::cast(object)->IsNewSpaceAllocation()) { 4941 HAllocate::cast(object)->IsNewSpaceAllocation()) {
4942 return kPointersToHereAreAlwaysInteresting; 4942 return kPointersToHereAreAlwaysInteresting;
4943 } 4943 }
4944 return kPointersToHereMaybeInteresting; 4944 return kPointersToHereMaybeInteresting;
4945 } 4945 }
4946 4946
4947 4947
4948 class HLoadContextSlot final : public HUnaryOperation { 4948 class HLoadContextSlot final : public HUnaryOperation {
4949 public: 4949 public:
4950 enum Mode { 4950 HLoadContextSlot(HValue* context, int slot_index)
4951 // Perform a normal load of the context slot without checking its value. 4951 : HUnaryOperation(context), slot_index_(slot_index) {
4952 kNoCheck,
4953 // Load and check the value of the context slot. Deoptimize if it's the
4954 // hole value. This is used for checking for loading of uninitialized
4955 // harmony bindings where we deoptimize into full-codegen generated code
4956 // which will subsequently throw a reference error.
4957 kCheckDeoptimize
4958 };
4959
4960 HLoadContextSlot(HValue* context, int slot_index, Mode mode)
4961 : HUnaryOperation(context), slot_index_(slot_index), mode_(mode) {
4962 set_representation(Representation::Tagged()); 4952 set_representation(Representation::Tagged());
4963 SetFlag(kUseGVN); 4953 SetFlag(kUseGVN);
4964 SetDependsOnFlag(kContextSlots); 4954 SetDependsOnFlag(kContextSlots);
4965 } 4955 }
4966 4956
4967 int slot_index() const { return slot_index_; } 4957 int slot_index() const { return slot_index_; }
4968 Mode mode() const { return mode_; }
4969
4970 bool DeoptimizesOnHole() {
4971 return mode_ == kCheckDeoptimize;
4972 }
4973
4974 bool RequiresHoleCheck() const {
4975 return mode_ != kNoCheck;
4976 }
4977 4958
4978 Representation RequiredInputRepresentation(int index) override { 4959 Representation RequiredInputRepresentation(int index) override {
4979 return Representation::Tagged(); 4960 return Representation::Tagged();
4980 } 4961 }
4981 4962
4982 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT 4963 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT
4983 4964
4984 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) 4965 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot)
4985 4966
4986 protected: 4967 protected:
4987 bool DataEquals(HValue* other) override { 4968 bool DataEquals(HValue* other) override {
4988 HLoadContextSlot* b = HLoadContextSlot::cast(other); 4969 HLoadContextSlot* b = HLoadContextSlot::cast(other);
4989 return (slot_index() == b->slot_index()); 4970 return (slot_index() == b->slot_index());
4990 } 4971 }
4991 4972
4992 private: 4973 private:
4993 bool IsDeletable() const override { return !RequiresHoleCheck(); } 4974 bool IsDeletable() const override { return true; }
4994 4975
4995 int slot_index_; 4976 int slot_index_;
4996 Mode mode_;
4997 }; 4977 };
4998 4978
4999 4979
5000 class HStoreContextSlot final : public HTemplateInstruction<2> { 4980 class HStoreContextSlot final : public HTemplateInstruction<2> {
5001 public: 4981 public:
5002 enum Mode { 4982 DECLARE_INSTRUCTION_FACTORY_P3(HStoreContextSlot, HValue*, int, HValue*);
5003 // Perform a normal store to the context slot without checking its previous
5004 // value.
5005 kNoCheck,
5006 // Check the previous value of the context slot and deoptimize if it's the
5007 // hole value. This is used for checking for assignments to uninitialized
5008 // harmony bindings where we deoptimize into full-codegen generated code
5009 // which will subsequently throw a reference error.
5010 kCheckDeoptimize
5011 };
5012
5013 DECLARE_INSTRUCTION_FACTORY_P4(HStoreContextSlot, HValue*, int,
5014 Mode, HValue*);
5015 4983
5016 HValue* context() const { return OperandAt(0); } 4984 HValue* context() const { return OperandAt(0); }
5017 HValue* value() const { return OperandAt(1); } 4985 HValue* value() const { return OperandAt(1); }
5018 int slot_index() const { return slot_index_; } 4986 int slot_index() const { return slot_index_; }
5019 Mode mode() const { return mode_; }
5020 4987
5021 bool NeedsWriteBarrier() { 4988 bool NeedsWriteBarrier() {
5022 return StoringValueNeedsWriteBarrier(value()); 4989 return StoringValueNeedsWriteBarrier(value());
5023 } 4990 }
5024 4991
5025 bool DeoptimizesOnHole() {
5026 return mode_ == kCheckDeoptimize;
5027 }
5028
5029 bool RequiresHoleCheck() {
5030 return mode_ != kNoCheck;
5031 }
5032
5033 Representation RequiredInputRepresentation(int index) override { 4992 Representation RequiredInputRepresentation(int index) override {
5034 return Representation::Tagged(); 4993 return Representation::Tagged();
5035 } 4994 }
5036 4995
5037 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT 4996 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT
5038 4997
5039 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) 4998 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot)
5040 4999
5041 private: 5000 private:
5042 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) 5001 HStoreContextSlot(HValue* context, int slot_index, HValue* value)
5043 : slot_index_(slot_index), mode_(mode) { 5002 : slot_index_(slot_index) {
5044 SetOperandAt(0, context); 5003 SetOperandAt(0, context);
5045 SetOperandAt(1, value); 5004 SetOperandAt(1, value);
5046 SetChangesFlag(kContextSlots); 5005 SetChangesFlag(kContextSlots);
5047 } 5006 }
5048 5007
5049 int slot_index_; 5008 int slot_index_;
5050 Mode mode_;
5051 }; 5009 };
5052 5010
5053 5011
5054 // Represents an access to a portion of an object, such as the map pointer, 5012 // Represents an access to a portion of an object, such as the map pointer,
5055 // array elements pointer, etc, but not accesses to array elements themselves. 5013 // array elements pointer, etc, but not accesses to array elements themselves.
5056 class HObjectAccess final { 5014 class HObjectAccess final {
5057 public: 5015 public:
5058 inline bool IsInobject() const { 5016 inline bool IsInobject() const {
5059 return portion() != kBackingStore && portion() != kExternalMemory; 5017 return portion() != kBackingStore && portion() != kExternalMemory;
5060 } 5018 }
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
6759 bool IsDeletable() const override { return true; } 6717 bool IsDeletable() const override { return true; }
6760 }; 6718 };
6761 6719
6762 #undef DECLARE_INSTRUCTION 6720 #undef DECLARE_INSTRUCTION
6763 #undef DECLARE_CONCRETE_INSTRUCTION 6721 #undef DECLARE_CONCRETE_INSTRUCTION
6764 6722
6765 } // namespace internal 6723 } // namespace internal
6766 } // namespace v8 6724 } // namespace v8
6767 6725
6768 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ 6726 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | src/crankshaft/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698