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

Unified Diff: src/runtime/runtime-function.cc

Issue 1530893002: [proxies] Correctly handle proxies in Function.prototype.bind (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase and separate file for tests. Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/function-bind.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-function.cc
diff --git a/src/runtime/runtime-function.cc b/src/runtime/runtime-function.cc
index 499d4a9783f9dd7cc716610390d4636159b50cc3..e1e9c46e0bd3315ea7cab87ef11223d0367ef26f 100644
--- a/src/runtime/runtime-function.cc
+++ b/src/runtime/runtime-function.cc
@@ -390,11 +390,12 @@ base::SmartArrayPointer<Handle<Object>> Runtime::GetCallerArguments(
RUNTIME_FUNCTION(Runtime_FunctionBindArguments) {
HandleScope scope(isolate);
- DCHECK(args.length() == 4);
+ DCHECK(args.length() == 5);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, bound_function, 0);
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, bindee, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, this_object, 2);
CONVERT_NUMBER_ARG_HANDLE_CHECKED(new_length, 3);
+ CONVERT_ARG_HANDLE_CHECKED(Object, proto, 4);
// TODO(lrn): Create bound function in C++ code from premade shared info.
bound_function->shared()->set_bound(true);
@@ -446,13 +447,11 @@ RUNTIME_FUNCTION(Runtime_FunctionBindArguments) {
// is happy about the number of fields.
RUNTIME_ASSERT(bound_function->RemovePrototype());
- // The new function should have the same [[Prototype]] as the bindee.
+ // The new function should have the given prototype.
Handle<Map> bound_function_map =
bindee->IsConstructor()
? isolate->bound_function_with_constructor_map()
: isolate->bound_function_without_constructor_map();
- PrototypeIterator iter(isolate, bindee);
- Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
if (bound_function_map->prototype() != *proto) {
bound_function_map = Map::TransitionToPrototype(bound_function_map, proto,
REGULAR_PROTOTYPE);
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/function-bind.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698