Commit c7ac4269 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

[builtins] Remove runtime JSProxyCall builtin

Bug: v8:6558, v8:6557
Change-Id: If708d21d7ac4a02470dd547837443e74f9022cd9
Reviewed-on: https://chromium-review.googlesource.com/571783Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Maya Lekova <mslekova@google.com>
Cr-Commit-Position: refs/heads/master@{#46676}
parent 8f6303fb
......@@ -2646,8 +2646,9 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode,
// existing receiver on the stack.
__ AddP(r2, r2, Operand(2));
// Tail-call to the runtime.
// This used to be a call to JSProxyCall which is now a CSA builtin
__ JumpToExternalReference(
ExternalReference(Runtime::kJSProxyCall, masm->isolate()));
ExternalReference(Runtime::kAbort, masm->isolate()));
// 2. Call to something else, which might have a [[Call]] internal method (if
// not we raise an exception).
......
......@@ -14,60 +14,6 @@ namespace v8 {
namespace internal {
// ES6 9.5.13 [[Call]] (thisArgument, argumentsList)
RUNTIME_FUNCTION(Runtime_JSProxyCall) {
HandleScope scope(isolate);
DCHECK_LE(2, args.length());
// thisArgument == receiver
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, args.length() - 1);
Handle<String> trap_name = isolate->factory()->apply_string();
// 1. Let handler be the value of the [[ProxyHandler]] internal slot of O.
Handle<Object> handler(proxy->handler(), isolate);
// 2. If handler is null, throw a TypeError exception.
if (proxy->IsRevoked()) {
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kProxyRevoked, trap_name));
}
// 3. Assert: Type(handler) is Object.
DCHECK(handler->IsJSReceiver());
// 4. Let target be the value of the [[ProxyTarget]] internal slot of O.
Handle<JSReceiver> target(proxy->target(), isolate);
// 5. Let trap be ? GetMethod(handler, "apply").
Handle<Object> trap;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, trap,
Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name));
// 6. If trap is undefined, then
int const arguments_length = args.length() - 2;
if (trap->IsUndefined(isolate)) {
// 6.a. Return Call(target, thisArgument, argumentsList).
ScopedVector<Handle<Object>> argv(arguments_length);
for (int i = 0; i < arguments_length; ++i) {
argv[i] = args.at(i + 1);
}
RETURN_RESULT_OR_FAILURE(
isolate, Execution::Call(isolate, target, receiver, arguments_length,
argv.start()));
}
// 7. Let argArray be CreateArrayFromList(argumentsList).
Handle<JSArray> arg_array = isolate->factory()->NewJSArray(
PACKED_ELEMENTS, arguments_length, arguments_length);
ElementsAccessor* accessor = arg_array->GetElementsAccessor();
{
DisallowHeapAllocation no_gc;
for (int i = 0; i < arguments_length; i++) {
accessor->Set(arg_array, i, args[i + 1]);
}
}
// 8. Return Call(trap, handler, «target, thisArgument, argArray»).
Handle<Object> trap_args[] = {target, receiver, arg_array};
RETURN_RESULT_OR_FAILURE(
isolate,
Execution::Call(isolate, trap, handler, arraysize(trap_args), trap_args));
}
// 9.5.14 [[Construct]] (argumentsList, newTarget)
RUNTIME_FUNCTION(Runtime_JSProxyConstruct) {
HandleScope scope(isolate);
......
......@@ -471,7 +471,6 @@ namespace internal {
#define FOR_EACH_INTRINSIC_PROXY(F) \
F(IsJSProxy, 1, 1) \
F(JSProxyCall, -1 /* >= 2 */, 1) \
F(JSProxyConstruct, -1 /* >= 3 */, 1) \
F(JSProxyGetTarget, 1, 1) \
F(JSProxyGetHandler, 1, 1) \
......
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