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