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 5044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5055 | 5055 |
5056 old_pointer_space_->Verify(&visitor); | 5056 old_pointer_space_->Verify(&visitor); |
5057 map_space_->Verify(&visitor); | 5057 map_space_->Verify(&visitor); |
5058 | 5058 |
5059 VerifyPointersVisitor no_dirty_regions_visitor; | 5059 VerifyPointersVisitor no_dirty_regions_visitor; |
5060 old_data_space_->Verify(&no_dirty_regions_visitor); | 5060 old_data_space_->Verify(&no_dirty_regions_visitor); |
5061 code_space_->Verify(&no_dirty_regions_visitor); | 5061 code_space_->Verify(&no_dirty_regions_visitor); |
5062 cell_space_->Verify(&no_dirty_regions_visitor); | 5062 cell_space_->Verify(&no_dirty_regions_visitor); |
5063 | 5063 |
5064 lo_space_->Verify(); | 5064 lo_space_->Verify(); |
5065 | |
5066 // TODO(svenpanne) We should enable this when our fast->slow->fast-mode dance | |
5067 // for setting accessor properties is fixed. | |
5068 // VerifyNoAccessorPairSharing(); | |
5065 } | 5069 } |
5066 | 5070 |
5071 | |
5072 void Heap::VerifyNoAccessorPairSharing() { | |
5073 // Verification is done in 2 phases: First we mark all AccessorPairs, checking | |
5074 // that we mark only unmarked pairs, then we clear all marks, restoring the | |
5075 // initial state. We use the LSB of the AccessorPair's getter as the marking | |
Michael Starzinger
2012/02/17 13:33:28
Actually we want to use the "Smi tag" which happen
Sven Panne
2012/02/20 08:26:03
Done.
| |
5076 // bit, because we can never see a Smi as the getter. | |
5077 for (int phase = 0; phase < 2; phase++) { | |
5078 HeapObjectIterator iter(map_space()); | |
5079 for (HeapObject* obj = iter.Next(); obj != NULL; obj = iter.Next()) { | |
5080 if (obj->IsMap()) { | |
5081 DescriptorArray* descs = Map::cast(obj)->instance_descriptors(); | |
5082 for (int i = 0; i < descs->number_of_descriptors(); i++) { | |
5083 if (descs->GetType(i) == CALLBACKS && | |
5084 descs->GetValue(i)->IsAccessorPair()) { | |
5085 AccessorPair* accessors = AccessorPair::cast(descs->GetValue(i)); | |
5086 uintptr_t before = reinterpret_cast<intptr_t>(accessors->getter()); | |
5087 uintptr_t after = (phase == 0) ? (before & ~1) : (before | 1); | |
Michael Starzinger
2012/02/17 13:33:28
Please use the kHeapObjectTag[Mask] and kSmiTag[Ma
Sven Panne
2012/02/20 08:26:03
Done.
| |
5088 CHECK(before != after); | |
5089 accessors->set_getter(reinterpret_cast<Object*>(after)); | |
5090 } | |
5091 } | |
5092 } | |
5093 } | |
5094 } | |
5095 } | |
5067 #endif // DEBUG | 5096 #endif // DEBUG |
5068 | 5097 |
5069 | 5098 |
5070 MaybeObject* Heap::LookupSymbol(Vector<const char> string) { | 5099 MaybeObject* Heap::LookupSymbol(Vector<const char> string) { |
5071 Object* symbol = NULL; | 5100 Object* symbol = NULL; |
5072 Object* new_table; | 5101 Object* new_table; |
5073 { MaybeObject* maybe_new_table = | 5102 { MaybeObject* maybe_new_table = |
5074 symbol_table()->LookupSymbol(string, &symbol); | 5103 symbol_table()->LookupSymbol(string, &symbol); |
5075 if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table; | 5104 if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table; |
5076 } | 5105 } |
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6881 isolate_->heap()->store_buffer()->Compact(); | 6910 isolate_->heap()->store_buffer()->Compact(); |
6882 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6911 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6883 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6912 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6884 next = chunk->next_chunk(); | 6913 next = chunk->next_chunk(); |
6885 isolate_->memory_allocator()->Free(chunk); | 6914 isolate_->memory_allocator()->Free(chunk); |
6886 } | 6915 } |
6887 chunks_queued_for_free_ = NULL; | 6916 chunks_queued_for_free_ = NULL; |
6888 } | 6917 } |
6889 | 6918 |
6890 } } // namespace v8::internal | 6919 } } // namespace v8::internal |
OLD | NEW |