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

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

Issue 106313003: Reland "Allocation site support for monomorphic StringAdds in BinaryOps". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.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 // 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 6974 matching lines...) Expand 10 before | Expand all | Expand 10 after
6985 ElementsKind to_kind_; 6985 ElementsKind to_kind_;
6986 }; 6986 };
6987 6987
6988 6988
6989 class HStringAdd V8_FINAL : public HBinaryOperation { 6989 class HStringAdd V8_FINAL : public HBinaryOperation {
6990 public: 6990 public:
6991 static HInstruction* New(Zone* zone, 6991 static HInstruction* New(Zone* zone,
6992 HValue* context, 6992 HValue* context,
6993 HValue* left, 6993 HValue* left,
6994 HValue* right, 6994 HValue* right,
6995 StringAddFlags flags = STRING_ADD_CHECK_NONE); 6995 PretenureFlag pretenure_flag = NOT_TENURED,
6996 StringAddFlags flags = STRING_ADD_CHECK_BOTH,
6997 Handle<AllocationSite> allocation_site =
6998 Handle<AllocationSite>::null());
6996 6999
6997 StringAddFlags flags() const { return flags_; } 7000 StringAddFlags flags() const { return flags_; }
7001 PretenureFlag pretenure_flag() const { return pretenure_flag_; }
6998 7002
6999 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7003 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7000 return Representation::Tagged(); 7004 return Representation::Tagged();
7001 } 7005 }
7002 7006
7007 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
7008
7003 DECLARE_CONCRETE_INSTRUCTION(StringAdd) 7009 DECLARE_CONCRETE_INSTRUCTION(StringAdd)
7004 7010
7005 protected: 7011 protected:
7006 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 7012 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
7013 return flags_ == HStringAdd::cast(other)->flags_ &&
7014 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_;
7015 }
7007 7016
7008 private: 7017 private:
7009 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) 7018 HStringAdd(HValue* context,
7010 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) { 7019 HValue* left,
7020 HValue* right,
7021 PretenureFlag pretenure_flag,
7022 StringAddFlags flags,
7023 Handle<AllocationSite> allocation_site)
7024 : HBinaryOperation(context, left, right, HType::String()),
7025 flags_(flags), pretenure_flag_(pretenure_flag) {
7011 set_representation(Representation::Tagged()); 7026 set_representation(Representation::Tagged());
7012 if (MightHaveSideEffects()) { 7027 SetFlag(kUseGVN);
7013 SetAllSideEffects(); 7028 SetGVNFlag(kDependsOnMaps);
7014 } else { 7029 SetGVNFlag(kChangesNewSpacePromotion);
7015 SetFlag(kUseGVN); 7030 if (FLAG_trace_pretenuring) {
7016 SetGVNFlag(kDependsOnMaps); 7031 PrintF("HStringAdd with AllocationSite %p %s\n",
7017 SetGVNFlag(kChangesNewSpacePromotion); 7032 allocation_site.is_null()
7033 ? static_cast<void*>(NULL)
7034 : static_cast<void*>(*allocation_site),
7035 pretenure_flag == TENURED ? "tenured" : "not tenured");
7018 } 7036 }
7019 } 7037 }
7020 7038
7021 bool MightHaveSideEffects() const {
7022 return flags_ != STRING_ADD_CHECK_NONE &&
7023 (left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved());
7024 }
7025
7026 // No side-effects except possible allocation: 7039 // No side-effects except possible allocation:
7027 // NOTE: this instruction does not call ToString() on its inputs, when flags_ 7040 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7028 // is set to STRING_ADD_CHECK_NONE.
7029 virtual bool IsDeletable() const V8_OVERRIDE {
7030 return !MightHaveSideEffects();
7031 }
7032 7041
7033 const StringAddFlags flags_; 7042 const StringAddFlags flags_;
7043 const PretenureFlag pretenure_flag_;
7034 }; 7044 };
7035 7045
7036 7046
7037 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { 7047 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> {
7038 public: 7048 public:
7039 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, 7049 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt,
7040 HValue*, 7050 HValue*,
7041 HValue*); 7051 HValue*);
7042 7052
7043 virtual Representation RequiredInputRepresentation(int index) { 7053 virtual Representation RequiredInputRepresentation(int index) {
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
7566 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7576 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7567 }; 7577 };
7568 7578
7569 7579
7570 #undef DECLARE_INSTRUCTION 7580 #undef DECLARE_INSTRUCTION
7571 #undef DECLARE_CONCRETE_INSTRUCTION 7581 #undef DECLARE_CONCRETE_INSTRUCTION
7572 7582
7573 } } // namespace v8::internal 7583 } } // namespace v8::internal
7574 7584
7575 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7585 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698