Fix assertion while marking Harmony weak maps.

R=erik.corry@gmail.com
BUG=v8:1845
TEST=mjsunit/harmony/proxies-example-membrane

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10081 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mstarzinger@chromium.org 2011-11-29 08:48:51 +00:00
parent b3a2e242db
commit e3eb71e991
3 changed files with 7 additions and 16 deletions

View File

@ -966,12 +966,11 @@ class StaticMarkingVisitor : public StaticVisitorBase {
object_size);
// Mark the backing hash table without pushing it on the marking stack.
ASSERT(!MarkCompactCollector::IsMarked(weak_map->unchecked_table()));
ASSERT(MarkCompactCollector::IsMarked(weak_map->unchecked_table()->map()));
HeapObject* unchecked_table = weak_map->unchecked_table();
MarkBit mark_bit = Marking::MarkBitFrom(unchecked_table);
collector->SetMark(unchecked_table, mark_bit);
ObjectHashTable* table = ObjectHashTable::cast(weak_map->table());
ASSERT(!MarkCompactCollector::IsMarked(table));
collector->SetMark(table, Marking::MarkBitFrom(table));
collector->MarkObject(table->map(), Marking::MarkBitFrom(table->map()));
ASSERT(MarkCompactCollector::IsMarked(table->map()));
}
static void VisitCode(Map* map, HeapObject* object) {
@ -2297,7 +2296,7 @@ void MarkCompactCollector::ProcessWeakMaps() {
while (weak_map_obj != Smi::FromInt(0)) {
ASSERT(MarkCompactCollector::IsMarked(HeapObject::cast(weak_map_obj)));
JSWeakMap* weak_map = reinterpret_cast<JSWeakMap*>(weak_map_obj);
ObjectHashTable* table = weak_map->unchecked_table();
ObjectHashTable* table = ObjectHashTable::cast(weak_map->table());
for (int i = 0; i < table->Capacity(); i++) {
if (MarkCompactCollector::IsMarked(HeapObject::cast(table->KeyAt(i)))) {
Object* value = table->get(table->EntryToValueIndex(i));
@ -2318,7 +2317,7 @@ void MarkCompactCollector::ClearWeakMaps() {
while (weak_map_obj != Smi::FromInt(0)) {
ASSERT(MarkCompactCollector::IsMarked(HeapObject::cast(weak_map_obj)));
JSWeakMap* weak_map = reinterpret_cast<JSWeakMap*>(weak_map_obj);
ObjectHashTable* table = weak_map->unchecked_table();
ObjectHashTable* table = ObjectHashTable::cast(weak_map->table());
for (int i = 0; i < table->Capacity(); i++) {
if (!MarkCompactCollector::IsMarked(HeapObject::cast(table->KeyAt(i)))) {
table->RemoveEntry(i);

View File

@ -3930,11 +3930,6 @@ ACCESSORS(JSWeakMap, table, Object, kTableOffset)
ACCESSORS(JSWeakMap, next, Object, kNextOffset)
ObjectHashTable* JSWeakMap::unchecked_table() {
return reinterpret_cast<ObjectHashTable*>(READ_FIELD(this, kTableOffset));
}
Address Foreign::foreign_address() {
return AddressFrom<Address>(READ_INTPTR_FIELD(this, kForeignAddressOffset));
}

View File

@ -7297,9 +7297,6 @@ class JSWeakMap: public JSObject {
// [next]: linked list of encountered weak maps during GC.
DECL_ACCESSORS(next, Object)
// Unchecked accessors to be used during GC.
inline ObjectHashTable* unchecked_table();
// Casting.
static inline JSWeakMap* cast(Object* obj);