Commit 9c161bcf authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Adding files for LiveObjectList implementation.

Patch by Mark Lam from Hewlett-Packard Development Company, LP

Review URL: http://codereview.chromium.org/6357005


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7012 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8481a756
......@@ -267,6 +267,12 @@ DEFINE_bool(use_idle_notification, true,
// ic.cc
DEFINE_bool(use_ic, true, "use inline caching")
#ifdef LIVE_OBJECT_LIST
// liveobjectlist.cc
DEFINE_string(lol_workdir, NULL, "path for lol temp files")
DEFINE_bool(verify_lol, false, "perform debugging verification for lol")
#endif
// macro-assembler-ia32.cc
DEFINE_bool(native_code_counters, false,
"generate extra code for manipulating stats counters")
......
......@@ -32,5 +32,95 @@
#include "liveobjectlist.h"
namespace v8 {
namespace internal {
#ifdef LIVE_OBJECT_LIST
void LiveObjectList::GCEpilogue() {
if (!NeedLOLProcessing()) return;
GCEpiloguePrivate();
}
void LiveObjectList::GCPrologue() {
if (!NeedLOLProcessing()) return;
#ifdef VERIFY_LOL
if (FLAG_verify_lol) {
Verify();
}
#endif
}
void LiveObjectList::IterateElements(ObjectVisitor* v) {
if (!NeedLOLProcessing()) return;
IterateElementsPrivate(v);
}
void LiveObjectList::ProcessNonLive(HeapObject *obj) {
// Only do work if we have at least one list to process.
if (last()) DoProcessNonLive(obj);
}
void LiveObjectList::UpdateReferencesForScavengeGC() {
if (LiveObjectList::NeedLOLProcessing()) {
UpdateLiveObjectListVisitor update_visitor;
LiveObjectList::IterateElements(&update_visitor);
}
}
LiveObjectList* LiveObjectList::FindLolForId(int id,
LiveObjectList* start_lol) {
if (id != 0) {
LiveObjectList* lol = start_lol;
while (lol != NULL) {
if (lol->id() == id) {
return lol;
}
lol = lol->prev_;
}
}
return NULL;
}
// Iterates the elements in every lol and returns the one that matches the
// specified key. If no matching element is found, then it returns NULL.
template <typename T>
inline LiveObjectList::Element*
LiveObjectList::FindElementFor(T (*GetValue)(LiveObjectList::Element*), T key) {
LiveObjectList *lol = last();
while (lol != NULL) {
Element* elements = lol->elements_;
for (int i = 0; i < lol->obj_count_; i++) {
Element* element = &elements[i];
if (GetValue(element) == key) {
return element;
}
}
lol = lol->prev_;
}
return NULL;
}
inline int LiveObjectList::GetElementId(LiveObjectList::Element* element) {
return element->id_;
}
inline HeapObject*
LiveObjectList::GetElementObj(LiveObjectList::Element* element) {
return element->obj_;
}
#endif // LIVE_OBJECT_LIST
} } // namespace v8::internal
#endif // V8_LIVEOBJECTLIST_INL_H_
This diff is collapsed.
This diff is collapsed.
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