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
20
src/ic.cc
20
src/ic.cc
@ -182,9 +182,7 @@ Address IC::OriginalCodeAddress() const {
|
||||
static bool TryRemoveInvalidPrototypeDependentStub(Code* target,
|
||||
Object* receiver,
|
||||
Object* name) {
|
||||
if (target->is_keyed_load_stub() ||
|
||||
target->is_keyed_call_stub() ||
|
||||
target->is_keyed_store_stub()) {
|
||||
if (target->is_keyed_stub()) {
|
||||
// Determine whether the failure is due to a name failure.
|
||||
if (!name->IsName()) return false;
|
||||
Name* stub_name = target->FindFirstName();
|
||||
@ -1102,9 +1100,8 @@ void IC::PatchCache(State state,
|
||||
UpdateMonomorphicIC(receiver, code, name);
|
||||
break;
|
||||
case MONOMORPHIC:
|
||||
// Only move to megamorphic if the target changes.
|
||||
if (target() != *code) {
|
||||
if (target()->is_load_stub() || target()->is_store_stub()) {
|
||||
ASSERT(target() != *code);
|
||||
if (!target()->is_keyed_stub()) {
|
||||
bool is_same_handler = false;
|
||||
{
|
||||
DisallowHeapAllocation no_allocation;
|
||||
@ -1125,23 +1122,22 @@ void IC::PatchCache(State state,
|
||||
|
||||
UpdateMegamorphicCache(receiver->map(), *name, *code);
|
||||
set_target(*megamorphic_stub());
|
||||
}
|
||||
break;
|
||||
case MEGAMORPHIC:
|
||||
UpdateMegamorphicCache(receiver->map(), *name, *code);
|
||||
break;
|
||||
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)) {
|
||||
break;
|
||||
}
|
||||
CopyICToMegamorphicCache(name);
|
||||
UpdateMegamorphicCache(receiver->map(), *name, *code);
|
||||
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;
|
||||
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() {
|
||||
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_nil_ic_stub() { return kind() == COMPARE_NIL_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.
|
||||
inline int major_key();
|
||||
|
Loading…
Reference in New Issue
Block a user