Commit ff602161 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Remove DisallowHeapAllocation requirement now that the target() is cached on the IC.

R=ulan@chromium.org

Review URL: https://chromiumcodereview.appspot.com/61773004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17551 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 442e77d5
...@@ -270,8 +270,6 @@ bool CallIC::TryUpdateExtraICState(LookupResult* lookup, ...@@ -270,8 +270,6 @@ bool CallIC::TryUpdateExtraICState(LookupResult* lookup,
bool IC::TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, bool IC::TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver,
Handle<String> name) { Handle<String> name) {
DisallowHeapAllocation no_gc;
if (target()->is_call_stub()) { if (target()->is_call_stub()) {
LookupResult lookup(isolate()); LookupResult lookup(isolate());
LookupForRead(receiver, name, &lookup); LookupForRead(receiver, name, &lookup);
...@@ -961,32 +959,30 @@ bool IC::UpdatePolymorphicIC(Handle<HeapObject> receiver, ...@@ -961,32 +959,30 @@ bool IC::UpdatePolymorphicIC(Handle<HeapObject> receiver,
int number_of_valid_maps; int number_of_valid_maps;
int handler_to_overwrite = -1; int handler_to_overwrite = -1;
Handle<Map> new_receiver_map(receiver->map()); Handle<Map> new_receiver_map(receiver->map());
{
DisallowHeapAllocation no_gc; target()->FindAllMaps(&receiver_maps);
target()->FindAllMaps(&receiver_maps); int number_of_maps = receiver_maps.length();
int number_of_maps = receiver_maps.length(); number_of_valid_maps = number_of_maps;
number_of_valid_maps = number_of_maps;
for (int i = 0; i < number_of_maps; i++) {
for (int i = 0; i < number_of_maps; i++) { Handle<Map> map = receiver_maps.at(i);
Handle<Map> map = receiver_maps.at(i); // Filter out deprecated maps to ensure its instances get migrated.
// Filter out deprecated maps to ensure its instances get migrated. if (map->is_deprecated()) {
if (map->is_deprecated()) { number_of_valid_maps--;
number_of_valid_maps--; // If the receiver map is already in the polymorphic IC, this indicates
// If the receiver map is already in the polymorphic IC, this indicates // there was a prototoype chain failure. In that case, just overwrite the
// there was a prototoype chain failure. In that case, just overwrite the // handler.
// handler. } else if (map.is_identical_to(new_receiver_map)) {
} else if (map.is_identical_to(new_receiver_map)) { number_of_valid_maps--;
number_of_valid_maps--; handler_to_overwrite = i;
handler_to_overwrite = i;
}
} }
}
if (number_of_valid_maps >= 4) return false; if (number_of_valid_maps >= 4) return false;
if (number_of_maps == 0) return false; if (number_of_maps == 0) return false;
if (!target()->FindHandlers(&handlers, receiver_maps.length())) { if (!target()->FindHandlers(&handlers, receiver_maps.length())) {
return false; return false;
}
} }
number_of_valid_maps++; number_of_valid_maps++;
...@@ -1017,11 +1013,8 @@ void IC::UpdateMonomorphicIC(Handle<HeapObject> receiver, ...@@ -1017,11 +1013,8 @@ void IC::UpdateMonomorphicIC(Handle<HeapObject> receiver,
void IC::CopyICToMegamorphicCache(Handle<String> name) { void IC::CopyICToMegamorphicCache(Handle<String> name) {
MapHandleList receiver_maps; MapHandleList receiver_maps;
CodeHandleList handlers; CodeHandleList handlers;
{ target()->FindAllMaps(&receiver_maps);
DisallowHeapAllocation no_gc; if (!target()->FindHandlers(&handlers, receiver_maps.length())) return;
target()->FindAllMaps(&receiver_maps);
if (!target()->FindHandlers(&handlers, receiver_maps.length())) return;
}
for (int i = 0; i < receiver_maps.length(); i++) { for (int i = 0; i < receiver_maps.length(); i++) {
UpdateMegamorphicCache(*receiver_maps.at(i), *name, *handlers.at(i)); UpdateMegamorphicCache(*receiver_maps.at(i), *name, *handlers.at(i));
} }
...@@ -1029,8 +1022,6 @@ void IC::CopyICToMegamorphicCache(Handle<String> name) { ...@@ -1029,8 +1022,6 @@ void IC::CopyICToMegamorphicCache(Handle<String> name) {
bool IC::IsTransitionedMapOfMonomorphicTarget(Map* receiver_map) { bool IC::IsTransitionedMapOfMonomorphicTarget(Map* receiver_map) {
DisallowHeapAllocation no_allocation;
Map* current_map = target()->FindFirstMap(); Map* current_map = target()->FindFirstMap();
ElementsKind receiver_elements_kind = receiver_map->elements_kind(); ElementsKind receiver_elements_kind = receiver_map->elements_kind();
bool more_general_transition = bool more_general_transition =
...@@ -1061,43 +1052,26 @@ void IC::PatchCache(Handle<HeapObject> receiver, ...@@ -1061,43 +1052,26 @@ void IC::PatchCache(Handle<HeapObject> receiver,
!target().is_identical_to(code)); !target().is_identical_to(code));
if (!target()->is_keyed_stub()) { if (!target()->is_keyed_stub()) {
bool is_same_handler = false; bool is_same_handler = false;
{ Code* old_handler = target()->FindFirstHandler();
DisallowHeapAllocation no_allocation; is_same_handler = old_handler == *code;
Code* old_handler = target()->FindFirstHandler();
is_same_handler = old_handler == *code; if (is_same_handler &&
} IsTransitionedMapOfMonomorphicTarget(receiver->map())) {
if (is_same_handler
&& IsTransitionedMapOfMonomorphicTarget(receiver->map())) {
UpdateMonomorphicIC(receiver, code, name); UpdateMonomorphicIC(receiver, code, name);
break; break;
} }
if (UpdatePolymorphicIC(receiver, name, code)) { }
break; // Fall through.
} case POLYMORPHIC:
if (!target()->is_keyed_stub()) {
if (UpdatePolymorphicIC(receiver, name, code)) break;
CopyICToMegamorphicCache(name); CopyICToMegamorphicCache(name);
} }
UpdateMegamorphicCache(receiver->map(), *name, *code);
set_target(*megamorphic_stub()); set_target(*megamorphic_stub());
break; // Fall through.
case MEGAMORPHIC: case MEGAMORPHIC:
UpdateMegamorphicCache(receiver->map(), *name, *code); UpdateMegamorphicCache(receiver->map(), *name, *code);
break; break;
case POLYMORPHIC:
if (target()->is_keyed_stub()) {
// When trying to patch a polymorphic keyed stub with anything other
// than another polymorphic stub, go generic.
set_target(*generic_stub());
} else {
if (UpdatePolymorphicIC(receiver, name, code)) {
break;
}
CopyICToMegamorphicCache(name);
UpdateMegamorphicCache(receiver->map(), *name, *code);
set_target(*megamorphic_stub());
}
break;
case DEBUG_STUB: case DEBUG_STUB:
break; break;
case GENERIC: case GENERIC:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment