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

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

Issue 15734002: Add pretenuring support to HAllocateObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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
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 4822 matching lines...) Expand 10 before | Expand all | Expand 10 after
4833 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) 4833 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric)
4834 4834
4835 private: 4835 private:
4836 Handle<Object> name_; 4836 Handle<Object> name_;
4837 bool for_typeof_; 4837 bool for_typeof_;
4838 }; 4838 };
4839 4839
4840 4840
4841 class HAllocateObject: public HTemplateInstruction<1> { 4841 class HAllocateObject: public HTemplateInstruction<1> {
4842 public: 4842 public:
4843 HAllocateObject(HValue* context, Handle<JSFunction> constructor) 4843 enum Flags {
4844 : constructor_(constructor) { 4844 CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0,
4845 CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 1
4846 };
4847
4848 HAllocateObject(HValue* context, Handle<JSFunction> constructor, Flags flags)
4849 : constructor_(constructor),
4850 flags_(flags) {
4845 SetOperandAt(0, context); 4851 SetOperandAt(0, context);
4846 set_representation(Representation::Tagged()); 4852 set_representation(Representation::Tagged());
4847 SetGVNFlag(kChangesNewSpacePromotion); 4853 SetGVNFlag(kChangesNewSpacePromotion);
4848 constructor_initial_map_ = constructor->has_initial_map() 4854 constructor_initial_map_ = constructor->has_initial_map()
4849 ? Handle<Map>(constructor->initial_map()) 4855 ? Handle<Map>(constructor->initial_map())
4850 : Handle<Map>::null(); 4856 : Handle<Map>::null();
4851 // If slack tracking finished, the instance size and property counts 4857 // If slack tracking finished, the instance size and property counts
4852 // remain unchanged so that we can allocate memory for the object. 4858 // remain unchanged so that we can allocate memory for the object.
4853 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress()); 4859 ASSERT(!constructor->shared()->IsInobjectSlackTrackingInProgress());
4854 } 4860 }
4855 4861
4856 // Maximum instance size for which allocations will be inlined. 4862 // Maximum instance size for which allocations will be inlined.
4857 static const int kMaxSize = 64 * kPointerSize; 4863 static const int kMaxSize = 64 * kPointerSize;
4858 4864
4859 HValue* context() { return OperandAt(0); } 4865 HValue* context() { return OperandAt(0); }
4860 Handle<JSFunction> constructor() { return constructor_; } 4866 Handle<JSFunction> constructor() { return constructor_; }
4861 Handle<Map> constructor_initial_map() { return constructor_initial_map_; } 4867 Handle<Map> constructor_initial_map() { return constructor_initial_map_; }
4862 4868
4863 virtual Representation RequiredInputRepresentation(int index) { 4869 virtual Representation RequiredInputRepresentation(int index) {
4864 return Representation::Tagged(); 4870 return Representation::Tagged();
4865 } 4871 }
4866 virtual Handle<Map> GetMonomorphicJSObjectMap() { 4872 virtual Handle<Map> GetMonomorphicJSObjectMap() {
4867 ASSERT(!constructor_initial_map_.is_null()); 4873 ASSERT(!constructor_initial_map_.is_null());
4868 return constructor_initial_map_; 4874 return constructor_initial_map_;
4869 } 4875 }
4870 virtual HType CalculateInferredType(); 4876 virtual HType CalculateInferredType();
4871 4877
4878 static Flags DefaultFlags() {
mvstanton 2013/05/23 12:47:46 It would be nice if these ~20 lines could be share
4879 return CAN_ALLOCATE_IN_NEW_SPACE;
4880 }
4881
4882 bool CanAllocateInNewSpace() const {
4883 return (flags_ & CAN_ALLOCATE_IN_NEW_SPACE) != 0;
4884 }
4885
4886 bool CanAllocateInOldPointerSpace() const {
4887 return (flags_ & CAN_ALLOCATE_IN_OLD_POINTER_SPACE) != 0;
4888 }
4889
4890 bool GuaranteedInNewSpace() const {
4891 return CanAllocateInNewSpace() && !CanAllocateInOldPointerSpace();
4892 }
4893
4872 DECLARE_CONCRETE_INSTRUCTION(AllocateObject) 4894 DECLARE_CONCRETE_INSTRUCTION(AllocateObject)
4873 4895
4874 private: 4896 private:
4875 // TODO(svenpanne) Might be safe, but leave it out until we know for sure. 4897 // TODO(svenpanne) Might be safe, but leave it out until we know for sure.
4876 // virtual bool IsDeletable() const { return true; } 4898 // virtual bool IsDeletable() const { return true; }
4877 4899
4878 Handle<JSFunction> constructor_; 4900 Handle<JSFunction> constructor_;
4879 Handle<Map> constructor_initial_map_; 4901 Handle<Map> constructor_initial_map_;
4902 Flags flags_;
4880 }; 4903 };
4881 4904
4882 4905
4883 class HAllocate: public HTemplateInstruction<2> { 4906 class HAllocate: public HTemplateInstruction<2> {
4884 public: 4907 public:
4885 enum Flags { 4908 enum Flags {
4886 CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0, 4909 CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0,
4887 CAN_ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, 4910 CAN_ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1,
4888 CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, 4911 CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2,
4889 ALLOCATE_DOUBLE_ALIGNED = 1 << 3 4912 ALLOCATE_DOUBLE_ALIGNED = 1 << 3
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
4992 5015
4993 5016
4994 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, 5017 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object,
4995 HValue* new_space_dominator) { 5018 HValue* new_space_dominator) {
4996 if (object->IsInnerAllocatedObject()) { 5019 if (object->IsInnerAllocatedObject()) {
4997 return ReceiverObjectNeedsWriteBarrier( 5020 return ReceiverObjectNeedsWriteBarrier(
4998 HInnerAllocatedObject::cast(object)->base_object(), 5021 HInnerAllocatedObject::cast(object)->base_object(),
4999 new_space_dominator); 5022 new_space_dominator);
5000 } 5023 }
5001 if (object != new_space_dominator) return true; 5024 if (object != new_space_dominator) return true;
5002 if (object->IsAllocateObject()) return false; 5025 if (object->IsAllocateObject()) {
5026 return !HAllocateObject::cast(object)->GuaranteedInNewSpace();
5027 }
5003 if (object->IsAllocate()) { 5028 if (object->IsAllocate()) {
5004 return !HAllocate::cast(object)->GuaranteedInNewSpace(); 5029 return !HAllocate::cast(object)->GuaranteedInNewSpace();
5005 } 5030 }
5006 return true; 5031 return true;
5007 } 5032 }
5008 5033
5009 5034
5010 class HStoreGlobalCell: public HUnaryOperation { 5035 class HStoreGlobalCell: public HUnaryOperation {
5011 public: 5036 public:
5012 HStoreGlobalCell(HValue* value, 5037 HStoreGlobalCell(HValue* value,
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
6462 virtual bool IsDeletable() const { return true; } 6487 virtual bool IsDeletable() const { return true; }
6463 }; 6488 };
6464 6489
6465 6490
6466 #undef DECLARE_INSTRUCTION 6491 #undef DECLARE_INSTRUCTION
6467 #undef DECLARE_CONCRETE_INSTRUCTION 6492 #undef DECLARE_CONCRETE_INSTRUCTION
6468 6493
6469 } } // namespace v8::internal 6494 } } // namespace v8::internal
6470 6495
6471 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6496 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« src/flag-definitions.h ('K') | « src/hydrogen.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698