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

Unified Diff: src/code-stub-assembler.cc

Issue 2188993003: [stubs] Port CreateWeakCellStub to turbofan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix stack overflow Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698