[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: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61218}
This commit is contained in:
Z Duong Nguyen-Huu 2019-05-03 10:16:18 -07:00 committed by Commit Bot
parent fa4b433f32
commit 36cf643195
3 changed files with 5 additions and 5 deletions

View File

@ -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];

View File

@ -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;

View File

@ -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;