Commit 36cf6431 authored by Z Duong Nguyen-Huu's avatar Z Duong Nguyen-Huu Committed by Commit Bot

[torque] Allow define javascript buitin with context only

We should allow the following code to compile
transitioning javascript builtin ProxyRevoke(context: Context): Undefined {...}
transitioning javascript builtin ProxyRevoke(implicit context: Context)(): Undefined {...}

Bug: v8:9007
Change-Id: I8729b4adc91e6a9fb49a50edf2974d84ec4e10ec
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1591343
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61218}
parent fa4b433f
......@@ -8,9 +8,8 @@ namespace proxy {
// Proxy Revocation Functions
// https://tc39.github.io/ecma262/#sec-proxy-revocation-functions
// TODO(v8:9007) remove receiver in argument since we don't use it
transitioning javascript builtin
ProxyRevoke(context: Context, receiver: Object): Undefined {
ProxyRevoke(implicit context: Context)(): Undefined {
// 1. Let p be F.[[RevocableProxy]].
const proxyObject: Object = context[PROXY_SLOT];
......
......@@ -65,7 +65,7 @@ Builtin* DeclarationVisitor::CreateBuiltin(BuiltinDeclaration* decl,
}
if (javascript) {
if (signature.types().size() < 2 ||
if (signature.types().size() >= 2 &&
!(signature.types()[1] ==
Declarations::LookupGlobalType(OBJECT_TYPE_STRING))) {
std::stringstream stream;
......
......@@ -2719,8 +2719,9 @@ void ImplementationVisitor::GenerateBuiltinDefinitions(std::string& file_name) {
assert(builtin->IsFixedArgsJavaScript());
// FixedArg javascript builtins need to offer the parameter
// count.
assert(builtin->parameter_names().size() >= 2);
new_contents_stream << ", " << (builtin->parameter_names().size() - 2);
int size = static_cast<int>(builtin->parameter_names().size());
assert(size >= 1);
new_contents_stream << ", " << (std::max(size - 2, 0));
// And the receiver is explicitly declared.
new_contents_stream << ", kReceiver";
firstParameterIndex = 2;
......
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