v8/src/builtins/proxy.tq
Z Duong Nguyen-Huu 2dd0db19ba Reland of Port Proxy SetProperty trap builtin to Torque
Reverted CL is in https://chromium-review.googlesource.com/c/v8/v8/+/1585269
This includes fix for ThrowTypeErrorIfStrict and add regression test.

Spec: https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver
Bug: v8:6664, v8:9234
Change-Id: I785df3f12f619e2e0fe7b011b72043758e4083e3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1604071
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#61497}
2019-05-14 18:06:46 +00:00

43 lines
1.6 KiB
Plaintext

// 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.
#include 'src/builtins/builtins-proxy-gen.h'
namespace proxy {
extern macro ProxiesCodeStubAssembler::AllocateProxy(
JSReceiver, JSReceiver, Context): JSProxy;
macro AllocateProxy(implicit context: Context)(
target: JSReceiver, handler: JSReceiver): JSProxy {
return AllocateProxy(target, handler, context);
}
macro IsRevokedProxy(implicit context: Context)(o: JSReceiver): bool {
const proxy: JSProxy = Cast<JSProxy>(o) otherwise return false;
const handler: JSReceiver =
Cast<JSReceiver>(proxy.handler) otherwise return true;
return false;
}
extern transitioning macro ProxiesCodeStubAssembler::CheckGetSetTrapResult(
implicit context:
Context)(Object, JSProxy, Name, Object, constexpr int31): Object;
const kProxyNonObject: constexpr MessageTemplate
generates 'MessageTemplate::kProxyNonObject';
const kProxyHandlerOrTargetRevoked: constexpr MessageTemplate
generates 'MessageTemplate::kProxyHandlerOrTargetRevoked';
const kProxyRevoked: constexpr MessageTemplate
generates 'MessageTemplate::kProxyRevoked';
const kProxyTrapReturnedFalsishFor: constexpr MessageTemplate
generates 'MessageTemplate::kProxyTrapReturnedFalsishFor';
const kProxyPrivate: constexpr MessageTemplate
generates 'MessageTemplate::kProxyPrivate';
const kProxyGet: constexpr int31
generates 'JSProxy::AccessKind::kGet';
const kProxySet: constexpr int31
generates 'JSProxy::AccessKind::kSet';
}