Cleanup in IC patching.
BUG= R=ulan@chromium.org Review URL: https://chromiumcodereview.appspot.com/25001005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17036 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
1324c94712
commit
14422a698f
54
src/ic.cc
54
src/ic.cc
@ -182,9 +182,7 @@ Address IC::OriginalCodeAddress() const {
|
|||||||
static bool TryRemoveInvalidPrototypeDependentStub(Code* target,
|
static bool TryRemoveInvalidPrototypeDependentStub(Code* target,
|
||||||
Object* receiver,
|
Object* receiver,
|
||||||
Object* name) {
|
Object* name) {
|
||||||
if (target->is_keyed_load_stub() ||
|
if (target->is_keyed_stub()) {
|
||||||
target->is_keyed_call_stub() ||
|
|
||||||
target->is_keyed_store_stub()) {
|
|
||||||
// Determine whether the failure is due to a name failure.
|
// Determine whether the failure is due to a name failure.
|
||||||
if (!name->IsName()) return false;
|
if (!name->IsName()) return false;
|
||||||
Name* stub_name = target->FindFirstName();
|
Name* stub_name = target->FindFirstName();
|
||||||
@ -1102,46 +1100,44 @@ void IC::PatchCache(State state,
|
|||||||
UpdateMonomorphicIC(receiver, code, name);
|
UpdateMonomorphicIC(receiver, code, name);
|
||||||
break;
|
break;
|
||||||
case MONOMORPHIC:
|
case MONOMORPHIC:
|
||||||
// Only move to megamorphic if the target changes.
|
ASSERT(target() != *code);
|
||||||
if (target() != *code) {
|
if (!target()->is_keyed_stub()) {
|
||||||
if (target()->is_load_stub() || target()->is_store_stub()) {
|
bool is_same_handler = false;
|
||||||
bool is_same_handler = false;
|
{
|
||||||
{
|
DisallowHeapAllocation no_allocation;
|
||||||
DisallowHeapAllocation no_allocation;
|
Code* old_handler = target()->FindFirstHandler();
|
||||||
Code* old_handler = target()->FindFirstHandler();
|
is_same_handler = old_handler == *code;
|
||||||
is_same_handler = old_handler == *code;
|
}
|
||||||
}
|
if (is_same_handler
|
||||||
if (is_same_handler
|
&& IsTransitionedMapOfMonomorphicTarget(receiver->map())) {
|
||||||
&& IsTransitionedMapOfMonomorphicTarget(receiver->map())) {
|
UpdateMonomorphicIC(receiver, code, name);
|
||||||
UpdateMonomorphicIC(receiver, code, name);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
if (UpdatePolymorphicIC(state, receiver, name, code)) {
|
||||||
if (UpdatePolymorphicIC(state, receiver, name, code)) {
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
CopyICToMegamorphicCache(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateMegamorphicCache(receiver->map(), *name, *code);
|
CopyICToMegamorphicCache(name);
|
||||||
set_target(*megamorphic_stub());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateMegamorphicCache(receiver->map(), *name, *code);
|
||||||
|
set_target(*megamorphic_stub());
|
||||||
break;
|
break;
|
||||||
case MEGAMORPHIC:
|
case MEGAMORPHIC:
|
||||||
UpdateMegamorphicCache(receiver->map(), *name, *code);
|
UpdateMegamorphicCache(receiver->map(), *name, *code);
|
||||||
break;
|
break;
|
||||||
case POLYMORPHIC:
|
case POLYMORPHIC:
|
||||||
if (target()->is_load_stub() || target()->is_store_stub()) {
|
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(state, receiver, name, code)) {
|
if (UpdatePolymorphicIC(state, receiver, name, code)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CopyICToMegamorphicCache(name);
|
CopyICToMegamorphicCache(name);
|
||||||
UpdateMegamorphicCache(receiver->map(), *name, *code);
|
UpdateMegamorphicCache(receiver->map(), *name, *code);
|
||||||
set_target(*megamorphic_stub());
|
set_target(*megamorphic_stub());
|
||||||
} else {
|
|
||||||
// When trying to patch a polymorphic keyed load/store element stub
|
|
||||||
// with anything other than another polymorphic stub, go generic.
|
|
||||||
set_target(*generic_stub());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DEBUG_STUB:
|
case DEBUG_STUB:
|
||||||
|
@ -4028,6 +4028,11 @@ bool Code::is_inline_cache_stub() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Code::is_keyed_stub() {
|
||||||
|
return is_keyed_load_stub() || is_keyed_store_stub() || is_keyed_call_stub();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Code::is_debug_stub() {
|
bool Code::is_debug_stub() {
|
||||||
return ic_state() == DEBUG_STUB;
|
return ic_state() == DEBUG_STUB;
|
||||||
}
|
}
|
||||||
|
@ -4895,6 +4895,7 @@ class Code: public HeapObject {
|
|||||||
inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; }
|
inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; }
|
||||||
inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; }
|
inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; }
|
||||||
inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; }
|
inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; }
|
||||||
|
inline bool is_keyed_stub();
|
||||||
|
|
||||||
// [major_key]: For kind STUB or BINARY_OP_IC, the major key.
|
// [major_key]: For kind STUB or BINARY_OP_IC, the major key.
|
||||||
inline int major_key();
|
inline int major_key();
|
||||||
|
Loading…
Reference in New Issue
Block a user