Index: src/code-stub-assembler.cc |
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc |
index 6e3cd99dd5b2083f68d5dc37ab10aed543e705ed..23e78b6e7478b48d03e86da950eb2a127f66dcaa 100644 |
--- a/src/code-stub-assembler.cc |
+++ b/src/code-stub-assembler.cc |
@@ -891,6 +891,15 @@ Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { |
IntPtrConstant(HeapNumber::kMapOffset - kHeapObjectTag), map); |
} |
+Node* CodeStubAssembler::StoreObjectFieldRoot(Node* object, int offset, |
+ Heap::RootListIndex root_index) { |
+ if (Heap::RootIsImmortalImmovable(root_index)) { |
+ return StoreObjectFieldNoWriteBarrier(object, offset, LoadRoot(root_index)); |
+ } else { |
+ return StoreObjectField(object, offset, LoadRoot(root_index)); |
+ } |
+} |
+ |
Node* CodeStubAssembler::StoreFixedArrayElement(Node* object, Node* index_node, |
Node* value, |
WriteBarrierMode barrier_mode, |
@@ -3254,5 +3263,23 @@ void CodeStubAssembler::CheckEnumCache(Node* receiver, Label* use_cache, |
} |
} |
+Node* CodeStubAssembler::CreateWeakCellInFeedbackVector(Node* feedback_vector, |
+ Node* slot, |
+ Node* value) { |
+ Node* size = IntPtrConstant(WeakCell::kSize); |
+ Node* cell = Allocate(size, compiler::CodeAssembler::kPretenured); |
+ |
+ // Initialize the WeakCell. |
+ StoreObjectFieldRoot(cell, WeakCell::kMapOffset, Heap::kWeakCellMapRootIndex); |
+ StoreObjectField(cell, WeakCell::kValueOffset, value); |
+ StoreObjectFieldRoot(cell, WeakCell::kNextOffset, |
+ Heap::kTheHoleValueRootIndex); |
+ |
+ // Store the WeakCell in the feedback vector. |
+ StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
+ CodeStubAssembler::SMI_PARAMETERS); |
+ return cell; |
+} |
+ |
} // namespace internal |
} // namespace v8 |