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

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, 3 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') | 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 namespace v8 { 43 namespace v8 {
44 namespace internal { 44 namespace internal {
45 45
46 // Forward declarations. 46 // Forward declarations.
47 class HBasicBlock; 47 class HBasicBlock;
48 class HEnvironment; 48 class HEnvironment;
49 class HInferRepresentationPhase; 49 class HInferRepresentationPhase;
50 class HInstruction; 50 class HInstruction;
51 class HLoopInformation; 51 class HLoopInformation;
52 class HStoreNamedField;
52 class HValue; 53 class HValue;
53 class LInstruction; 54 class LInstruction;
54 class LChunkBuilder; 55 class LChunkBuilder;
55 56
56
57 #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \ 57 #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \
58 V(ArithmeticBinaryOperation) \ 58 V(ArithmeticBinaryOperation) \
59 V(BinaryOperation) \ 59 V(BinaryOperation) \
60 V(BitwiseBinaryOperation) \ 60 V(BitwiseBinaryOperation) \
61 V(ControlInstruction) \ 61 V(ControlInstruction) \
62 V(Instruction) \ 62 V(Instruction) \
63 63
64 64
65 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ 65 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \
66 V(AbnormalExit) \ 66 V(AbnormalExit) \
(...skipping 3156 matching lines...) Expand 10 before | Expand all | Expand 10 after
3223 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) 3223 DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
3224 }; 3224 };
3225 3225
3226 3226
3227 class HConstant V8_FINAL : public HTemplateInstruction<0> { 3227 class HConstant V8_FINAL : public HTemplateInstruction<0> {
3228 public: 3228 public:
3229 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); 3229 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t);
3230 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); 3230 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation);
3231 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); 3231 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double);
3232 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); 3232 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>);
3233 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, Handle<Map>, UniqueValueId);
3233 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); 3234 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference);
3234 3235
3236 static HConstant* CreateAndInsertAfter(Zone* zone,
3237 HValue* context,
3238 int32_t value,
3239 HInstruction* instruction) {
3240 HConstant* new_constant = HConstant::New(zone, context, value);
3241 new_constant->InsertAfter(instruction);
3242 return new_constant;
3243 }
3244
3245 static HConstant* CreateAndInsertBefore(Zone* zone,
3246 HValue* context,
3247 int32_t value,
3248 HInstruction* instruction) {
3249 HConstant* new_constant = HConstant::New(zone, context, value);
3250 new_constant->InsertBefore(instruction);
3251 return new_constant;
3252 }
3253
3235 Handle<Object> handle() { 3254 Handle<Object> handle() {
3236 if (handle_.is_null()) { 3255 if (handle_.is_null()) {
3237 Factory* factory = Isolate::Current()->factory(); 3256 Factory* factory = Isolate::Current()->factory();
3238 // Default arguments to is_not_in_new_space depend on this heap number 3257 // Default arguments to is_not_in_new_space depend on this heap number
3239 // to be tenured so that it's guaranteed not be be located in new space. 3258 // to be tenured so that it's guaranteed not be be located in new space.
3240 handle_ = factory->NewNumber(double_value_, TENURED); 3259 handle_ = factory->NewNumber(double_value_, TENURED);
3241 } 3260 }
3242 AllowDeferredHandleDereference smi_check; 3261 AllowDeferredHandleDereference smi_check;
3243 ASSERT(has_int32_value_ || !handle_->IsSmi()); 3262 ASSERT(has_int32_value_ || !handle_->IsSmi());
3244 return handle_; 3263 return handle_;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
3427 bool is_not_in_new_space = true, 3446 bool is_not_in_new_space = true,
3428 Handle<Object> optional_handle = Handle<Object>::null()); 3447 Handle<Object> optional_handle = Handle<Object>::null());
3429 HConstant(Handle<Object> handle, 3448 HConstant(Handle<Object> handle,
3430 UniqueValueId unique_id, 3449 UniqueValueId unique_id,
3431 Representation r, 3450 Representation r,
3432 HType type, 3451 HType type,
3433 bool is_internalized_string, 3452 bool is_internalized_string,
3434 bool is_not_in_new_space, 3453 bool is_not_in_new_space,
3435 bool is_cell, 3454 bool is_cell,
3436 bool boolean_value); 3455 bool boolean_value);
3456 HConstant(Handle<Map> handle,
3457 UniqueValueId unique_id);
3437 explicit HConstant(ExternalReference reference); 3458 explicit HConstant(ExternalReference reference);
3438 3459
3439 void Initialize(Representation r); 3460 void Initialize(Representation r);
3440 3461
3441 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3462 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
3442 3463
3443 // If this is a numerical constant, handle_ either points to to the 3464 // If this is a numerical constant, handle_ either points to to the
3444 // HeapObject the constant originated from or is null. If the 3465 // HeapObject the constant originated from or is null. If the
3445 // constant is non-numeric, handle_ always points to a valid 3466 // constant is non-numeric, handle_ always points to a valid
3446 // constant HeapObject. 3467 // constant HeapObject.
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after
5094 } 5115 }
5095 5116
5096 void MakePrefillWithFiller() { 5117 void MakePrefillWithFiller() {
5097 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); 5118 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER);
5098 } 5119 }
5099 5120
5100 void MakeDoubleAligned() { 5121 void MakeDoubleAligned() {
5101 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); 5122 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED);
5102 } 5123 }
5103 5124
5104 void UpdateSize(HValue* size) {
5105 SetOperandAt(1, size);
5106 }
5107
5108 virtual void HandleSideEffectDominator(GVNFlag side_effect, 5125 virtual void HandleSideEffectDominator(GVNFlag side_effect,
5109 HValue* dominator) V8_OVERRIDE; 5126 HValue* dominator) V8_OVERRIDE;
5110 5127
5111 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5128 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5112 5129
5113 DECLARE_CONCRETE_INSTRUCTION(Allocate) 5130 DECLARE_CONCRETE_INSTRUCTION(Allocate)
5114 5131
5115 private: 5132 private:
5116 enum Flags { 5133 enum Flags {
5117 ALLOCATE_IN_NEW_SPACE = 1 << 0, 5134 ALLOCATE_IN_NEW_SPACE = 1 << 0,
5118 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, 5135 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1,
5119 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, 5136 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2,
5120 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, 5137 ALLOCATE_DOUBLE_ALIGNED = 1 << 3,
5121 PREFILL_WITH_FILLER = 1 << 4 5138 PREFILL_WITH_FILLER = 1 << 4
5122 }; 5139 };
5123 5140
5124 HAllocate(HValue* context, 5141 HAllocate(HValue* context,
5125 HValue* size, 5142 HValue* size,
5126 HType type, 5143 HType type,
5127 PretenureFlag pretenure_flag, 5144 PretenureFlag pretenure_flag,
5128 InstanceType instance_type) 5145 InstanceType instance_type)
5129 : HTemplateInstruction<2>(type) { 5146 : HTemplateInstruction<2>(type),
5147 dominating_allocate_(NULL),
5148 filler_free_space_size_(NULL) {
5130 SetOperandAt(0, context); 5149 SetOperandAt(0, context);
5131 SetOperandAt(1, size); 5150 SetOperandAt(1, size);
5132 set_representation(Representation::Tagged()); 5151 set_representation(Representation::Tagged());
5133 SetFlag(kTrackSideEffectDominators); 5152 SetFlag(kTrackSideEffectDominators);
5134 SetGVNFlag(kChangesNewSpacePromotion); 5153 SetGVNFlag(kChangesNewSpacePromotion);
5135 SetGVNFlag(kDependsOnNewSpacePromotion); 5154 SetGVNFlag(kDependsOnNewSpacePromotion);
5136 flags_ = pretenure_flag == TENURED 5155 flags_ = pretenure_flag == TENURED
5137 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE 5156 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE
5138 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) 5157 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE)
5139 : ALLOCATE_IN_NEW_SPACE; 5158 : ALLOCATE_IN_NEW_SPACE;
5140 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { 5159 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) {
5141 flags_ = static_cast<HAllocate::Flags>(flags_ | 5160 flags_ = static_cast<HAllocate::Flags>(flags_ |
5142 ALLOCATE_DOUBLE_ALIGNED); 5161 ALLOCATE_DOUBLE_ALIGNED);
5143 } 5162 }
5144 } 5163 }
5145 5164
5165 void UpdateSize(HValue* size) {
5166 SetOperandAt(1, size);
5167 }
5168
5169 HAllocate* GetFoldableDominator(HAllocate* dominator);
5170
5171 void UpdateFreeSpaceFiller(int32_t filler_size);
5172
5173 void CreateFreeSpaceFiller(int32_t filler_size);
5174
5175 bool IsFoldable(HAllocate* allocate) {
5176 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) ||
5177 (IsOldDataSpaceAllocation() && allocate->IsOldDataSpaceAllocation()) ||
5178 (IsOldPointerSpaceAllocation() &&
5179 allocate->IsOldPointerSpaceAllocation());
5180 }
5181
5146 Flags flags_; 5182 Flags flags_;
5147 Handle<Map> known_initial_map_; 5183 Handle<Map> known_initial_map_;
5184 HAllocate* dominating_allocate_;
5185 HStoreNamedField* filler_free_space_size_;
5148 }; 5186 };
5149 5187
5150 5188
5151 class HInnerAllocatedObject V8_FINAL : public HTemplateInstruction<1> { 5189 class HInnerAllocatedObject V8_FINAL : public HTemplateInstruction<1> {
5152 public: 5190 public:
5153 static HInnerAllocatedObject* New(Zone* zone, 5191 static HInnerAllocatedObject* New(Zone* zone,
5154 HValue* context, 5192 HValue* context,
5155 HValue* value, 5193 HValue* value,
5156 int offset, 5194 int offset,
5157 HType type = HType::Tagged()) { 5195 HType type = HType::Tagged()) {
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
5984 6022
5985 bool NeedsWriteBarrierForMap() { 6023 bool NeedsWriteBarrierForMap() {
5986 if (IsSkipWriteBarrier()) return false; 6024 if (IsSkipWriteBarrier()) return false;
5987 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); 6025 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator());
5988 } 6026 }
5989 6027
5990 Representation field_representation() const { 6028 Representation field_representation() const {
5991 return access_.representation(); 6029 return access_.representation();
5992 } 6030 }
5993 6031
6032 void UpdateValue(HValue* value) {
6033 SetOperandAt(1, value);
6034 }
6035
5994 private: 6036 private:
5995 HStoreNamedField(HValue* obj, 6037 HStoreNamedField(HValue* obj,
5996 HObjectAccess access, 6038 HObjectAccess access,
5997 HValue* val) 6039 HValue* val)
5998 : access_(access), 6040 : access_(access),
5999 new_space_dominator_(NULL), 6041 new_space_dominator_(NULL),
6000 write_barrier_mode_(UPDATE_WRITE_BARRIER), 6042 write_barrier_mode_(UPDATE_WRITE_BARRIER),
6001 has_transition_(false) { 6043 has_transition_(false) {
6002 SetOperandAt(0, obj); 6044 SetOperandAt(0, obj);
6003 SetOperandAt(1, val); 6045 SetOperandAt(1, val);
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
6792 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6834 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6793 }; 6835 };
6794 6836
6795 6837
6796 #undef DECLARE_INSTRUCTION 6838 #undef DECLARE_INSTRUCTION
6797 #undef DECLARE_CONCRETE_INSTRUCTION 6839 #undef DECLARE_CONCRETE_INSTRUCTION
6798 6840
6799 } } // namespace v8::internal 6841 } } // namespace v8::internal
6800 6842
6801 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6843 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698