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

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

Issue 23545008: Merged r16346, r16355 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
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 3163 matching lines...) Expand 10 before | Expand all | Expand 10 after
3230 int capture_id_; 3230 int capture_id_;
3231 }; 3231 };
3232 3232
3233 3233
3234 class HConstant V8_FINAL : public HTemplateInstruction<0> { 3234 class HConstant V8_FINAL : public HTemplateInstruction<0> {
3235 public: 3235 public:
3236 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); 3236 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t);
3237 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); 3237 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation);
3238 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); 3238 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double);
3239 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); 3239 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>);
3240 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, Handle<Map>, UniqueValueId);
3240 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); 3241 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference);
3241 3242
3243 static HConstant* CreateAndInsertAfter(Zone* zone,
3244 HValue* context,
3245 int32_t value,
3246 Representation representation,
3247 HInstruction* instruction) {
3248 HConstant* new_constant =
3249 HConstant::New(zone, context, value, representation);
3250 new_constant->InsertAfter(instruction);
3251 return new_constant;
3252 }
3253
3254 static HConstant* CreateAndInsertBefore(Zone* zone,
3255 HValue* context,
3256 int32_t value,
3257 Representation representation,
3258 HInstruction* instruction) {
3259 HConstant* new_constant =
3260 HConstant::New(zone, context, value, representation);
3261 new_constant->InsertBefore(instruction);
3262 return new_constant;
3263 }
3264
3242 Handle<Object> handle() { 3265 Handle<Object> handle() {
3243 if (handle_.is_null()) { 3266 if (handle_.is_null()) {
3244 Factory* factory = Isolate::Current()->factory(); 3267 Factory* factory = Isolate::Current()->factory();
3245 // Default arguments to is_not_in_new_space depend on this heap number 3268 // Default arguments to is_not_in_new_space depend on this heap number
3246 // to be tenured so that it's guaranteed not be be located in new space. 3269 // to be tenured so that it's guaranteed not be be located in new space.
3247 handle_ = factory->NewNumber(double_value_, TENURED); 3270 handle_ = factory->NewNumber(double_value_, TENURED);
3248 } 3271 }
3249 AllowDeferredHandleDereference smi_check; 3272 AllowDeferredHandleDereference smi_check;
3250 ASSERT(has_int32_value_ || !handle_->IsSmi()); 3273 ASSERT(has_int32_value_ || !handle_->IsSmi());
3251 return handle_; 3274 return handle_;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
3434 bool is_not_in_new_space = true, 3457 bool is_not_in_new_space = true,
3435 Handle<Object> optional_handle = Handle<Object>::null()); 3458 Handle<Object> optional_handle = Handle<Object>::null());
3436 HConstant(Handle<Object> handle, 3459 HConstant(Handle<Object> handle,
3437 UniqueValueId unique_id, 3460 UniqueValueId unique_id,
3438 Representation r, 3461 Representation r,
3439 HType type, 3462 HType type,
3440 bool is_internalized_string, 3463 bool is_internalized_string,
3441 bool is_not_in_new_space, 3464 bool is_not_in_new_space,
3442 bool is_cell, 3465 bool is_cell,
3443 bool boolean_value); 3466 bool boolean_value);
3467 HConstant(Handle<Map> handle,
3468 UniqueValueId unique_id);
3444 explicit HConstant(ExternalReference reference); 3469 explicit HConstant(ExternalReference reference);
3445 3470
3446 void Initialize(Representation r); 3471 void Initialize(Representation r);
3447 3472
3448 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3473 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
3449 3474
3450 // If this is a numerical constant, handle_ either points to to the 3475 // If this is a numerical constant, handle_ either points to to the
3451 // HeapObject the constant originated from or is null. If the 3476 // HeapObject the constant originated from or is null. If the
3452 // constant is non-numeric, handle_ always points to a valid 3477 // constant is non-numeric, handle_ always points to a valid
3453 // constant HeapObject. 3478 // constant HeapObject.
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after
5101 } 5126 }
5102 5127
5103 void MakePrefillWithFiller() { 5128 void MakePrefillWithFiller() {
5104 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); 5129 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER);
5105 } 5130 }
5106 5131
5107 void MakeDoubleAligned() { 5132 void MakeDoubleAligned() {
5108 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); 5133 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED);
5109 } 5134 }
5110 5135
5111 void UpdateSize(HValue* size) {
5112 SetOperandAt(1, size);
5113 }
5114
5115 virtual void HandleSideEffectDominator(GVNFlag side_effect, 5136 virtual void HandleSideEffectDominator(GVNFlag side_effect,
5116 HValue* dominator) V8_OVERRIDE; 5137 HValue* dominator) V8_OVERRIDE;
5117 5138
5118 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5139 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5119 5140
5120 DECLARE_CONCRETE_INSTRUCTION(Allocate) 5141 DECLARE_CONCRETE_INSTRUCTION(Allocate)
5121 5142
5122 private: 5143 private:
5123 enum Flags { 5144 enum Flags {
5124 ALLOCATE_IN_NEW_SPACE = 1 << 0, 5145 ALLOCATE_IN_NEW_SPACE = 1 << 0,
5125 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, 5146 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1,
5126 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, 5147 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2,
5127 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, 5148 ALLOCATE_DOUBLE_ALIGNED = 1 << 3,
5128 PREFILL_WITH_FILLER = 1 << 4 5149 PREFILL_WITH_FILLER = 1 << 4
5129 }; 5150 };
5130 5151
5131 HAllocate(HValue* context, 5152 HAllocate(HValue* context,
5132 HValue* size, 5153 HValue* size,
5133 HType type, 5154 HType type,
5134 PretenureFlag pretenure_flag, 5155 PretenureFlag pretenure_flag,
5135 InstanceType instance_type) 5156 InstanceType instance_type)
5136 : HTemplateInstruction<2>(type) { 5157 : HTemplateInstruction<2>(type),
5158 dominating_allocate_(NULL),
5159 filler_free_space_size_(NULL) {
5137 SetOperandAt(0, context); 5160 SetOperandAt(0, context);
5138 SetOperandAt(1, size); 5161 SetOperandAt(1, size);
5139 set_representation(Representation::Tagged()); 5162 set_representation(Representation::Tagged());
5140 SetFlag(kTrackSideEffectDominators); 5163 SetFlag(kTrackSideEffectDominators);
5141 SetGVNFlag(kChangesNewSpacePromotion); 5164 SetGVNFlag(kChangesNewSpacePromotion);
5142 SetGVNFlag(kDependsOnNewSpacePromotion); 5165 SetGVNFlag(kDependsOnNewSpacePromotion);
5143 flags_ = pretenure_flag == TENURED 5166 flags_ = pretenure_flag == TENURED
5144 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE 5167 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE
5145 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) 5168 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE)
5146 : ALLOCATE_IN_NEW_SPACE; 5169 : ALLOCATE_IN_NEW_SPACE;
5147 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { 5170 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) {
5148 flags_ = static_cast<HAllocate::Flags>(flags_ | 5171 flags_ = static_cast<HAllocate::Flags>(flags_ |
5149 ALLOCATE_DOUBLE_ALIGNED); 5172 ALLOCATE_DOUBLE_ALIGNED);
5150 } 5173 }
5151 } 5174 }
5152 5175
5176 void UpdateSize(HValue* size) {
5177 SetOperandAt(1, size);
5178 }
5179
5180 HAllocate* GetFoldableDominator(HAllocate* dominator);
5181
5182 void UpdateFreeSpaceFiller(int32_t filler_size);
5183
5184 void CreateFreeSpaceFiller(int32_t filler_size);
5185
5186 bool IsFoldable(HAllocate* allocate) {
5187 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) ||
5188 (IsOldDataSpaceAllocation() && allocate->IsOldDataSpaceAllocation()) ||
5189 (IsOldPointerSpaceAllocation() &&
5190 allocate->IsOldPointerSpaceAllocation());
5191 }
5192
5153 Flags flags_; 5193 Flags flags_;
5154 Handle<Map> known_initial_map_; 5194 Handle<Map> known_initial_map_;
5195 HAllocate* dominating_allocate_;
5196 HStoreNamedField* filler_free_space_size_;
5155 }; 5197 };
5156 5198
5157 5199
5158 class HInnerAllocatedObject V8_FINAL : public HTemplateInstruction<1> { 5200 class HInnerAllocatedObject V8_FINAL : public HTemplateInstruction<1> {
5159 public: 5201 public:
5160 static HInnerAllocatedObject* New(Zone* zone, 5202 static HInnerAllocatedObject* New(Zone* zone,
5161 HValue* context, 5203 HValue* context,
5162 HValue* value, 5204 HValue* value,
5163 int offset, 5205 int offset,
5164 HType type = HType::Tagged()) { 5206 HType type = HType::Tagged()) {
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
5991 6033
5992 bool NeedsWriteBarrierForMap() { 6034 bool NeedsWriteBarrierForMap() {
5993 if (IsSkipWriteBarrier()) return false; 6035 if (IsSkipWriteBarrier()) return false;
5994 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); 6036 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator());
5995 } 6037 }
5996 6038
5997 Representation field_representation() const { 6039 Representation field_representation() const {
5998 return access_.representation(); 6040 return access_.representation();
5999 } 6041 }
6000 6042
6043 void UpdateValue(HValue* value) {
6044 SetOperandAt(1, value);
6045 }
6046
6001 private: 6047 private:
6002 HStoreNamedField(HValue* obj, 6048 HStoreNamedField(HValue* obj,
6003 HObjectAccess access, 6049 HObjectAccess access,
6004 HValue* val) 6050 HValue* val)
6005 : access_(access), 6051 : access_(access),
6006 new_space_dominator_(NULL), 6052 new_space_dominator_(NULL),
6007 write_barrier_mode_(UPDATE_WRITE_BARRIER), 6053 write_barrier_mode_(UPDATE_WRITE_BARRIER),
6008 has_transition_(false) { 6054 has_transition_(false) {
6009 SetOperandAt(0, obj); 6055 SetOperandAt(0, obj);
6010 SetOperandAt(1, val); 6056 SetOperandAt(1, val);
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
6799 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6845 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6800 }; 6846 };
6801 6847
6802 6848
6803 #undef DECLARE_INSTRUCTION 6849 #undef DECLARE_INSTRUCTION
6804 #undef DECLARE_CONCRETE_INSTRUCTION 6850 #undef DECLARE_CONCRETE_INSTRUCTION
6805 6851
6806 } } // namespace v8::internal 6852 } } // namespace v8::internal
6807 6853
6808 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6854 #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