Combine DEBUG_BREAK and DEBUG_PREPARE_STEP_IN into one IC stub kind DEBUG_STUB, encoding DEBUG_BREAK and DEBUG_PREPARE_STEP_IN as extra ic state.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13352 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2013-01-10 14:15:12 +00:00
parent 1079642c97
commit 7cb764b780
9 changed files with 54 additions and 52 deletions

View File

@ -221,31 +221,31 @@ enum BuiltinExtraArguments {
#ifdef ENABLE_DEBUGGER_SUPPORT
// Define list of builtins used by the debugger implemented in assembly.
#define BUILTIN_LIST_DEBUG_A(V) \
V(Return_DebugBreak, BUILTIN, DEBUG_BREAK, \
Code::kNoExtraICState) \
V(CallFunctionStub_DebugBreak, BUILTIN, DEBUG_BREAK, \
Code::kNoExtraICState) \
V(CallFunctionStub_Recording_DebugBreak, BUILTIN, DEBUG_BREAK, \
Code::kNoExtraICState) \
V(CallConstructStub_DebugBreak, BUILTIN, DEBUG_BREAK, \
Code::kNoExtraICState) \
V(CallConstructStub_Recording_DebugBreak, BUILTIN, DEBUG_BREAK, \
Code::kNoExtraICState) \
V(LoadIC_DebugBreak, LOAD_IC, DEBUG_BREAK, \
Code::kNoExtraICState) \
V(KeyedLoadIC_DebugBreak, KEYED_LOAD_IC, DEBUG_BREAK, \
Code::kNoExtraICState) \
V(StoreIC_DebugBreak, STORE_IC, DEBUG_BREAK, \
Code::kNoExtraICState) \
V(KeyedStoreIC_DebugBreak, KEYED_STORE_IC, DEBUG_BREAK, \
Code::kNoExtraICState) \
V(Slot_DebugBreak, BUILTIN, DEBUG_BREAK, \
Code::kNoExtraICState) \
V(PlainReturn_LiveEdit, BUILTIN, DEBUG_BREAK, \
Code::kNoExtraICState) \
V(FrameDropper_LiveEdit, BUILTIN, DEBUG_BREAK, \
Code::kNoExtraICState)
#define BUILTIN_LIST_DEBUG_A(V) \
V(Return_DebugBreak, BUILTIN, DEBUG_STUB, \
DEBUG_BREAK) \
V(CallFunctionStub_DebugBreak, BUILTIN, DEBUG_STUB, \
DEBUG_BREAK) \
V(CallFunctionStub_Recording_DebugBreak, BUILTIN, DEBUG_STUB, \
DEBUG_BREAK) \
V(CallConstructStub_DebugBreak, BUILTIN, DEBUG_STUB, \
DEBUG_BREAK) \
V(CallConstructStub_Recording_DebugBreak, BUILTIN, DEBUG_STUB, \
DEBUG_BREAK) \
V(LoadIC_DebugBreak, LOAD_IC, DEBUG_STUB, \
DEBUG_BREAK) \
V(KeyedLoadIC_DebugBreak, KEYED_LOAD_IC, DEBUG_STUB, \
DEBUG_BREAK) \
V(StoreIC_DebugBreak, STORE_IC, DEBUG_STUB, \
DEBUG_BREAK) \
V(KeyedStoreIC_DebugBreak, KEYED_STORE_IC, DEBUG_STUB, \
DEBUG_BREAK) \
V(Slot_DebugBreak, BUILTIN, DEBUG_STUB, \
DEBUG_BREAK) \
V(PlainReturn_LiveEdit, BUILTIN, DEBUG_STUB, \
DEBUG_BREAK) \
V(FrameDropper_LiveEdit, BUILTIN, DEBUG_STUB, \
DEBUG_BREAK)
#else
#define BUILTIN_LIST_DEBUG_A(V)
#endif

View File

@ -1587,7 +1587,7 @@ bool Debug::StepNextContinue(BreakLocationIterator* break_location_iterator,
// object.
bool Debug::IsDebugBreak(Address addr) {
Code* code = Code::GetCodeFromTargetAddress(addr);
return code->ic_state() == DEBUG_BREAK;
return code->is_debug_break();
}

View File

@ -52,8 +52,7 @@ char IC::TransitionMarkFromState(IC::State state) {
// We never see the debugger states here, because the state is
// computed from the original code - not the patched code. Let
// these cases fall through to the unreachable code below.
case DEBUG_BREAK: break;
case DEBUG_PREPARE_STEP_IN: break;
case DEBUG_STUB: break;
}
UNREACHABLE();
return 0;
@ -347,7 +346,7 @@ void IC::Clear(Address address) {
Code* target = GetTargetAtAddress(address);
// Don't clear debug break inline cache as it will remove the break point.
if (target->ic_state() == DEBUG_BREAK) return;
if (target->is_debug_break()) return;
switch (target->kind()) {
case Code::LOAD_IC: return LoadIC::Clear(address, target);
@ -770,8 +769,7 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
isolate()->stub_cache()->Set(*name, cache_object->map(), *code);
break;
}
case DEBUG_BREAK:
case DEBUG_PREPARE_STEP_IN:
case DEBUG_STUB:
break;
case POLYMORPHIC:
UNREACHABLE();
@ -1066,8 +1064,7 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
// GenerateMonomorphicCacheProbe.
isolate()->stub_cache()->Set(*name, receiver->map(), *code);
break;
case DEBUG_BREAK:
case DEBUG_PREPARE_STEP_IN:
case DEBUG_STUB:
break;
case POLYMORPHIC:
UNREACHABLE();
@ -1339,8 +1336,7 @@ void KeyedLoadIC::UpdateCaches(LookupResult* lookup,
}
break;
case MEGAMORPHIC:
case DEBUG_BREAK:
case DEBUG_PREPARE_STEP_IN:
case DEBUG_STUB:
break;
case MONOMORPHIC_PROTOTYPE_FAILURE:
UNREACHABLE();
@ -1615,8 +1611,7 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
// Update the stub cache.
isolate()->stub_cache()->Set(*name, receiver->map(), *code);
break;
case DEBUG_BREAK:
case DEBUG_PREPARE_STEP_IN:
case DEBUG_STUB:
break;
case POLYMORPHIC:
UNREACHABLE();
@ -1667,8 +1662,7 @@ void KeyedIC::GetReceiverMapsForStub(Handle<Code> stub,
case UNINITIALIZED:
case PREMONOMORPHIC:
case MONOMORPHIC_PROTOTYPE_FAILURE:
case DEBUG_BREAK:
case DEBUG_PREPARE_STEP_IN:
case DEBUG_STUB:
UNREACHABLE();
break;
}
@ -2114,8 +2108,7 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
}
break;
case MEGAMORPHIC:
case DEBUG_BREAK:
case DEBUG_PREPARE_STEP_IN:
case DEBUG_STUB:
break;
case MONOMORPHIC_PROTOTYPE_FAILURE:
UNREACHABLE();

View File

@ -1663,7 +1663,7 @@ static const char* DropFrames(Vector<StackFrame*> frames,
Code* pre_top_frame_code = pre_top_frame->LookupCode();
bool frame_has_padding;
if (pre_top_frame_code->is_inline_cache_stub() &&
pre_top_frame_code->ic_state() == DEBUG_BREAK) {
pre_top_frame_code->is_debug_break()) {
// OK, we can drop inline cache calls.
*mode = Debug::FRAME_DROPPED_IN_IC_CALL;
frame_has_padding = Debug::FramePaddingLayout::kIsSupported;

View File

@ -3418,14 +3418,13 @@ InlineCacheState Code::ic_state() {
// a call to code object has been replaced with a debug break call.
ASSERT(is_inline_cache_stub() ||
result == UNINITIALIZED ||
result == DEBUG_BREAK ||
result == DEBUG_PREPARE_STEP_IN);
result == DEBUG_STUB);
return result;
}
Code::ExtraICState Code::extra_ic_state() {
ASSERT(is_inline_cache_stub());
ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB);
return ExtractExtraICStateFromFlags(flags());
}
@ -3676,6 +3675,11 @@ bool Code::is_inline_cache_stub() {
}
bool Code::is_debug_break() {
return ic_state() == DEBUG_STUB && extra_ic_state() == DEBUG_BREAK;
}
Code::Flags Code::ComputeFlags(Kind kind,
InlineCacheState ic_state,
ExtraICState extra_ic_state,

View File

@ -9036,8 +9036,7 @@ const char* Code::ICState2String(InlineCacheState state) {
case MONOMORPHIC_PROTOTYPE_FAILURE: return "MONOMORPHIC_PROTOTYPE_FAILURE";
case POLYMORPHIC: return "POLYMORPHIC";
case MEGAMORPHIC: return "MEGAMORPHIC";
case DEBUG_BREAK: return "DEBUG_BREAK";
case DEBUG_PREPARE_STEP_IN: return "DEBUG_PREPARE_STEP_IN";
case DEBUG_STUB: return "DEBUG_STUB";
}
UNREACHABLE();
return NULL;

View File

@ -178,6 +178,12 @@ enum TransitionFlag {
};
enum DebugExtraICState {
DEBUG_BREAK,
DEBUG_PREPARE_STEP_IN
};
// Indicates whether the transition is simple: the target map of the transition
// either extends the current map with a new property, or it modifies the
// property that was added last to the current map.
@ -4311,6 +4317,7 @@ class Code: public HeapObject {
// Testers for IC stub kinds.
inline bool is_inline_cache_stub();
inline bool is_debug_break();
inline bool is_load_stub() { return kind() == LOAD_IC; }
inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; }
inline bool is_store_stub() { return kind() == STORE_IC; }

View File

@ -909,7 +909,7 @@ Handle<Code> StubCache::ComputeCallDebugBreak(int argc,
// Extra IC state is irrelevant for debug break ICs. They jump to
// the actual call ic to carry out the work.
Code::Flags flags =
Code::ComputeFlags(kind, DEBUG_BREAK, Code::kNoExtraICState,
Code::ComputeFlags(kind, DEBUG_STUB, DEBUG_BREAK,
Code::NORMAL, argc);
Handle<UnseededNumberDictionary> cache =
isolate_->factory()->non_monomorphic_cache();
@ -928,7 +928,7 @@ Handle<Code> StubCache::ComputeCallDebugPrepareStepIn(int argc,
// Extra IC state is irrelevant for debug break ICs. They jump to
// the actual call ic to carry out the work.
Code::Flags flags =
Code::ComputeFlags(kind, DEBUG_PREPARE_STEP_IN, Code::kNoExtraICState,
Code::ComputeFlags(kind, DEBUG_STUB, DEBUG_PREPARE_STEP_IN,
Code::NORMAL, argc);
Handle<UnseededNumberDictionary> cache =
isolate_->factory()->non_monomorphic_cache();

View File

@ -263,9 +263,8 @@ enum InlineCacheState {
POLYMORPHIC,
// Many receiver types have been seen.
MEGAMORPHIC,
// Special states for debug break or step in prepare stubs.
DEBUG_BREAK,
DEBUG_PREPARE_STEP_IN
// Special state for debug break or step in prepare stubs.
DEBUG_STUB
};