Commit 51aa0c13 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Allow NORMAL ICs to go polymorphic.

R=danno@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15600 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent dfd955ff
...@@ -978,12 +978,6 @@ bool IC::UpdatePolymorphicIC(State state, ...@@ -978,12 +978,6 @@ bool IC::UpdatePolymorphicIC(State state,
Handle<String> name, Handle<String> name,
Handle<Code> code, Handle<Code> code,
StrictModeFlag strict_mode) { StrictModeFlag strict_mode) {
if (code->type() == Code::NORMAL) return false;
if (target()->ic_state() == MONOMORPHIC &&
target()->type() == Code::NORMAL) {
return false;
}
MapHandleList receiver_maps; MapHandleList receiver_maps;
CodeHandleList handlers; CodeHandleList handlers;
...@@ -992,7 +986,12 @@ bool IC::UpdatePolymorphicIC(State state, ...@@ -992,7 +986,12 @@ bool IC::UpdatePolymorphicIC(State state,
Handle<Map> new_receiver_map(receiver->map()); Handle<Map> new_receiver_map(receiver->map());
{ {
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
target()->FindAllMaps(&receiver_maps); if (target()->ic_state() == POLYMORPHIC ||
(target()->ic_state() == MONOMORPHIC &&
target()->type() != Code::NORMAL)) {
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;
...@@ -1012,12 +1011,9 @@ bool IC::UpdatePolymorphicIC(State state, ...@@ -1012,12 +1011,9 @@ bool IC::UpdatePolymorphicIC(State state,
if (number_of_valid_maps >= 4) return false; if (number_of_valid_maps >= 4) return false;
// Only allow 0 maps in case target() was reset to UNINITIALIZED by the GC. if (number_of_maps > 0) {
// In that case, allow the IC to go back monomorphic. target()->FindAllCode(&handlers, receiver_maps.length());
if (number_of_maps == 0 && target()->ic_state() != UNINITIALIZED) {
return false;
} }
target()->FindAllCode(&handlers, receiver_maps.length());
} }
number_of_valid_maps++; number_of_valid_maps++;
......
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