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

Unified Diff: src/objects.cc

Issue 293223002: Avoid dynamic initial map check when inlining call-new. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 352e5d6508d5465728352992d9a974e7bafeea16..744af1845a7b6b25bba80abcabff67b8d69f527f 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -10210,6 +10210,8 @@ Handle<Object> CacheInitialJSArrayMaps(
void JSFunction::SetInstancePrototype(Handle<JSFunction> function,
Handle<Object> value) {
+ Isolate* isolate = function->GetIsolate();
+
ASSERT(value->IsJSReceiver());
// First some logic for the map of the prototype to make sure it is in fast
@@ -10228,7 +10230,8 @@ void JSFunction::SetInstancePrototype(Handle<JSFunction> function,
if (function->shared()->IsInobjectSlackTrackingInProgress()) {
function->shared()->CompleteInobjectSlackTracking();
}
- Handle<Map> new_map = Map::Copy(handle(function->initial_map()));
+ Handle<Map> initial_map(function->initial_map(), isolate);
+ Handle<Map> new_map = Map::Copy(initial_map);
new_map->set_prototype(*value);
// If the function is used as the global Array function, cache the
@@ -10237,17 +10240,21 @@ void JSFunction::SetInstancePrototype(Handle<JSFunction> function,
Object* array_function = native_context->get(Context::ARRAY_FUNCTION_INDEX);
if (array_function->IsJSFunction() &&
*function == JSFunction::cast(array_function)) {
- CacheInitialJSArrayMaps(handle(native_context), new_map);
+ CacheInitialJSArrayMaps(handle(native_context, isolate), new_map);
}
function->set_initial_map(*new_map);
+
+ // Deoptimize all code that embeds the previous initial map.
+ initial_map->dependent_code()->DeoptimizeDependentCodeGroup(
+ isolate, DependentCode::kInitialMapChangedGroup);
} else {
// Put the value in the initial map field until an initial map is
// needed. At that point, a new initial map is created and the
// prototype is put into the initial map where it belongs.
function->set_prototype_or_initial_map(*value);
}
- function->GetHeap()->ClearInstanceofCache();
+ isolate->heap()->ClearInstanceofCache();
}
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698