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

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

Issue 1244693002: Add support for adding an external and a tagged pointer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 5 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/arm64/lithium-arm64.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 4812 matching lines...) Expand 10 before | Expand all | Expand 10 after
4823 SetFlag(kUseGVN); 4823 SetFlag(kUseGVN);
4824 SetChangesFlag(kNewSpacePromotion); 4824 SetChangesFlag(kNewSpacePromotion);
4825 } 4825 }
4826 4826
4827 bool IsDeletable() const override { 4827 bool IsDeletable() const override {
4828 return !right()->representation().IsTagged(); 4828 return !right()->representation().IsTagged();
4829 } 4829 }
4830 }; 4830 };
4831 4831
4832 4832
4833 enum ExternalAddType {
4834 AddOfExternalAndTagged,
4835 AddOfExternalAndInt32,
4836 NoExternalAdd
4837 };
4838
4839
4833 class HAdd final : public HArithmeticBinaryOperation { 4840 class HAdd final : public HArithmeticBinaryOperation {
4834 public: 4841 public:
4835 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, 4842 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context,
4836 HValue* left, HValue* right, 4843 HValue* left, HValue* right,
4837 Strength strength = Strength::WEAK); 4844 Strength strength = Strength::WEAK);
4845 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context,
4846 HValue* left, HValue* right, Strength strength,
4847 ExternalAddType external_add_type);
4838 4848
4839 // Add is only commutative if two integer values are added and not if two 4849 // Add is only commutative if two integer values are added and not if two
4840 // tagged values are added (because it might be a String concatenation). 4850 // tagged values are added (because it might be a String concatenation).
4841 // We also do not commute (pointer + offset). 4851 // We also do not commute (pointer + offset).
4842 bool IsCommutative() const override { 4852 bool IsCommutative() const override {
4843 return !representation().IsTagged() && !representation().IsExternal(); 4853 return !representation().IsTagged() && !representation().IsExternal();
4844 } 4854 }
4845 4855
4846 HValue* Canonicalize() override; 4856 HValue* Canonicalize() override;
4847 4857
(...skipping 22 matching lines...) Expand all
4870 if (to.IsTagged()) { 4880 if (to.IsTagged()) {
4871 SetChangesFlag(kNewSpacePromotion); 4881 SetChangesFlag(kNewSpacePromotion);
4872 ClearFlag(kAllowUndefinedAsNaN); 4882 ClearFlag(kAllowUndefinedAsNaN);
4873 } 4883 }
4874 } 4884 }
4875 4885
4876 Representation RepresentationFromInputs() override; 4886 Representation RepresentationFromInputs() override;
4877 4887
4878 Representation RequiredInputRepresentation(int index) override; 4888 Representation RequiredInputRepresentation(int index) override;
4879 4889
4890 bool IsConsistentExternalRepresentation() {
4891 return left()->representation().IsExternal() &&
4892 ((external_add_type_ == AddOfExternalAndInt32 &&
4893 right()->representation().IsInteger32()) ||
4894 (external_add_type_ == AddOfExternalAndTagged &&
4895 right()->representation().IsTagged()));
4896 }
4897
4880 DECLARE_CONCRETE_INSTRUCTION(Add) 4898 DECLARE_CONCRETE_INSTRUCTION(Add)
4881 4899
4882 protected: 4900 protected:
4883 bool DataEquals(HValue* other) override { return true; } 4901 bool DataEquals(HValue* other) override { return true; }
4884 4902
4885 Range* InferRange(Zone* zone) override; 4903 Range* InferRange(Zone* zone) override;
4886 4904
4887 private: 4905 private:
4888 HAdd(HValue* context, HValue* left, HValue* right, Strength strength) 4906 HAdd(HValue* context, HValue* left, HValue* right, Strength strength,
4889 : HArithmeticBinaryOperation(context, left, right, strength) { 4907 ExternalAddType external_add_type = NoExternalAdd)
4908 : HArithmeticBinaryOperation(context, left, right, strength),
4909 external_add_type_(external_add_type) {
4890 SetFlag(kCanOverflow); 4910 SetFlag(kCanOverflow);
4911 switch (external_add_type_) {
4912 case AddOfExternalAndTagged:
4913 DCHECK(left->representation().IsExternal());
4914 DCHECK(right->representation().IsTagged());
4915 SetDependsOnFlag(kNewSpacePromotion);
4916 break;
4917
4918 case NoExternalAdd:
4919 // This is a bit of a hack: The call to this constructor is generated
4920 // by a macro that also supports sub and mul, so it doesn't pass in
4921 // a value for external_add_type but uses the default.
4922 if (left->representation().IsExternal()) {
4923 external_add_type_ = AddOfExternalAndInt32;
4924 }
4925 break;
4926
4927 case AddOfExternalAndInt32:
4928 // See comment above.
4929 UNREACHABLE();
4930 break;
4931 }
4891 } 4932 }
4933
4934 ExternalAddType external_add_type_;
4892 }; 4935 };
4893 4936
4894 4937
4895 class HSub final : public HArithmeticBinaryOperation { 4938 class HSub final : public HArithmeticBinaryOperation {
4896 public: 4939 public:
4897 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, 4940 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context,
4898 HValue* left, HValue* right, 4941 HValue* left, HValue* right,
4899 Strength strength = Strength::WEAK); 4942 Strength strength = Strength::WEAK);
4900 4943
4901 HValue* Canonicalize() override; 4944 HValue* Canonicalize() override;
(...skipping 3140 matching lines...) Expand 10 before | Expand all | Expand 10 after
8042 }; 8085 };
8043 8086
8044 8087
8045 8088
8046 #undef DECLARE_INSTRUCTION 8089 #undef DECLARE_INSTRUCTION
8047 #undef DECLARE_CONCRETE_INSTRUCTION 8090 #undef DECLARE_CONCRETE_INSTRUCTION
8048 8091
8049 } } // namespace v8::internal 8092 } } // namespace v8::internal
8050 8093
8051 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 8094 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/arm64/lithium-arm64.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698