Commit 9d2629c8 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[CSA][cleanup] TNodify builtins-proxy-gen

Bug: v8:9810
Change-Id: Ic7909dcec624fdd95548a32f2fa760d5e9c67636
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1906567Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64879}
parent b990d2a4
......@@ -17,7 +17,7 @@ namespace internal {
TNode<JSProxy> ProxiesCodeStubAssembler::AllocateProxy(
TNode<Context> context, TNode<JSReceiver> target,
TNode<JSReceiver> handler) {
VARIABLE(map, MachineRepresentation::kTagged);
TVARIABLE(Map, map);
Label callable_target(this), constructor_target(this), none_target(this),
create_proxy(this);
......@@ -31,19 +31,19 @@ TNode<JSProxy> ProxiesCodeStubAssembler::AllocateProxy(
// Every object that is a constructor is implicitly callable
// so it's okay to nest this check here
GotoIf(IsConstructor(target), &constructor_target);
map.Bind(
map = CAST(
LoadContextElement(nativeContext, Context::PROXY_CALLABLE_MAP_INDEX));
Goto(&create_proxy);
}
BIND(&constructor_target);
{
map.Bind(LoadContextElement(nativeContext,
Context::PROXY_CONSTRUCTOR_MAP_INDEX));
map = CAST(LoadContextElement(nativeContext,
Context::PROXY_CONSTRUCTOR_MAP_INDEX));
Goto(&create_proxy);
}
BIND(&none_target);
{
map.Bind(LoadContextElement(nativeContext, Context::PROXY_MAP_INDEX));
map = CAST(LoadContextElement(nativeContext, Context::PROXY_MAP_INDEX));
Goto(&create_proxy);
}
......@@ -58,14 +58,14 @@ TNode<JSProxy> ProxiesCodeStubAssembler::AllocateProxy(
return CAST(proxy);
}
Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments(
Node* context, const CodeStubArguments& args, Node* argc,
TNode<JSArray> ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments(
TNode<Context> context, const CodeStubArguments& args, TNode<IntPtrT> argc,
ParameterMode mode) {
Comment("AllocateJSArrayForCodeStubArguments");
Label if_empty_array(this), allocate_js_array(this);
// Do not use AllocateJSArray since {elements} might end up in LOS.
VARIABLE(elements, MachineRepresentation::kTagged);
TVARIABLE(FixedArrayBase, elements);
TNode<Smi> length = ParameterToTagged(argc, mode);
GotoIf(SmiEqual(length, SmiConstant(0)), &if_empty_array);
......@@ -73,7 +73,7 @@ Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments(
Label if_large_object(this, Label::kDeferred);
TNode<FixedArrayBase> allocated_elements = AllocateFixedArray(
PACKED_ELEMENTS, argc, mode, kAllowLargeObjectAllocation);
elements.Bind(allocated_elements);
elements = allocated_elements;
TVARIABLE(IntPtrT, offset,
IntPtrConstant(FixedArrayBase::kHeaderSize - kHeapObjectTag));
......@@ -100,7 +100,7 @@ Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments(
BIND(&if_empty_array);
{
elements.Bind(EmptyFixedArrayConstant());
elements = EmptyFixedArrayConstant();
Goto(&allocate_js_array);
}
......@@ -109,16 +109,15 @@ Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments(
TNode<NativeContext> native_context = LoadNativeContext(context);
TNode<Map> array_map =
LoadJSArrayElementsMap(PACKED_ELEMENTS, native_context);
TNode<JSArray> array =
AllocateJSArray(array_map, CAST(elements.value()), length);
TNode<JSArray> array = AllocateJSArray(array_map, elements.value(), length);
return array;
}
Node* ProxiesCodeStubAssembler::CreateProxyRevokeFunctionContext(
Node* proxy, Node* native_context) {
const TNode<Context> context = AllocateSyntheticFunctionContext(
CAST(native_context), kProxyContextLength);
TNode<Context> ProxiesCodeStubAssembler::CreateProxyRevokeFunctionContext(
TNode<JSProxy> proxy, TNode<NativeContext> native_context) {
const TNode<Context> context =
AllocateSyntheticFunctionContext(native_context, kProxyContextLength);
StoreContextElementNoWriteBarrier(context, kProxySlot, proxy);
return context;
}
......@@ -128,7 +127,7 @@ TNode<JSFunction> ProxiesCodeStubAssembler::AllocateProxyRevokeFunction(
const TNode<NativeContext> native_context = LoadNativeContext(context);
const TNode<Context> proxy_context =
CAST(CreateProxyRevokeFunctionContext(proxy, native_context));
CreateProxyRevokeFunctionContext(proxy, native_context);
const TNode<Map> revoke_map = CAST(LoadContextElement(
native_context, Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX));
const TNode<SharedFunctionInfo> revoke_info = CAST(
......@@ -139,14 +138,15 @@ TNode<JSFunction> ProxiesCodeStubAssembler::AllocateProxyRevokeFunction(
}
TF_BUILTIN(CallProxy, ProxiesCodeStubAssembler) {
Node* argc = Parameter(Descriptor::kActualArgumentsCount);
TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kActualArgumentsCount));
TNode<IntPtrT> argc_ptr = ChangeInt32ToIntPtr(argc);
TNode<JSProxy> proxy = CAST(Parameter(Descriptor::kFunction));
Node* context = Parameter(Descriptor::kContext);
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
CSA_ASSERT(this, IsCallable(proxy));
PerformStackCheck(CAST(context));
PerformStackCheck(context);
Label throw_proxy_handler_revoked(this, Label::kDeferred),
trap_undefined(this);
......@@ -168,18 +168,18 @@ TF_BUILTIN(CallProxy, ProxiesCodeStubAssembler) {
// 5. Let trap be ? GetMethod(handler, "apply").
// 6. If trap is undefined, then
Handle<Name> trap_name = factory()->apply_string();
Node* trap = GetMethod(context, handler, trap_name, &trap_undefined);
TNode<Object> trap = GetMethod(context, handler, trap_name, &trap_undefined);
CodeStubArguments args(this, argc_ptr);
TNode<Object> receiver = args.GetReceiver();
// 7. Let argArray be CreateArrayFromList(argumentsList).
Node* array = AllocateJSArrayForCodeStubArguments(context, args, argc_ptr,
INTPTR_PARAMETERS);
TNode<JSArray> array = AllocateJSArrayForCodeStubArguments(
context, args, argc_ptr, INTPTR_PARAMETERS);
// 8. Return Call(trap, handler, «target, thisArgument, argArray»).
Node* result = CallJS(CodeFactory::Call(isolate()), context, trap, handler,
target, receiver, array);
TNode<Object> result = CallJS(CodeFactory::Call(isolate()), context, trap,
handler, target, receiver, array);
args.PopAndReturn(result);
BIND(&trap_undefined);
......@@ -193,13 +193,13 @@ TF_BUILTIN(CallProxy, ProxiesCodeStubAssembler) {
}
TF_BUILTIN(ConstructProxy, ProxiesCodeStubAssembler) {
Node* argc = Parameter(Descriptor::kActualArgumentsCount);
TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kActualArgumentsCount));
TNode<IntPtrT> argc_ptr = ChangeInt32ToIntPtr(argc);
Node* proxy = Parameter(Descriptor::kTarget);
Node* new_target = Parameter(Descriptor::kNewTarget);
Node* context = Parameter(Descriptor::kContext);
TNode<JSProxy> proxy = CAST(Parameter(Descriptor::kTarget));
TNode<Object> new_target = CAST(Parameter(Descriptor::kNewTarget));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
CSA_ASSERT(this, IsJSProxy(proxy));
CSA_ASSERT(this, IsCallable(proxy));
Label throw_proxy_handler_revoked(this, Label::kDeferred),
......@@ -222,21 +222,21 @@ TF_BUILTIN(ConstructProxy, ProxiesCodeStubAssembler) {
// 5. Let trap be ? GetMethod(handler, "construct").
// 6. If trap is undefined, then
Handle<Name> trap_name = factory()->construct_string();
Node* trap = GetMethod(context, handler, trap_name, &trap_undefined);
TNode<Object> trap = GetMethod(context, handler, trap_name, &trap_undefined);
CodeStubArguments args(this, argc_ptr);
// 7. Let argArray be CreateArrayFromList(argumentsList).
Node* array = AllocateJSArrayForCodeStubArguments(context, args, argc_ptr,
INTPTR_PARAMETERS);
TNode<JSArray> array = AllocateJSArrayForCodeStubArguments(
context, args, argc_ptr, INTPTR_PARAMETERS);
// 8. Let newObj be ? Call(trap, handler, « target, argArray, newTarget »).
Node* new_obj = CallJS(CodeFactory::Call(isolate()), context, trap, handler,
target, array, new_target);
TNode<Object> new_obj = CallJS(CodeFactory::Call(isolate()), context, trap,
handler, target, array, new_target);
// 9. If Type(newObj) is not Object, throw a TypeError exception.
GotoIf(TaggedIsSmi(new_obj), &not_an_object);
GotoIfNot(IsJSReceiver(new_obj), &not_an_object);
GotoIfNot(IsJSReceiver(CAST(new_obj)), &not_an_object);
// 10. Return newObj.
args.PopAndReturn(new_obj);
......@@ -266,9 +266,9 @@ void ProxiesCodeStubAssembler::CheckGetSetTrapResult(
JSProxy::AccessKind access_kind) {
// TODO(mslekova): Think of a better name for the trap_result param.
TNode<Map> map = LoadMap(target);
VARIABLE(var_value, MachineRepresentation::kTagged);
VARIABLE(var_details, MachineRepresentation::kWord32);
VARIABLE(var_raw_value, MachineRepresentation::kTagged);
TVARIABLE(Object, var_value);
TVARIABLE(Uint32T, var_details);
TVARIABLE(Object, var_raw_value);
Label if_found_value(this), check_in_runtime(this, Label::kDeferred),
check_passed(this);
......@@ -309,7 +309,7 @@ void ProxiesCodeStubAssembler::CheckGetSetTrapResult(
BIND(&check_accessor);
{
Node* accessor_pair = var_raw_value.value();
TNode<HeapObject> accessor_pair = CAST(var_raw_value.value());
if (access_kind == JSProxy::kGet) {
Label continue_check(this, Label::kDeferred);
......@@ -374,9 +374,9 @@ void ProxiesCodeStubAssembler::CheckHasTrapResult(TNode<Context> context,
TNode<JSProxy> proxy,
TNode<Name> name) {
TNode<Map> target_map = LoadMap(target);
VARIABLE(var_value, MachineRepresentation::kTagged);
VARIABLE(var_details, MachineRepresentation::kWord32);
VARIABLE(var_raw_value, MachineRepresentation::kTagged);
TVARIABLE(Object, var_value);
TVARIABLE(Uint32T, var_details);
TVARIABLE(Object, var_raw_value);
Label if_found_value(this, Label::kDeferred),
throw_non_configurable(this, Label::kDeferred),
......
......@@ -39,12 +39,13 @@ class ProxiesCodeStubAssembler : public CodeStubAssembler {
kProxyContextLength,
};
Node* AllocateJSArrayForCodeStubArguments(Node* context,
const CodeStubArguments& args,
Node* argc, ParameterMode mode);
TNode<JSArray> AllocateJSArrayForCodeStubArguments(
TNode<Context> context, const CodeStubArguments& args,
TNode<IntPtrT> argc, ParameterMode mode);
private:
Node* CreateProxyRevokeFunctionContext(Node* proxy, Node* native_context);
TNode<Context> CreateProxyRevokeFunctionContext(
TNode<JSProxy> proxy, TNode<NativeContext> native_context);
};
} // namespace internal
......
......@@ -8771,9 +8771,10 @@ void CodeStubAssembler::TryHasOwnProperty(Node* object, Node* map,
}
}
Node* CodeStubAssembler::GetMethod(Node* context, Node* object,
Handle<Name> name,
Label* if_null_or_undefined) {
TNode<Object> CodeStubAssembler::GetMethod(TNode<Context> context,
TNode<Object> object,
Handle<Name> name,
Label* if_null_or_undefined) {
TNode<Object> method = GetProperty(context, object, name);
GotoIf(IsUndefined(method), if_null_or_undefined);
......@@ -8785,9 +8786,8 @@ Node* CodeStubAssembler::GetMethod(Node* context, Node* object,
TNode<Object> CodeStubAssembler::GetIteratorMethod(
TNode<Context> context, TNode<HeapObject> heap_obj,
Label* if_iteratorundefined) {
return CAST(GetMethod(context, heap_obj,
isolate()->factory()->iterator_symbol(),
if_iteratorundefined));
return GetMethod(context, heap_obj, isolate()->factory()->iterator_symbol(),
if_iteratorundefined);
}
void CodeStubAssembler::LoadPropertyFromFastObject(
......
......@@ -3035,8 +3035,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
value);
}
Node* GetMethod(Node* context, Node* object, Handle<Name> name,
Label* if_null_or_undefined);
TNode<Object> GetMethod(TNode<Context> context, TNode<Object> object,
Handle<Name> name, Label* if_null_or_undefined);
TNode<Object> GetIteratorMethod(TNode<Context> context,
TNode<HeapObject> heap_obj,
......
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