Commit 33b5ca20 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[builtins] Tnodify builtins-microtask-queue-gen.cc

Bug: v8:6949
Change-Id: I47f6832a01b7090229c80163012f3874d15d831f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1809358
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63869}
parent 0721118d
......@@ -57,23 +57,20 @@ TNode<RawPtrT> MicrotaskQueueBuiltinsAssembler::GetMicrotaskQueue(
TNode<RawPtrT> MicrotaskQueueBuiltinsAssembler::GetMicrotaskRingBuffer(
TNode<RawPtrT> microtask_queue) {
return UncheckedCast<RawPtrT>(
Load(MachineType::Pointer(), microtask_queue,
IntPtrConstant(MicrotaskQueue::kRingBufferOffset)));
return Load<RawPtrT>(microtask_queue,
IntPtrConstant(MicrotaskQueue::kRingBufferOffset));
}
TNode<IntPtrT> MicrotaskQueueBuiltinsAssembler::GetMicrotaskQueueCapacity(
TNode<RawPtrT> microtask_queue) {
return UncheckedCast<IntPtrT>(
Load(MachineType::IntPtr(), microtask_queue,
IntPtrConstant(MicrotaskQueue::kCapacityOffset)));
return Load<IntPtrT>(microtask_queue,
IntPtrConstant(MicrotaskQueue::kCapacityOffset));
}
TNode<IntPtrT> MicrotaskQueueBuiltinsAssembler::GetMicrotaskQueueSize(
TNode<RawPtrT> microtask_queue) {
return UncheckedCast<IntPtrT>(
Load(MachineType::IntPtr(), microtask_queue,
IntPtrConstant(MicrotaskQueue::kSizeOffset)));
return Load<IntPtrT>(microtask_queue,
IntPtrConstant(MicrotaskQueue::kSizeOffset));
}
void MicrotaskQueueBuiltinsAssembler::SetMicrotaskQueueSize(
......@@ -84,9 +81,8 @@ void MicrotaskQueueBuiltinsAssembler::SetMicrotaskQueueSize(
TNode<IntPtrT> MicrotaskQueueBuiltinsAssembler::GetMicrotaskQueueStart(
TNode<RawPtrT> microtask_queue) {
return UncheckedCast<IntPtrT>(
Load(MachineType::IntPtr(), microtask_queue,
IntPtrConstant(MicrotaskQueue::kStartOffset)));
return Load<IntPtrT>(microtask_queue,
IntPtrConstant(MicrotaskQueue::kStartOffset));
}
void MicrotaskQueueBuiltinsAssembler::SetMicrotaskQueueStart(
......@@ -122,7 +118,7 @@ void MicrotaskQueueBuiltinsAssembler::RunSingleMicrotask(
TNode<Map> microtask_map = LoadMap(microtask);
TNode<Uint16T> microtask_type = LoadMapInstanceType(microtask_map);
VARIABLE(var_exception, MachineRepresentation::kTagged, TheHoleConstant());
TVARIABLE(HeapObject, var_exception, TheHoleConstant());
Label if_exception(this, Label::kDeferred);
Label is_callable(this), is_callback(this),
is_promise_fulfill_reaction_job(this),
......@@ -292,9 +288,9 @@ void MicrotaskQueueBuiltinsAssembler::RunSingleMicrotask(
void MicrotaskQueueBuiltinsAssembler::IncrementFinishedMicrotaskCount(
TNode<RawPtrT> microtask_queue) {
TNode<IntPtrT> count = UncheckedCast<IntPtrT>(
Load(MachineType::IntPtr(), microtask_queue,
IntPtrConstant(MicrotaskQueue::kFinishedMicrotaskCountOffset)));
TNode<IntPtrT> count = Load<IntPtrT>(
microtask_queue,
IntPtrConstant(MicrotaskQueue::kFinishedMicrotaskCountOffset));
TNode<IntPtrT> new_count = IntPtrAdd(count, IntPtrConstant(1));
StoreNoWriteBarrier(
MachineType::PointerRepresentation(), microtask_queue,
......@@ -303,6 +299,8 @@ void MicrotaskQueueBuiltinsAssembler::IncrementFinishedMicrotaskCount(
TNode<Context> MicrotaskQueueBuiltinsAssembler::GetCurrentContext() {
auto ref = ExternalReference::Create(kContextAddress, isolate());
// TODO(delphick): Add a checked cast. For now this is not possible as context
// can actually be Smi(0).
return TNode<Context>::UncheckedCast(LoadFullTagged(ExternalConstant(ref)));
}
......@@ -314,15 +312,13 @@ void MicrotaskQueueBuiltinsAssembler::SetCurrentContext(
TNode<IntPtrT> MicrotaskQueueBuiltinsAssembler::GetEnteredContextCount() {
auto ref = ExternalReference::handle_scope_implementer_address(isolate());
Node* hsi = Load(MachineType::Pointer(), ExternalConstant(ref));
TNode<RawPtrT> hsi = Load<RawPtrT>(ExternalConstant(ref));
using ContextStack = DetachableVector<Context>;
TNode<IntPtrT> size_offset =
IntPtrConstant(HandleScopeImplementer::kEnteredContextsOffset +
ContextStack::kSizeOffset);
TNode<IntPtrT> size =
UncheckedCast<IntPtrT>(Load(MachineType::IntPtr(), hsi, size_offset));
return size;
return Load<IntPtrT>(hsi, size_offset);
}
void MicrotaskQueueBuiltinsAssembler::EnterMicrotaskContext(
......@@ -330,7 +326,7 @@ void MicrotaskQueueBuiltinsAssembler::EnterMicrotaskContext(
CSA_ASSERT(this, IsNativeContext(native_context));
auto ref = ExternalReference::handle_scope_implementer_address(isolate());
Node* hsi = Load(MachineType::Pointer(), ExternalConstant(ref));
TNode<RawPtrT> hsi = Load<RawPtrT>(ExternalConstant(ref));
using ContextStack = DetachableVector<Context>;
TNode<IntPtrT> capacity_offset =
......@@ -340,10 +336,8 @@ void MicrotaskQueueBuiltinsAssembler::EnterMicrotaskContext(
IntPtrConstant(HandleScopeImplementer::kEnteredContextsOffset +
ContextStack::kSizeOffset);
TNode<IntPtrT> capacity =
UncheckedCast<IntPtrT>(Load(MachineType::IntPtr(), hsi, capacity_offset));
TNode<IntPtrT> size =
UncheckedCast<IntPtrT>(Load(MachineType::IntPtr(), hsi, size_offset));
TNode<IntPtrT> capacity = Load<IntPtrT>(hsi, capacity_offset);
TNode<IntPtrT> size = Load<IntPtrT>(hsi, size_offset);
Label if_append(this), if_grow(this, Label::kDeferred), done(this);
Branch(WordEqual(size, capacity), &if_grow, &if_append);
......@@ -352,7 +346,7 @@ void MicrotaskQueueBuiltinsAssembler::EnterMicrotaskContext(
TNode<IntPtrT> data_offset =
IntPtrConstant(HandleScopeImplementer::kEnteredContextsOffset +
ContextStack::kDataOffset);
Node* data = Load(MachineType::Pointer(), hsi, data_offset);
TNode<RawPtrT> data = Load<RawPtrT>(hsi, data_offset);
StoreFullTaggedNoWriteBarrier(data, TimesSystemPointerSize(size),
native_context);
......@@ -364,7 +358,7 @@ void MicrotaskQueueBuiltinsAssembler::EnterMicrotaskContext(
TNode<IntPtrT> flag_data_offset =
IntPtrConstant(HandleScopeImplementer::kIsMicrotaskContextOffset +
FlagStack::kDataOffset);
Node* flag_data = Load(MachineType::Pointer(), hsi, flag_data_offset);
TNode<RawPtrT> flag_data = Load<RawPtrT>(hsi, flag_data_offset);
StoreNoWriteBarrier(MachineRepresentation::kWord8, flag_data, size,
BoolConstant(true));
StoreNoWriteBarrier(
......@@ -393,7 +387,7 @@ void MicrotaskQueueBuiltinsAssembler::EnterMicrotaskContext(
void MicrotaskQueueBuiltinsAssembler::RewindEnteredContext(
TNode<IntPtrT> saved_entered_context_count) {
auto ref = ExternalReference::handle_scope_implementer_address(isolate());
Node* hsi = Load(MachineType::Pointer(), ExternalConstant(ref));
TNode<RawPtrT> hsi = Load<RawPtrT>(ExternalConstant(ref));
using ContextStack = DetachableVector<Context>;
TNode<IntPtrT> size_offset =
......@@ -401,8 +395,7 @@ void MicrotaskQueueBuiltinsAssembler::RewindEnteredContext(
ContextStack::kSizeOffset);
#ifdef ENABLE_VERIFY_CSA
TNode<IntPtrT> size =
UncheckedCast<IntPtrT>(Load(MachineType::IntPtr(), hsi, size_offset));
TNode<IntPtrT> size = Load<IntPtrT>(hsi, size_offset);
CSA_ASSERT(this, IntPtrLessThan(IntPtrConstant(0), size));
CSA_ASSERT(this, IntPtrLessThanOrEqual(saved_entered_context_count, size));
#endif
......@@ -443,8 +436,7 @@ void MicrotaskQueueBuiltinsAssembler::RunPromiseHook(
}
TF_BUILTIN(EnqueueMicrotask, MicrotaskQueueBuiltinsAssembler) {
TNode<Microtask> microtask =
UncheckedCast<Microtask>(Parameter(Descriptor::kMicrotask));
TNode<Microtask> microtask = CAST(Parameter(Descriptor::kMicrotask));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<NativeContext> native_context = LoadNativeContext(context);
TNode<RawPtrT> microtask_queue = GetMicrotaskQueue(native_context);
......@@ -514,8 +506,7 @@ TF_BUILTIN(RunMicrotasks, MicrotaskQueueBuiltinsAssembler) {
TNode<IntPtrT> offset =
CalculateRingBufferOffset(capacity, start, IntPtrConstant(0));
TNode<RawPtrT> microtask_pointer =
UncheckedCast<RawPtrT>(Load(MachineType::Pointer(), ring_buffer, offset));
TNode<RawPtrT> microtask_pointer = Load<RawPtrT>(ring_buffer, offset);
TNode<Microtask> microtask = CAST(BitcastWordToTagged(microtask_pointer));
TNode<IntPtrT> new_size = IntPtrSub(size, IntPtrConstant(1));
......
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