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

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

Issue 1369293003: Wrap JSFunction bindings in a helper object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Better wrapping. Created 5 years, 2 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/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 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 } 1579 }
1580 // If {object} is not a receiver, return false. 1580 // If {object} is not a receiver, return false.
1581 if (!object->IsJSReceiver()) { 1581 if (!object->IsJSReceiver()) {
1582 return isolate->heap()->false_value(); 1582 return isolate->heap()->false_value();
1583 } 1583 }
1584 // Check if {callable} is bound, if so, get [[BoundFunction]] from it and use 1584 // Check if {callable} is bound, if so, get [[BoundFunction]] from it and use
1585 // that instead of {callable}. 1585 // that instead of {callable}.
1586 if (callable->IsJSFunction()) { 1586 if (callable->IsJSFunction()) {
1587 Handle<JSFunction> function = Handle<JSFunction>::cast(callable); 1587 Handle<JSFunction> function = Handle<JSFunction>::cast(callable);
1588 if (function->shared()->bound()) { 1588 if (function->shared()->bound()) {
1589 Handle<FixedArray> bindings(function->function_bindings(), isolate); 1589 Handle<BindingsArray> bindings(function->function_bindings(), isolate);
1590 callable = 1590 callable = handle(bindings->bound_function(), isolate);
1591 handle(bindings->get(JSFunction::kBoundFunctionIndex), isolate);
1592 } 1591 }
1593 } 1592 }
1594 DCHECK(callable->IsCallable()); 1593 DCHECK(callable->IsCallable());
1595 // Get the "prototype" of {callable}; raise an error if it's not a receiver. 1594 // Get the "prototype" of {callable}; raise an error if it's not a receiver.
1596 Handle<Object> prototype; 1595 Handle<Object> prototype;
1597 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1596 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1598 isolate, prototype, 1597 isolate, prototype,
1599 Object::GetProperty(callable, isolate->factory()->prototype_string())); 1598 Object::GetProperty(callable, isolate->factory()->prototype_string()));
1600 if (!prototype->IsJSReceiver()) { 1599 if (!prototype->IsJSReceiver()) {
1601 THROW_NEW_ERROR_RETURN_FAILURE( 1600 THROW_NEW_ERROR_RETURN_FAILURE(
(...skipping 29 matching lines...) Expand all
1631 RUNTIME_FUNCTION(Runtime_IsAccessCheckNeeded) { 1630 RUNTIME_FUNCTION(Runtime_IsAccessCheckNeeded) {
1632 SealHandleScope shs(isolate); 1631 SealHandleScope shs(isolate);
1633 DCHECK_EQ(1, args.length()); 1632 DCHECK_EQ(1, args.length());
1634 CONVERT_ARG_CHECKED(Object, object, 0); 1633 CONVERT_ARG_CHECKED(Object, object, 0);
1635 return isolate->heap()->ToBoolean(object->IsAccessCheckNeeded()); 1634 return isolate->heap()->ToBoolean(object->IsAccessCheckNeeded());
1636 } 1635 }
1637 1636
1638 1637
1639 } // namespace internal 1638 } // namespace internal
1640 } // namespace v8 1639 } // namespace v8
OLDNEW
« src/runtime/runtime-function.cc ('K') | « src/runtime/runtime-function.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698