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

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

Issue 2028983002: Introduce IsUndefined(Isolate*) and IsTheHole(Isolate*) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase master Created 4 years, 6 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
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 22 matching lines...) Expand all
33 DCHECK(handler->IsJSReceiver()); 33 DCHECK(handler->IsJSReceiver());
34 // 4. Let target be the value of the [[ProxyTarget]] internal slot of O. 34 // 4. Let target be the value of the [[ProxyTarget]] internal slot of O.
35 Handle<JSReceiver> target(proxy->target(), isolate); 35 Handle<JSReceiver> target(proxy->target(), isolate);
36 // 5. Let trap be ? GetMethod(handler, "apply"). 36 // 5. Let trap be ? GetMethod(handler, "apply").
37 Handle<Object> trap; 37 Handle<Object> trap;
38 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 38 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
39 isolate, trap, 39 isolate, trap,
40 Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name)); 40 Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name));
41 // 6. If trap is undefined, then 41 // 6. If trap is undefined, then
42 int const arguments_length = args.length() - 2; 42 int const arguments_length = args.length() - 2;
43 if (trap->IsUndefined()) { 43 if (trap->IsUndefined(isolate)) {
44 // 6.a. Return Call(target, thisArgument, argumentsList). 44 // 6.a. Return Call(target, thisArgument, argumentsList).
45 ScopedVector<Handle<Object>> argv(arguments_length); 45 ScopedVector<Handle<Object>> argv(arguments_length);
46 for (int i = 0; i < arguments_length; ++i) { 46 for (int i = 0; i < arguments_length; ++i) {
47 argv[i] = args.at<Object>(i + 1); 47 argv[i] = args.at<Object>(i + 1);
48 } 48 }
49 RETURN_RESULT_OR_FAILURE( 49 RETURN_RESULT_OR_FAILURE(
50 isolate, Execution::Call(isolate, target, receiver, arguments_length, 50 isolate, Execution::Call(isolate, target, receiver, arguments_length,
51 argv.start())); 51 argv.start()));
52 } 52 }
53 // 7. Let argArray be CreateArrayFromList(argumentsList). 53 // 7. Let argArray be CreateArrayFromList(argumentsList).
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 DCHECK(handler->IsJSReceiver()); 87 DCHECK(handler->IsJSReceiver());
88 // 4. Let target be the value of the [[ProxyTarget]] internal slot of O. 88 // 4. Let target be the value of the [[ProxyTarget]] internal slot of O.
89 Handle<JSReceiver> target(JSReceiver::cast(proxy->target()), isolate); 89 Handle<JSReceiver> target(JSReceiver::cast(proxy->target()), isolate);
90 // 5. Let trap be ? GetMethod(handler, "construct"). 90 // 5. Let trap be ? GetMethod(handler, "construct").
91 Handle<Object> trap; 91 Handle<Object> trap;
92 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 92 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
93 isolate, trap, 93 isolate, trap,
94 Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name)); 94 Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name));
95 // 6. If trap is undefined, then 95 // 6. If trap is undefined, then
96 int const arguments_length = args.length() - 3; 96 int const arguments_length = args.length() - 3;
97 if (trap->IsUndefined()) { 97 if (trap->IsUndefined(isolate)) {
98 // 6.a. Assert: target has a [[Construct]] internal method. 98 // 6.a. Assert: target has a [[Construct]] internal method.
99 DCHECK(target->IsConstructor()); 99 DCHECK(target->IsConstructor());
100 // 6.b. Return Construct(target, argumentsList, newTarget). 100 // 6.b. Return Construct(target, argumentsList, newTarget).
101 ScopedVector<Handle<Object>> argv(arguments_length); 101 ScopedVector<Handle<Object>> argv(arguments_length);
102 for (int i = 0; i < arguments_length; ++i) { 102 for (int i = 0; i < arguments_length; ++i) {
103 argv[i] = args.at<Object>(i + 1); 103 argv[i] = args.at<Object>(i + 1);
104 } 104 }
105 RETURN_RESULT_OR_FAILURE( 105 RETURN_RESULT_OR_FAILURE(
106 isolate, Execution::New(isolate, target, new_target, arguments_length, 106 isolate, Execution::New(isolate, target, new_target, arguments_length,
107 argv.start())); 107 argv.start()));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 RUNTIME_FUNCTION(Runtime_JSProxyRevoke) { 160 RUNTIME_FUNCTION(Runtime_JSProxyRevoke) {
161 HandleScope scope(isolate); 161 HandleScope scope(isolate);
162 DCHECK(args.length() == 1); 162 DCHECK(args.length() == 1);
163 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); 163 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0);
164 JSProxy::Revoke(proxy); 164 JSProxy::Revoke(proxy);
165 return isolate->heap()->undefined_value(); 165 return isolate->heap()->undefined_value();
166 } 166 }
167 167
168 } // namespace internal 168 } // namespace internal
169 } // namespace v8 169 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698