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

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

Issue 22378003: Added allocation folding support for old space allocations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 | « no previous file | src/hydrogen-instructions.cc » ('j') | src/hydrogen-instructions.cc » ('J')
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 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3198 }; 3198 };
3199 3199
3200 3200
3201 class HConstant: public HTemplateInstruction<0> { 3201 class HConstant: public HTemplateInstruction<0> {
3202 public: 3202 public:
3203 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); 3203 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t);
3204 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); 3204 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation);
3205 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); 3205 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double);
3206 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); 3206 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>);
3207 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); 3207 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference);
3208 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, Handle<Object>, UniqueValueId);
3208 3209
3209 Handle<Object> handle() { 3210 Handle<Object> handle() {
3210 if (handle_.is_null()) { 3211 if (handle_.is_null()) {
3211 Factory* factory = Isolate::Current()->factory(); 3212 Factory* factory = Isolate::Current()->factory();
3212 // Default arguments to is_not_in_new_space depend on this heap number 3213 // Default arguments to is_not_in_new_space depend on this heap number
3213 // to be tenured so that it's guaranteed not be be located in new space. 3214 // to be tenured so that it's guaranteed not be be located in new space.
3214 handle_ = factory->NewNumber(double_value_, TENURED); 3215 handle_ = factory->NewNumber(double_value_, TENURED);
3215 } 3216 }
3216 AllowDeferredHandleDereference smi_check; 3217 AllowDeferredHandleDereference smi_check;
3217 ASSERT(has_int32_value_ || !handle_->IsSmi()); 3218 ASSERT(has_int32_value_ || !handle_->IsSmi());
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
3390 HConstant(int32_t value, 3391 HConstant(int32_t value,
3391 Representation r = Representation::None(), 3392 Representation r = Representation::None(),
3392 bool is_not_in_new_space = true, 3393 bool is_not_in_new_space = true,
3393 Handle<Object> optional_handle = Handle<Object>::null()); 3394 Handle<Object> optional_handle = Handle<Object>::null());
3394 HConstant(double value, 3395 HConstant(double value,
3395 Representation r = Representation::None(), 3396 Representation r = Representation::None(),
3396 bool is_not_in_new_space = true, 3397 bool is_not_in_new_space = true,
3397 Handle<Object> optional_handle = Handle<Object>::null()); 3398 Handle<Object> optional_handle = Handle<Object>::null());
3398 HConstant(Handle<Object> handle, 3399 HConstant(Handle<Object> handle,
3399 UniqueValueId unique_id, 3400 UniqueValueId unique_id,
3400 Representation r, 3401 Representation r = Representation::Tagged(),
3401 HType type, 3402 HType type = HType::Tagged(),
3402 bool is_internalized_string, 3403 bool is_internalized_string = false,
3403 bool is_not_in_new_space, 3404 bool is_not_in_new_space = true,
3404 bool is_cell, 3405 bool is_cell = false,
3405 bool boolean_value); 3406 bool boolean_value = false);
3406 explicit HConstant(ExternalReference reference); 3407 explicit HConstant(ExternalReference reference);
3407 3408
3408 void Initialize(Representation r); 3409 void Initialize(Representation r);
3409 3410
3410 virtual bool IsDeletable() const { return true; } 3411 virtual bool IsDeletable() const { return true; }
3411 3412
3412 // If this is a numerical constant, handle_ either points to to the 3413 // If this is a numerical constant, handle_ either points to to the
3413 // HeapObject the constant originated from or is null. If the 3414 // HeapObject the constant originated from or is null. If the
3414 // constant is non-numeric, handle_ always points to a valid 3415 // constant is non-numeric, handle_ always points to a valid
3415 // constant HeapObject. 3416 // constant HeapObject.
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after
5033 } 5034 }
5034 5035
5035 void MakeDoubleAligned() { 5036 void MakeDoubleAligned() {
5036 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); 5037 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED);
5037 } 5038 }
5038 5039
5039 void UpdateSize(HValue* size) { 5040 void UpdateSize(HValue* size) {
5040 SetOperandAt(1, size); 5041 SetOperandAt(1, size);
5041 } 5042 }
5042 5043
5044 bool IsFoldable(HAllocate* allocate) {
5045 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) ||
5046 (IsOldDataSpaceAllocation() && allocate->IsOldDataSpaceAllocation()) ||
5047 (IsOldPointerSpaceAllocation() &&
5048 allocate->IsOldPointerSpaceAllocation());
5049 }
5050
5051 HAllocate* dominating_allocate() const {
5052 return dominating_allocate_;
5053 }
5054
5055 void set_dominating_allocate(HAllocate* allocate) {
titzer 2013/08/06 12:24:12 Don't add setters for fields that should not be mo
Hannes Payer (out of office) 2013/08/07 07:48:01 I made all setters and getters used just by HAlloc
5056 dominating_allocate_ = allocate;
5057 }
5058
5059 HConstant* filler_free_space_size() const {
5060 return filler_free_space_size_;
5061 }
5062
5063 void set_filler_free_space_size(HConstant* filler_free_space_size) {
5064 filler_free_space_size_ = filler_free_space_size;
5065 }
5066
5043 virtual void HandleSideEffectDominator(GVNFlag side_effect, 5067 virtual void HandleSideEffectDominator(GVNFlag side_effect,
5044 HValue* dominator); 5068 HValue* dominator);
5045 5069
5046 virtual void PrintDataTo(StringStream* stream); 5070 virtual void PrintDataTo(StringStream* stream);
5047 5071
5048 DECLARE_CONCRETE_INSTRUCTION(Allocate) 5072 DECLARE_CONCRETE_INSTRUCTION(Allocate)
5049 5073
5050 private: 5074 private:
5051 enum Flags { 5075 enum Flags {
5052 ALLOCATE_IN_NEW_SPACE = 1 << 0, 5076 ALLOCATE_IN_NEW_SPACE = 1 << 0,
5053 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, 5077 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1,
5054 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, 5078 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2,
5055 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, 5079 ALLOCATE_DOUBLE_ALIGNED = 1 << 3,
5056 PREFILL_WITH_FILLER = 1 << 4 5080 PREFILL_WITH_FILLER = 1 << 4
5057 }; 5081 };
5058 5082
5059 HAllocate(HValue* context, 5083 HAllocate(HValue* context,
5060 HValue* size, 5084 HValue* size,
5061 HType type, 5085 HType type,
5062 PretenureFlag pretenure_flag, 5086 PretenureFlag pretenure_flag,
5063 InstanceType instance_type) 5087 InstanceType instance_type)
5064 : HTemplateInstruction<2>(type) { 5088 : HTemplateInstruction<2>(type),
5089 dominating_allocate_(NULL),
5090 filler_free_space_size_(NULL) {
5065 SetOperandAt(0, context); 5091 SetOperandAt(0, context);
5066 SetOperandAt(1, size); 5092 SetOperandAt(1, size);
5067 set_representation(Representation::Tagged()); 5093 set_representation(Representation::Tagged());
5068 SetFlag(kTrackSideEffectDominators); 5094 SetFlag(kTrackSideEffectDominators);
5069 SetGVNFlag(kChangesNewSpacePromotion); 5095 SetGVNFlag(kChangesNewSpacePromotion);
5070 SetGVNFlag(kDependsOnNewSpacePromotion); 5096 SetGVNFlag(kDependsOnNewSpacePromotion);
5071 flags_ = pretenure_flag == TENURED 5097 flags_ = pretenure_flag == TENURED
5072 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE 5098 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE
5073 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) 5099 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE)
5074 : ALLOCATE_IN_NEW_SPACE; 5100 : ALLOCATE_IN_NEW_SPACE;
5075 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { 5101 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) {
5076 flags_ = static_cast<HAllocate::Flags>(flags_ | 5102 flags_ = static_cast<HAllocate::Flags>(flags_ |
5077 ALLOCATE_DOUBLE_ALIGNED); 5103 ALLOCATE_DOUBLE_ALIGNED);
5078 } 5104 }
5079 } 5105 }
5080 5106
5081 Flags flags_; 5107 Flags flags_;
5082 Handle<Map> known_initial_map_; 5108 Handle<Map> known_initial_map_;
5109 HAllocate* dominating_allocate_;
5110 HConstant* filler_free_space_size_;
5083 }; 5111 };
5084 5112
5085 5113
5086 class HInnerAllocatedObject: public HTemplateInstruction<1> { 5114 class HInnerAllocatedObject: public HTemplateInstruction<1> {
5087 public: 5115 public:
5088 static HInnerAllocatedObject* New(Zone* zone, 5116 static HInnerAllocatedObject* New(Zone* zone,
5089 HValue* context, 5117 HValue* context,
5090 HValue* value, 5118 HValue* value,
5091 int offset, 5119 int offset,
5092 HType type = HType::Tagged()) { 5120 HType type = HType::Tagged()) {
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
6778 virtual bool IsDeletable() const { return true; } 6806 virtual bool IsDeletable() const { return true; }
6779 }; 6807 };
6780 6808
6781 6809
6782 #undef DECLARE_INSTRUCTION 6810 #undef DECLARE_INSTRUCTION
6783 #undef DECLARE_CONCRETE_INSTRUCTION 6811 #undef DECLARE_CONCRETE_INSTRUCTION
6784 6812
6785 } } // namespace v8::internal 6813 } } // namespace v8::internal
6786 6814
6787 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6815 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | src/hydrogen-instructions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698