| OLD | NEW |
| 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 5337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5348 | 5348 |
| 5349 old_pointer_space_->Verify(&visitor); | 5349 old_pointer_space_->Verify(&visitor); |
| 5350 map_space_->Verify(&visitor); | 5350 map_space_->Verify(&visitor); |
| 5351 | 5351 |
| 5352 VerifyPointersVisitor no_dirty_regions_visitor; | 5352 VerifyPointersVisitor no_dirty_regions_visitor; |
| 5353 old_data_space_->Verify(&no_dirty_regions_visitor); | 5353 old_data_space_->Verify(&no_dirty_regions_visitor); |
| 5354 code_space_->Verify(&no_dirty_regions_visitor); | 5354 code_space_->Verify(&no_dirty_regions_visitor); |
| 5355 cell_space_->Verify(&no_dirty_regions_visitor); | 5355 cell_space_->Verify(&no_dirty_regions_visitor); |
| 5356 | 5356 |
| 5357 lo_space_->Verify(); | 5357 lo_space_->Verify(); |
| 5358 | |
| 5359 VerifyNoAccessorPairSharing(); | |
| 5360 } | 5358 } |
| 5361 | 5359 |
| 5362 | 5360 |
| 5363 void Heap::VerifyNoAccessorPairSharing() { | |
| 5364 // Verification is done in 2 phases: First we mark all AccessorPairs, checking | |
| 5365 // that we mark only unmarked pairs, then we clear all marks, restoring the | |
| 5366 // initial state. We use the Smi tag of the AccessorPair's getter as the | |
| 5367 // marking bit, because we can never see a Smi as the getter. | |
| 5368 for (int phase = 0; phase < 2; phase++) { | |
| 5369 HeapObjectIterator iter(map_space()); | |
| 5370 for (HeapObject* obj = iter.Next(); obj != NULL; obj = iter.Next()) { | |
| 5371 if (obj->IsMap()) { | |
| 5372 DescriptorArray* descs = Map::cast(obj)->instance_descriptors(); | |
| 5373 for (int i = 0; i < descs->number_of_descriptors(); i++) { | |
| 5374 if (descs->GetType(i) == CALLBACKS && | |
| 5375 descs->GetValue(i)->IsAccessorPair()) { | |
| 5376 AccessorPair* accessors = AccessorPair::cast(descs->GetValue(i)); | |
| 5377 uintptr_t before = reinterpret_cast<intptr_t>(accessors->getter()); | |
| 5378 uintptr_t after = (phase == 0) ? | |
| 5379 ((before & ~kSmiTagMask) | kSmiTag) : | |
| 5380 ((before & ~kHeapObjectTag) | kHeapObjectTag); | |
| 5381 CHECK(before != after); | |
| 5382 accessors->set_getter(reinterpret_cast<Object*>(after)); | |
| 5383 } | |
| 5384 } | |
| 5385 } | |
| 5386 } | |
| 5387 } | |
| 5388 } | |
| 5389 #endif // DEBUG | 5361 #endif // DEBUG |
| 5390 | 5362 |
| 5391 | 5363 |
| 5392 MaybeObject* Heap::LookupSymbol(Vector<const char> string) { | 5364 MaybeObject* Heap::LookupSymbol(Vector<const char> string) { |
| 5393 Object* symbol = NULL; | 5365 Object* symbol = NULL; |
| 5394 Object* new_table; | 5366 Object* new_table; |
| 5395 { MaybeObject* maybe_new_table = | 5367 { MaybeObject* maybe_new_table = |
| 5396 symbol_table()->LookupSymbol(string, &symbol); | 5368 symbol_table()->LookupSymbol(string, &symbol); |
| 5397 if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table; | 5369 if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table; |
| 5398 } | 5370 } |
| (...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7219 } else { | 7191 } else { |
| 7220 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. | 7192 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. |
| 7221 } | 7193 } |
| 7222 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = | 7194 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = |
| 7223 reinterpret_cast<Address>(p); | 7195 reinterpret_cast<Address>(p); |
| 7224 remembered_unmapped_pages_index_++; | 7196 remembered_unmapped_pages_index_++; |
| 7225 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; | 7197 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; |
| 7226 } | 7198 } |
| 7227 | 7199 |
| 7228 } } // namespace v8::internal | 7200 } } // namespace v8::internal |
| OLD | NEW |