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

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
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 ExternalAddType external_add_type() const { return external_add_type_; }
4891
4880 DECLARE_CONCRETE_INSTRUCTION(Add) 4892 DECLARE_CONCRETE_INSTRUCTION(Add)
4881 4893
4882 protected: 4894 protected:
4883 bool DataEquals(HValue* other) override { return true; } 4895 bool DataEquals(HValue* other) override { return true; }
4884 4896
4885 Range* InferRange(Zone* zone) override; 4897 Range* InferRange(Zone* zone) override;
4886 4898
4887 private: 4899 private:
4888 HAdd(HValue* context, HValue* left, HValue* right, Strength strength) 4900 HAdd(HValue* context, HValue* left, HValue* right, Strength strength,
4889 : HArithmeticBinaryOperation(context, left, right, strength) { 4901 ExternalAddType external_add_type = NoExternalAdd)
4902 : HArithmeticBinaryOperation(context, left, right, strength),
4903 external_add_type_(external_add_type) {
4890 SetFlag(kCanOverflow); 4904 SetFlag(kCanOverflow);
4905 if (left->representation().IsExternal()) {
4906 if (right->representation().IsTagged()) {
4907 DCHECK_EQ(external_add_type_, AddOfExternalAndTagged);
4908 SetDependsOnFlag(kNewSpacePromotion);
4909 } else {
4910 // This is a bit of a hack: The call to this constructor is generated
4911 // by a macro that also supports sub and mul, so it doesn't pass in
4912 // a value for external_add_type but uses the default.
4913 DCHECK_EQ(external_add_type_, NoExternalAdd);
4914 external_add_type_ = AddOfExternalAndInt32;
4915 }
4916 } else {
4917 DCHECK_EQ(external_add_type_, NoExternalAdd);
4918 }
Jarin 2015/07/20 14:17:56 Hmm, I was imagining you would drive it the other
4891 } 4919 }
4920
4921 ExternalAddType external_add_type_;
4892 }; 4922 };
4893 4923
4894 4924
4895 class HSub final : public HArithmeticBinaryOperation { 4925 class HSub final : public HArithmeticBinaryOperation {
4896 public: 4926 public:
4897 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, 4927 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context,
4898 HValue* left, HValue* right, 4928 HValue* left, HValue* right,
4899 Strength strength = Strength::WEAK); 4929 Strength strength = Strength::WEAK);
4900 4930
4901 HValue* Canonicalize() override; 4931 HValue* Canonicalize() override;
(...skipping 3140 matching lines...) Expand 10 before | Expand all | Expand 10 after
8042 }; 8072 };
8043 8073
8044 8074
8045 8075
8046 #undef DECLARE_INSTRUCTION 8076 #undef DECLARE_INSTRUCTION
8047 #undef DECLARE_CONCRETE_INSTRUCTION 8077 #undef DECLARE_CONCRETE_INSTRUCTION
8048 8078
8049 } } // namespace v8::internal 8079 } } // namespace v8::internal
8050 8080
8051 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 8081 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698