OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 6901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6912 ElementsKind to_kind_; | 6912 ElementsKind to_kind_; |
6913 }; | 6913 }; |
6914 | 6914 |
6915 | 6915 |
6916 class HStringAdd V8_FINAL : public HBinaryOperation { | 6916 class HStringAdd V8_FINAL : public HBinaryOperation { |
6917 public: | 6917 public: |
6918 static HInstruction* New(Zone* zone, | 6918 static HInstruction* New(Zone* zone, |
6919 HValue* context, | 6919 HValue* context, |
6920 HValue* left, | 6920 HValue* left, |
6921 HValue* right, | 6921 HValue* right, |
6922 StringAddFlags flags = STRING_ADD_CHECK_NONE); | 6922 PretenureFlag pretenure_flag = NOT_TENURED, |
| 6923 StringAddFlags flags = STRING_ADD_CHECK_BOTH, |
| 6924 Handle<AllocationSite> allocation_site = |
| 6925 Handle<AllocationSite>::null()); |
6923 | 6926 |
6924 StringAddFlags flags() const { return flags_; } | 6927 StringAddFlags flags() const { return flags_; } |
| 6928 PretenureFlag pretenure_flag() const { return pretenure_flag_; } |
6925 | 6929 |
6926 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6930 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6927 return Representation::Tagged(); | 6931 return Representation::Tagged(); |
6928 } | 6932 } |
6929 | 6933 |
| 6934 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 6935 |
6930 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 6936 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
6931 | 6937 |
6932 protected: | 6938 protected: |
6933 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 6939 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
| 6940 return flags_ == HStringAdd::cast(other)->flags_ && |
| 6941 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; |
| 6942 } |
6934 | 6943 |
6935 private: | 6944 private: |
6936 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) | 6945 HStringAdd(HValue* context, |
6937 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) { | 6946 HValue* left, |
| 6947 HValue* right, |
| 6948 PretenureFlag pretenure_flag, |
| 6949 StringAddFlags flags, |
| 6950 Handle<AllocationSite> allocation_site) |
| 6951 : HBinaryOperation(context, left, right, HType::String()), |
| 6952 flags_(flags), pretenure_flag_(pretenure_flag) { |
6938 set_representation(Representation::Tagged()); | 6953 set_representation(Representation::Tagged()); |
6939 if (MightHaveSideEffects()) { | 6954 SetFlag(kUseGVN); |
6940 SetAllSideEffects(); | 6955 SetGVNFlag(kDependsOnMaps); |
6941 } else { | 6956 SetGVNFlag(kChangesNewSpacePromotion); |
6942 SetFlag(kUseGVN); | 6957 if (FLAG_trace_pretenuring) { |
6943 SetGVNFlag(kDependsOnMaps); | 6958 PrintF("HStringAdd with AllocationSite %p %s\n", |
6944 SetGVNFlag(kChangesNewSpacePromotion); | 6959 allocation_site.is_null() |
| 6960 ? static_cast<void*>(NULL) |
| 6961 : static_cast<void*>(*allocation_site), |
| 6962 pretenure_flag == TENURED ? "tenured" : "not tenured"); |
6945 } | 6963 } |
6946 } | 6964 } |
6947 | 6965 |
6948 bool MightHaveSideEffects() const { | |
6949 return flags_ != STRING_ADD_CHECK_NONE && | |
6950 (left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved()); | |
6951 } | |
6952 | |
6953 // No side-effects except possible allocation: | 6966 // No side-effects except possible allocation: |
6954 // NOTE: this instruction does not call ToString() on its inputs, when flags_ | 6967 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
6955 // is set to STRING_ADD_CHECK_NONE. | |
6956 virtual bool IsDeletable() const V8_OVERRIDE { | |
6957 return !MightHaveSideEffects(); | |
6958 } | |
6959 | 6968 |
6960 const StringAddFlags flags_; | 6969 const StringAddFlags flags_; |
| 6970 const PretenureFlag pretenure_flag_; |
6961 }; | 6971 }; |
6962 | 6972 |
6963 | 6973 |
6964 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { | 6974 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { |
6965 public: | 6975 public: |
6966 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, | 6976 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, |
6967 HValue*, | 6977 HValue*, |
6968 HValue*); | 6978 HValue*); |
6969 | 6979 |
6970 virtual Representation RequiredInputRepresentation(int index) { | 6980 virtual Representation RequiredInputRepresentation(int index) { |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7493 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7503 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7494 }; | 7504 }; |
7495 | 7505 |
7496 | 7506 |
7497 #undef DECLARE_INSTRUCTION | 7507 #undef DECLARE_INSTRUCTION |
7498 #undef DECLARE_CONCRETE_INSTRUCTION | 7508 #undef DECLARE_CONCRETE_INSTRUCTION |
7499 | 7509 |
7500 } } // namespace v8::internal | 7510 } } // namespace v8::internal |
7501 | 7511 |
7502 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7512 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |