Commit 33ff811d authored by tzik's avatar tzik Committed by Commit Bot

Use NativeContext's embedder field for MicrotaskQueue

A pointer to MicrotaskQueue is stored in a NativeContext field as a Smi,
that is discouraged. This CL replaces it to use the dedicated field.

Bug: v8:8124
Change-Id: I5a770624b3a9c922051e86243da2ae216aaacf3a
Reviewed-on: https://chromium-review.googlesource.com/c/1351855
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57870}
parent 64d373e5
......@@ -5884,8 +5884,7 @@ Genesis::Genesis(
}
}
native_context()->set_microtask_queue_pointer(
reinterpret_cast<Object*>(isolate->default_microtask_queue()));
native_context()->set_microtask_queue(isolate->default_microtask_queue());
// Install experimental natives. Do not include them into the
// snapshot as we should be able to turn them off at runtime. Re-installing
......
......@@ -54,11 +54,10 @@ TNode<IntPtrT> MicrotaskQueueBuiltinsAssembler::GetDefaultMicrotaskQueue() {
}
TNode<IntPtrT> MicrotaskQueueBuiltinsAssembler::GetMicrotaskQueue(
TNode<Context> context) {
// TODO(ishell): move microtask queue pointer to embedder data array.
int offset = Context::SlotOffset(Context::MICROTASK_QUEUE_POINTER);
return UncheckedCast<IntPtrT>(
Load(MachineType::Pointer(), context, IntPtrConstant(offset)));
TNode<Context> native_context) {
CSA_ASSERT(this, IsNativeContext(native_context));
return LoadObjectField<IntPtrT>(native_context,
NativeContext::kMicrotaskQueueOffset);
}
TNode<IntPtrT> MicrotaskQueueBuiltinsAssembler::GetMicrotaskRingBuffer(
......
......@@ -273,9 +273,6 @@ enum ContextLookupFlags {
V(PROMISE_ALL_RESOLVE_ELEMENT_SHARED_FUN, SharedFunctionInfo, \
promise_all_resolve_element_shared_fun) \
V(PROMISE_PROTOTYPE_INDEX, JSObject, promise_prototype) \
/* TODO(ishell): [ptr-compr] this field contains a pointer to a C++ */ \
/* object */ \
V(MICROTASK_QUEUE_POINTER, Object, microtask_queue_pointer) \
V(REGEXP_EXEC_FUNCTION_INDEX, JSFunction, regexp_exec_function) \
V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \
V(REGEXP_LAST_MATCH_INFO_INDEX, RegExpMatchInfo, regexp_last_match_info) \
......
......@@ -44,10 +44,8 @@ void PartialSerializer::Serialize(Context* o, bool include_global_proxy) {
// Reset math random cache to get fresh random numbers.
MathRandom::ResetContext(context_);
DCHECK_EQ(
0, reinterpret_cast<MicrotaskQueue*>(context_->microtask_queue_pointer())
->size());
context_->set_microtask_queue_pointer(nullptr);
DCHECK_EQ(0, context_->native_context()->microtask_queue()->size());
context_->native_context()->set_microtask_queue(nullptr);
VisitRootPointer(Root::kPartialSnapshotCache, nullptr, ObjectSlot(o));
SerializeDeferredObjects();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment