Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index b0045b8751b06258f0a241416e54615924ea910f..eb2c9db9c3b748b3a2a628cf6cbb679f74a162cb 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -3207,8 +3207,9 @@ void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
} |
// First update the size of the dominator allocate instruction. |
- int32_t dominator_size_constant = |
+ int32_t original_object_size = |
HConstant::cast(dominator_size)->GetInteger32Constant(); |
+ int32_t dominator_size_constant = original_object_size; |
int32_t current_size_constant = |
HConstant::cast(current_size)->GetInteger32Constant(); |
int32_t new_dominator_size = dominator_size_constant + current_size_constant; |
@@ -3241,8 +3242,17 @@ void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
#ifdef VERIFY_HEAP |
if (FLAG_verify_heap) { |
dominator_allocate_instr->MakePrefillWithFiller(); |
+ } else { |
+ // TODO(hpayer): This is a short-term hack to make allocation mementos |
+ // work again in new space. |
+ ClearNextMapWord(original_object_size); |
} |
+#else |
+ // TODO(hpayer): This is a short-term hack to make allocation mementos |
+ // work again in new space. |
+ ClearNextMapWord(original_object_size); |
#endif |
+ dominator_allocate_instr->clear_next_map_word_ = clear_next_map_word_; |
// After that replace the dominated allocate instruction. |
HInstruction* dominated_allocate_instr = |
@@ -3260,6 +3270,19 @@ void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
} |
+void HAllocate::ClearNextMapWord(int offset) { |
+ if (clear_next_map_word_) { |
+ Zone* zone = block()->zone(); |
+ HObjectAccess access = HObjectAccess::ForJSObjectOffset(offset); |
+ HStoreNamedField* clear_next_map = |
+ HStoreNamedField::New(zone, context(), this, access, |
+ block()->graph()->GetConstantNull()); |
+ clear_next_map->ClearAllSideEffects(); |
+ clear_next_map->InsertAfter(this); |
+ } |
+} |
+ |
+ |
void HAllocate::PrintDataTo(StringStream* stream) { |
size()->PrintNameTo(stream); |
stream->Add(" ("); |