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

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

Issue 1379323002: [runtime] Share constructor/non-constructor bound function maps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/contexts.h ('k') | no next file » | 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 c0a64425d4136331e64b0164207d133f254c234e..f994ee336561a3c51da186de4783480b75bf0a92 100644
--- a/src/runtime/runtime-function.cc
+++ b/src/runtime/runtime-function.cc
@@ -409,19 +409,18 @@ RUNTIME_FUNCTION(Runtime_FunctionBindArguments) {
RUNTIME_ASSERT(bound_function->RemovePrototype());
// The new function should have the same [[Prototype]] as the bindee.
- Handle<Map> bound_function_map(
- isolate->native_context()->bound_function_map());
+ 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);
}
- if (bound_function_map->is_constructor() != bindee->IsConstructor()) {
- bound_function_map = Map::Copy(bound_function_map, "IsConstructor");
- bound_function_map->set_is_constructor(bindee->IsConstructor());
- }
JSObject::MigrateToMap(bound_function, bound_function_map);
+ DCHECK_EQ(bindee->IsConstructor(), bound_function->IsConstructor());
Handle<String> length_string = isolate->factory()->length_string();
// These attributes must be kept in sync with how the bootstrapper
« no previous file with comments | « src/contexts.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698