GDBJIT: Remove codes when they are garbage collected.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/13880031

Patch from Haitao Feng <haitao.feng@intel.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15477 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6659869b
......@@ -2166,6 +2166,24 @@ void GDBJITInterface::RemoveCode(Code* code) {
}
void GDBJITInterface::RemoveCodeRange(Address start, Address end) {
HashMap* entries = GetEntries();
Zone zone(Isolate::Current());
ZoneList<Code*> dead_codes(1, &zone);
for (HashMap::Entry* e = entries->Start(); e != NULL; e = entries->Next(e)) {
Code* code = reinterpret_cast<Code*>(e->key);
if (code->address() >= start && code->address() < end) {
dead_codes.Add(code, &zone);
}
}
for (int i = 0; i < dead_codes.length(); i++) {
RemoveCode(dead_codes.at(i));
}
}
void GDBJITInterface::RegisterDetailedLineInfo(Code* code,
GDBJITLineInfo* line_info) {
ScopedLock lock(mutex.Pointer());
......
......@@ -131,6 +131,8 @@ class GDBJITInterface: public AllStatic {
static void RemoveCode(Code* code);
static void RemoveCodeRange(Address start, Address end);
static void RegisterDetailedLineInfo(Code* code, GDBJITLineInfo* line_info);
};
......
......@@ -3137,6 +3137,11 @@ static void SweepPrecisely(PagedSpace* space,
Address free_end = object_address + offsets[live_index++] * kPointerSize;
if (free_end != free_start) {
space->Free(free_start, static_cast<int>(free_end - free_start));
#ifdef ENABLE_GDB_JIT_INTERFACE
if (FLAG_gdbjit && space->identity() == CODE_SPACE) {
GDBJITInterface::RemoveCodeRange(free_start, free_end);
}
#endif
}
HeapObject* live_object = HeapObject::FromAddress(free_end);
ASSERT(Marking::IsBlack(Marking::MarkBitFrom(live_object)));
......@@ -3163,6 +3168,11 @@ static void SweepPrecisely(PagedSpace* space,
}
if (free_start != p->area_end()) {
space->Free(free_start, static_cast<int>(p->area_end() - free_start));
#ifdef ENABLE_GDB_JIT_INTERFACE
if (FLAG_gdbjit && space->identity() == CODE_SPACE) {
GDBJITInterface::RemoveCodeRange(free_start, p->area_end());
}
#endif
}
p->ResetLiveBytes();
if (FLAG_print_cumulative_gc_stat) {
......
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