Commit e88a8ae2 authored by Z Nguyen-Huu's avatar Z Nguyen-Huu Committed by Commit Bot

call ProxyDeleteProperty inside DeleteProperty

Instead of having fast path for proxy only in Reflect.deleteProperty, it
is also in delete operator.

Bug: v8:6664
Change-Id: I3db919953e31f51a5dc4a504062bd691a6e17446
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1717660
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63014}
parent 43c8538d
......@@ -534,11 +534,12 @@ TF_BUILTIN(DeleteProperty, DeletePropertyBaseAssembler) {
VARIABLE(var_index, MachineType::PointerRepresentation());
VARIABLE(var_unique, MachineRepresentation::kTagged, key);
Label if_index(this), if_unique_name(this), if_notunique(this),
if_notfound(this), slow(this);
if_notfound(this), slow(this), if_proxy(this);
GotoIf(TaggedIsSmi(receiver), &slow);
TNode<Map> receiver_map = LoadMap(CAST(receiver));
TNode<Int32T> instance_type = LoadMapInstanceType(receiver_map);
GotoIf(InstanceTypeEqual(instance_type, JS_PROXY_TYPE), &if_proxy);
GotoIf(IsCustomElementsReceiverInstanceType(instance_type), &slow);
TryToName(key, &if_index, &var_index, &if_unique_name, &var_unique, &slow,
&if_notunique);
......@@ -592,6 +593,14 @@ TF_BUILTIN(DeleteProperty, DeletePropertyBaseAssembler) {
BIND(&if_notfound);
Return(TrueConstant());
BIND(&if_proxy);
{
TNode<Name> name = CAST(CallBuiltin(Builtins::kToName, context, key));
GotoIf(IsPrivateSymbol(name), &slow);
TailCallBuiltin(Builtins::kProxyDeleteProperty, context, receiver, name,
language_mode);
}
BIND(&slow);
{
TailCallRuntime(Runtime::kDeleteProperty, context, receiver, key,
......
......@@ -12,6 +12,8 @@ namespace proxy {
ProxyDeleteProperty(implicit context: Context)(
proxy: JSProxy, name: Name, languageMode: LanguageMode): Object {
const kTrapName: constexpr string = 'deleteProperty';
// Handle deeply nested proxy.
PerformStackCheck();
// 1. Assert: IsPropertyKey(P) is true.
assert(TaggedIsNotSmi(name));
assert(IsName(name));
......
......@@ -71,12 +71,6 @@ namespace reflect {
Context)(_receiver: Object, object: Object, key: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.deleteProperty');
const name: Name = ToName(key);
if (IsPrivateSymbol(name)) {
return DeleteProperty(objectJSReceiver, name, kSloppy);
}
const proxy = Cast<JSProxy>(objectJSReceiver)
otherwise return DeleteProperty(objectJSReceiver, name, kSloppy);
return proxy::ProxyDeleteProperty(proxy, name, kSloppy);
return DeleteProperty(objectJSReceiver, key, kSloppy);
}
} // namespace reflect
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