Commit adb97b35 authored by Gus Caplan's avatar Gus Caplan Committed by Commit Bot

[Torque] port Reflect.has to Torque

Change-Id: I828450704fdb74bc5ced0f8f85a0546672b4ff9e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1864571Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64342}
parent ae5f193f
...@@ -1584,7 +1584,6 @@ v8_source_set("v8_initializers") { ...@@ -1584,7 +1584,6 @@ v8_source_set("v8_initializers") {
"src/builtins/builtins-promise-gen.h", "src/builtins/builtins-promise-gen.h",
"src/builtins/builtins-proxy-gen.cc", "src/builtins/builtins-proxy-gen.cc",
"src/builtins/builtins-proxy-gen.h", "src/builtins/builtins-proxy-gen.h",
"src/builtins/builtins-reflect-gen.cc",
"src/builtins/builtins-regexp-gen.cc", "src/builtins/builtins-regexp-gen.cc",
"src/builtins/builtins-regexp-gen.h", "src/builtins/builtins-regexp-gen.h",
"src/builtins/builtins-sharedarraybuffer-gen.cc", "src/builtins/builtins-sharedarraybuffer-gen.cc",
......
...@@ -823,7 +823,6 @@ namespace internal { ...@@ -823,7 +823,6 @@ namespace internal {
ASM(ReflectConstruct, Dummy) \ ASM(ReflectConstruct, Dummy) \
CPP(ReflectDefineProperty) \ CPP(ReflectDefineProperty) \
CPP(ReflectGetOwnPropertyDescriptor) \ CPP(ReflectGetOwnPropertyDescriptor) \
TFJ(ReflectHas, 2, kReceiver, kTarget, kKey) \
CPP(ReflectOwnKeys) \ CPP(ReflectOwnKeys) \
CPP(ReflectSet) \ CPP(ReflectSet) \
\ \
......
// Copyright 2017 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.
#include "src/builtins/builtins-utils-gen.h"
#include "src/builtins/builtins.h"
#include "src/codegen/code-stub-assembler.h"
namespace v8 {
namespace internal {
// ES section #sec-reflect.has
TF_BUILTIN(ReflectHas, CodeStubAssembler) {
TNode<Object> target = CAST(Parameter(Descriptor::kTarget));
TNode<Object> key = CAST(Parameter(Descriptor::kKey));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
ThrowIfNotJSReceiver(context, target, MessageTemplate::kCalledOnNonObject,
"Reflect.has");
Return(CallBuiltin(Builtins::kHasProperty, context, target, key));
}
} // namespace internal
} // namespace v8
...@@ -76,4 +76,12 @@ namespace reflect { ...@@ -76,4 +76,12 @@ namespace reflect {
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.deleteProperty'); otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.deleteProperty');
return DeleteProperty(objectJSReceiver, key, kSloppy); return DeleteProperty(objectJSReceiver, key, kSloppy);
} }
// ES section #sec-reflect.has
transitioning javascript builtin
ReflectHas(js-implicit context: Context)(object: JSAny, key: JSAny): JSAny {
const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.has');
return HasProperty(objectJSReceiver, key);
}
} // namespace reflect } // 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