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 { ...@@ -8,9 +8,8 @@ namespace proxy {
// Proxy Revocation Functions // Proxy Revocation Functions
// https://tc39.github.io/ecma262/#sec-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 transitioning javascript builtin
ProxyRevoke(context: Context, receiver: Object): Undefined { ProxyRevoke(implicit context: Context)(): Undefined {
// 1. Let p be F.[[RevocableProxy]]. // 1. Let p be F.[[RevocableProxy]].
const proxyObject: Object = context[PROXY_SLOT]; const proxyObject: Object = context[PROXY_SLOT];
......
...@@ -65,7 +65,7 @@ Builtin* DeclarationVisitor::CreateBuiltin(BuiltinDeclaration* decl, ...@@ -65,7 +65,7 @@ Builtin* DeclarationVisitor::CreateBuiltin(BuiltinDeclaration* decl,
} }
if (javascript) { if (javascript) {
if (signature.types().size() < 2 || if (signature.types().size() >= 2 &&
!(signature.types()[1] == !(signature.types()[1] ==
Declarations::LookupGlobalType(OBJECT_TYPE_STRING))) { Declarations::LookupGlobalType(OBJECT_TYPE_STRING))) {
std::stringstream stream; std::stringstream stream;
......
...@@ -2719,8 +2719,9 @@ void ImplementationVisitor::GenerateBuiltinDefinitions(std::string& file_name) { ...@@ -2719,8 +2719,9 @@ void ImplementationVisitor::GenerateBuiltinDefinitions(std::string& file_name) {
assert(builtin->IsFixedArgsJavaScript()); assert(builtin->IsFixedArgsJavaScript());
// FixedArg javascript builtins need to offer the parameter // FixedArg javascript builtins need to offer the parameter
// count. // count.
assert(builtin->parameter_names().size() >= 2); int size = static_cast<int>(builtin->parameter_names().size());
new_contents_stream << ", " << (builtin->parameter_names().size() - 2); assert(size >= 1);
new_contents_stream << ", " << (std::max(size - 2, 0));
// And the receiver is explicitly declared. // And the receiver is explicitly declared.
new_contents_stream << ", kReceiver"; new_contents_stream << ", kReceiver";
firstParameterIndex = 2; 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