Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: src/mark-compact.cc

Issue 10034018: Fix WeakMap processing for evacuation candidates (2). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/cctest/test-weakmaps.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 } 2585 }
2586 } 2586 }
2587 2587
2588 2588
2589 void MarkCompactCollector::ProcessWeakMaps() { 2589 void MarkCompactCollector::ProcessWeakMaps() {
2590 Object* weak_map_obj = encountered_weak_maps(); 2590 Object* weak_map_obj = encountered_weak_maps();
2591 while (weak_map_obj != Smi::FromInt(0)) { 2591 while (weak_map_obj != Smi::FromInt(0)) {
2592 ASSERT(MarkCompactCollector::IsMarked(HeapObject::cast(weak_map_obj))); 2592 ASSERT(MarkCompactCollector::IsMarked(HeapObject::cast(weak_map_obj)));
2593 JSWeakMap* weak_map = reinterpret_cast<JSWeakMap*>(weak_map_obj); 2593 JSWeakMap* weak_map = reinterpret_cast<JSWeakMap*>(weak_map_obj);
2594 ObjectHashTable* table = ObjectHashTable::cast(weak_map->table()); 2594 ObjectHashTable* table = ObjectHashTable::cast(weak_map->table());
2595 Object** anchor = reinterpret_cast<Object**>(table->address());
2595 for (int i = 0; i < table->Capacity(); i++) { 2596 for (int i = 0; i < table->Capacity(); i++) {
2596 if (MarkCompactCollector::IsMarked(HeapObject::cast(table->KeyAt(i)))) { 2597 if (MarkCompactCollector::IsMarked(HeapObject::cast(table->KeyAt(i)))) {
2597 int idx = ObjectHashTable::EntryToValueIndex(i); 2598 Object** key_slot =
2598 Object** slot = 2599 HeapObject::RawField(table, FixedArray::OffsetOfElementAt(
2599 HeapObject::RawField(table, FixedArray::OffsetOfElementAt(idx)); 2600 ObjectHashTable::EntryToIndex(i)));
2600 StaticMarkingVisitor::VisitPointer(heap(), slot); 2601 RecordSlot(anchor, key_slot, *key_slot);
2602 Object** value_slot =
2603 HeapObject::RawField(table, FixedArray::OffsetOfElementAt(
2604 ObjectHashTable::EntryToValueIndex(i)));
2605 StaticMarkingVisitor::MarkObjectByPointer(this, anchor, value_slot);
2601 } 2606 }
2602 } 2607 }
2603 weak_map_obj = weak_map->next(); 2608 weak_map_obj = weak_map->next();
2604 } 2609 }
2605 } 2610 }
2606 2611
2607 2612
2608 void MarkCompactCollector::ClearWeakMaps() { 2613 void MarkCompactCollector::ClearWeakMaps() {
2609 Object* weak_map_obj = encountered_weak_maps(); 2614 Object* weak_map_obj = encountered_weak_maps();
2610 while (weak_map_obj != Smi::FromInt(0)) { 2615 while (weak_map_obj != Smi::FromInt(0)) {
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
4135 while (buffer != NULL) { 4140 while (buffer != NULL) {
4136 SlotsBuffer* next_buffer = buffer->next(); 4141 SlotsBuffer* next_buffer = buffer->next();
4137 DeallocateBuffer(buffer); 4142 DeallocateBuffer(buffer);
4138 buffer = next_buffer; 4143 buffer = next_buffer;
4139 } 4144 }
4140 *buffer_address = NULL; 4145 *buffer_address = NULL;
4141 } 4146 }
4142 4147
4143 4148
4144 } } // namespace v8::internal 4149 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-weakmaps.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698