Chromium Code Reviews| Index: src/hydrogen-instructions.h |
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
| index f16efe6de83276be38aaf9b299f32586385761f0..4a22d7c1492bc4746986bd8ddef3234f74131c20 100644 |
| --- a/src/hydrogen-instructions.h |
| +++ b/src/hydrogen-instructions.h |
| @@ -4840,8 +4840,14 @@ class HLoadGlobalGeneric: public HTemplateInstruction<2> { |
| class HAllocateObject: public HTemplateInstruction<1> { |
| public: |
| - HAllocateObject(HValue* context, Handle<JSFunction> constructor) |
| - : constructor_(constructor) { |
| + enum Flags { |
| + CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0, |
| + CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 1 |
| + }; |
| + |
| + HAllocateObject(HValue* context, Handle<JSFunction> constructor, Flags flags) |
| + : constructor_(constructor), |
| + flags_(flags) { |
| SetOperandAt(0, context); |
| set_representation(Representation::Tagged()); |
| SetGVNFlag(kChangesNewSpacePromotion); |
| @@ -4869,6 +4875,22 @@ class HAllocateObject: public HTemplateInstruction<1> { |
| } |
| virtual HType CalculateInferredType(); |
| + static Flags DefaultFlags() { |
|
mvstanton
2013/05/23 12:47:46
It would be nice if these ~20 lines could be share
|
| + return CAN_ALLOCATE_IN_NEW_SPACE; |
| + } |
| + |
| + bool CanAllocateInNewSpace() const { |
| + return (flags_ & CAN_ALLOCATE_IN_NEW_SPACE) != 0; |
| + } |
| + |
| + bool CanAllocateInOldPointerSpace() const { |
| + return (flags_ & CAN_ALLOCATE_IN_OLD_POINTER_SPACE) != 0; |
| + } |
| + |
| + bool GuaranteedInNewSpace() const { |
| + return CanAllocateInNewSpace() && !CanAllocateInOldPointerSpace(); |
| + } |
| + |
| DECLARE_CONCRETE_INSTRUCTION(AllocateObject) |
| private: |
| @@ -4877,6 +4899,7 @@ class HAllocateObject: public HTemplateInstruction<1> { |
| Handle<JSFunction> constructor_; |
| Handle<Map> constructor_initial_map_; |
| + Flags flags_; |
| }; |
| @@ -4999,7 +5022,9 @@ inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, |
| new_space_dominator); |
| } |
| if (object != new_space_dominator) return true; |
| - if (object->IsAllocateObject()) return false; |
| + if (object->IsAllocateObject()) { |
| + return !HAllocateObject::cast(object)->GuaranteedInNewSpace(); |
| + } |
| if (object->IsAllocate()) { |
| return !HAllocate::cast(object)->GuaranteedInNewSpace(); |
| } |