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

Reland: Extend IsExtensible proxy trap fast path for Reflect.isExtensible

This is reland of Ib1c3f78d1f1a44c6628d351fed3bcdc91ca08cb5
Just fix lint error for unused arguments in Torque.

> Original commit message:

> The fast path for IsExtensible proxy trap is already implemented, we just need to use this for ReflectIsExtensible.
Now, ReflectIsExtensible is now a Torque builtin (previously CPP). Other cases will fall back to runtime.

> Bug: v8:6664
> Change-Id: Ib1c3f78d1f1a44c6628d351fed3bcdc91ca08cb5
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1645438
> Reviewed-by: Maya Lekova <mslekova@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Tamer Tas <tmrts@chromium.org>
> Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
> Cr-Commit-Position: refs/heads/master@{#62031}

Bug: v8:6664
Change-Id: If44ac321ce712a969b3f5076411573eb3968cc14
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1646900
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62070}
parent 29a40cac
......@@ -962,6 +962,7 @@ torque_files = [
"src/builtins/proxy-revoke.tq",
"src/builtins/proxy-set-property.tq",
"src/builtins/proxy.tq",
"src/builtins/reflect.tq",
"src/builtins/regexp-replace.tq",
"src/builtins/regexp.tq",
"src/builtins/string.tq",
......@@ -3295,7 +3296,7 @@ v8_source_set("v8_crash_keys") {
]
}
configs = [ ":internal_config" ]
configs = [ ":internal_config" ]
}
group("v8_base") {
......
......@@ -827,7 +827,6 @@ namespace internal {
CPP(ReflectGetOwnPropertyDescriptor) \
CPP(ReflectGetPrototypeOf) \
TFJ(ReflectHas, 2, kReceiver, kTarget, kKey) \
CPP(ReflectIsExtensible) \
CPP(ReflectOwnKeys) \
CPP(ReflectPreventExtensions) \
CPP(ReflectSet) \
......
......@@ -136,25 +136,6 @@ BUILTIN(ReflectGetPrototypeOf) {
JSReceiver::GetPrototype(isolate, receiver));
}
// ES6 section 26.1.10 Reflect.isExtensible
BUILTIN(ReflectIsExtensible) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
Handle<Object> target = args.at(1);
if (!target->IsJSReceiver()) {
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kCalledOnNonObject,
isolate->factory()->NewStringFromAsciiChecked(
"Reflect.isExtensible")));
}
Maybe<bool> result =
JSReceiver::IsExtensible(Handle<JSReceiver>::cast(target));
MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
return *isolate->factory()->ToBoolean(result.FromJust());
}
// ES6 section 26.1.11 Reflect.ownKeys
BUILTIN(ReflectOwnKeys) {
HandleScope scope(isolate);
......
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace reflect {
const kCalledOnNonObject: constexpr MessageTemplate
generates 'MessageTemplate::kCalledOnNonObject';
// ES6 section 26.1.10 Reflect.isExtensible
transitioning javascript builtin ReflectIsExtensible(
implicit context: Context)(_receiver: Object, object: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.isExtensible');
return object::ObjectIsExtensible(objectJSReceiver);
}
} // 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