aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/proxy-has-property.tq
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-08-01 08:38:30 +0200
committerMichaël Zasso <targos@protonmail.com>2019-08-01 12:53:56 +0200
commit2dcc3665abf57c3607cebffdeeca062f5894885d (patch)
tree4f560748132edcfb4c22d6f967a7e80d23d7ea2c /deps/v8/src/builtins/proxy-has-property.tq
parent1ee47d550c6de132f06110aa13eceb7551d643b3 (diff)
downloadandroid-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.tar.gz
android-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.tar.bz2
android-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.zip
deps: update V8 to 7.6.303.28
PR-URL: https://github.com/nodejs/node/pull/28016 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'deps/v8/src/builtins/proxy-has-property.tq')
-rw-r--r--deps/v8/src/builtins/proxy-has-property.tq55
1 files changed, 55 insertions, 0 deletions
diff --git a/deps/v8/src/builtins/proxy-has-property.tq b/deps/v8/src/builtins/proxy-has-property.tq
new file mode 100644
index 0000000000..ab3898a9c7
--- /dev/null
+++ b/deps/v8/src/builtins/proxy-has-property.tq
@@ -0,0 +1,55 @@
+// 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 {
+
+ // ES #sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p
+ // https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p
+ transitioning builtin ProxyHasProperty(implicit context: Context)(
+ proxy: JSProxy, name: Name): Object {
+ assert(IsJSProxy(proxy));
+
+ PerformStackCheck();
+
+ // 1. Assert: IsPropertyKey(P) is true.
+ assert(IsName(name));
+ assert(!IsPrivateSymbol(name));
+
+ try {
+ // 2. Let handler be O.[[ProxyHandler]].
+ // 3. If handler is null, throw a TypeError exception.
+ // 4. Assert: Type(handler) is Object.
+ const handler =
+ Cast<JSReceiver>(proxy.handler) otherwise ThrowProxyHandlerRevoked;
+
+ // 5. Let target be O.[[ProxyTarget]].
+ const target = proxy.target;
+
+ // 6. Let trap be ? GetMethod(handler, "has").
+ // 7. If trap is undefined, then (see 7.a below).
+ const trap: Callable = GetMethod(handler, 'has')
+ otherwise goto TrapUndefined(target);
+
+ // 8. Let booleanTrapResult be ToBoolean(? Call(trap, handler, «
+ // target»)).
+ // 9. If booleanTrapResult is false, then (see 9.a. in
+ // CheckHasTrapResult).
+ // 10. Return booleanTrapResult.
+ const trapResult = Call(context, trap, handler, target, name);
+ if (BranchIfToBooleanIsTrue(trapResult)) {
+ return True;
+ }
+ return CheckHasTrapResult(target, proxy, name);
+ }
+ label TrapUndefined(target: Object) {
+ // 7.a. Return ? target.[[HasProperty]](P).
+ tail HasProperty(target, name);
+ }
+ label ThrowProxyHandlerRevoked deferred {
+ ThrowTypeError(kProxyRevoked, 'has');
+ }
+ }
+}