Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: src/runtime/runtime-proxy.cc

Issue 1752133004: [proxies] throw TypeError in [[Call]] if is_callable Map bit is unset (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/elements.h" 8 #include "src/elements.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
11 #include "src/objects-inl.h" 11 #include "src/objects-inl.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 16
17 // ES6 9.5.13 [[Call]] (thisArgument, argumentsList) 17 // ES6 9.5.13 [[Call]] (thisArgument, argumentsList)
18 RUNTIME_FUNCTION(Runtime_JSProxyCall) { 18 RUNTIME_FUNCTION(Runtime_JSProxyCall) {
19 HandleScope scope(isolate); 19 HandleScope scope(isolate);
20 DCHECK_LE(2, args.length()); 20 DCHECK_LE(2, args.length());
21 // thisArgument == receiver 21 // thisArgument == receiver
22 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); 22 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
23 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, args.length() - 1); 23 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, args.length() - 1);
24
25 if (V8_UNLIKELY(!proxy->target()->IsCallable())) {
26 // TODO(caitp): Remove when handled in compiler/backends/builtins
27 Handle<String> callsite = Runtime::RenderCallSite(isolate, proxy);
28 THROW_NEW_ERROR_RETURN_FAILURE(
29 isolate, NewTypeError(MessageTemplate::kCalledNonCallable, callsite));
Camillo Bruni 2016/03/02 17:41:03 Would you mind fixing it directly in PLATFORM/buil
caitp (gmail) 2016/03/02 18:26:57 Done, with ports for ia32, x64, arm and arm64
30 }
31
24 Handle<String> trap_name = isolate->factory()->apply_string(); 32 Handle<String> trap_name = isolate->factory()->apply_string();
25 // 1. Let handler be the value of the [[ProxyHandler]] internal slot of O. 33 // 1. Let handler be the value of the [[ProxyHandler]] internal slot of O.
26 Handle<Object> handler(proxy->handler(), isolate); 34 Handle<Object> handler(proxy->handler(), isolate);
27 // 2. If handler is null, throw a TypeError exception. 35 // 2. If handler is null, throw a TypeError exception.
28 if (proxy->IsRevoked()) { 36 if (proxy->IsRevoked()) {
29 THROW_NEW_ERROR_RETURN_FAILURE( 37 THROW_NEW_ERROR_RETURN_FAILURE(
30 isolate, NewTypeError(MessageTemplate::kProxyRevoked, trap_name)); 38 isolate, NewTypeError(MessageTemplate::kProxyRevoked, trap_name));
31 } 39 }
32 // 3. Assert: Type(handler) is Object. 40 // 3. Assert: Type(handler) is Object.
33 DCHECK(handler->IsJSReceiver()); 41 DCHECK(handler->IsJSReceiver());
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 RUNTIME_FUNCTION(Runtime_JSProxyRevoke) { 174 RUNTIME_FUNCTION(Runtime_JSProxyRevoke) {
167 HandleScope scope(isolate); 175 HandleScope scope(isolate);
168 DCHECK(args.length() == 1); 176 DCHECK(args.length() == 1);
169 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); 177 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0);
170 JSProxy::Revoke(proxy); 178 JSProxy::Revoke(proxy);
171 return isolate->heap()->undefined_value(); 179 return isolate->heap()->undefined_value();
172 } 180 }
173 181
174 } // namespace internal 182 } // namespace internal
175 } // namespace v8 183 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698