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

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

Issue 1552473002: Revert of [runtime] Introduce dedicated JSBoundFunction to represent bound functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@FunctionConstructor
Patch Set: Created 4 years, 11 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-function.cc ('k') | src/runtime/runtime-observe.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/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 // {callable} must have a [[Call]] internal method. 1339 // {callable} must have a [[Call]] internal method.
1340 if (!callable->IsCallable()) { 1340 if (!callable->IsCallable()) {
1341 THROW_NEW_ERROR_RETURN_FAILURE( 1341 THROW_NEW_ERROR_RETURN_FAILURE(
1342 isolate, 1342 isolate,
1343 NewTypeError(MessageTemplate::kInstanceofFunctionExpected, callable)); 1343 NewTypeError(MessageTemplate::kInstanceofFunctionExpected, callable));
1344 } 1344 }
1345 // If {object} is not a receiver, return false. 1345 // If {object} is not a receiver, return false.
1346 if (!object->IsJSReceiver()) { 1346 if (!object->IsJSReceiver()) {
1347 return isolate->heap()->false_value(); 1347 return isolate->heap()->false_value();
1348 } 1348 }
1349 // Check if {callable} is bound, if so, get [[BoundTargetFunction]] from it 1349 // Check if {callable} is bound, if so, get [[BoundFunction]] from it and use
1350 // and use that instead of {callable}. 1350 // that instead of {callable}.
1351 while (callable->IsJSBoundFunction()) { 1351 if (callable->IsJSFunction()) {
1352 callable = 1352 Handle<JSFunction> function = Handle<JSFunction>::cast(callable);
1353 handle(Handle<JSBoundFunction>::cast(callable)->bound_target_function(), 1353 if (function->shared()->bound()) {
1354 isolate); 1354 Handle<BindingsArray> bindings(function->function_bindings(), isolate);
1355 callable = handle(bindings->bound_function(), isolate);
1356 }
1355 } 1357 }
1356 DCHECK(callable->IsCallable()); 1358 DCHECK(callable->IsCallable());
1357 // Get the "prototype" of {callable}; raise an error if it's not a receiver. 1359 // Get the "prototype" of {callable}; raise an error if it's not a receiver.
1358 Handle<Object> prototype; 1360 Handle<Object> prototype;
1359 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1361 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1360 isolate, prototype, 1362 isolate, prototype,
1361 Object::GetProperty(callable, isolate->factory()->prototype_string())); 1363 Object::GetProperty(callable, isolate->factory()->prototype_string()));
1362 if (!prototype->IsJSReceiver()) { 1364 if (!prototype->IsJSReceiver()) {
1363 THROW_NEW_ERROR_RETURN_FAILURE( 1365 THROW_NEW_ERROR_RETURN_FAILURE(
1364 isolate, 1366 isolate,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 1414
1413 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { 1415 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) {
1414 HandleScope scope(isolate); 1416 HandleScope scope(isolate);
1415 DCHECK(args.length() == 2); 1417 DCHECK(args.length() == 2);
1416 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); 1418 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
1417 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); 1419 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1);
1418 return JSReceiver::DefineProperties(isolate, o, properties); 1420 return JSReceiver::DefineProperties(isolate, o, properties);
1419 } 1421 }
1420 } // namespace internal 1422 } // namespace internal
1421 } // namespace v8 1423 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-function.cc ('k') | src/runtime/runtime-observe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698