| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "src/heap/heap.h" | 5 #include "src/heap/heap.h" | 
| 6 | 6 | 
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" | 
| 8 #include "src/api.h" | 8 #include "src/api.h" | 
| 9 #include "src/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" | 
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" | 
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 109       remembered_unmapped_pages_index_(0), | 109       remembered_unmapped_pages_index_(0), | 
| 110 #ifdef DEBUG | 110 #ifdef DEBUG | 
| 111       allocation_timeout_(0), | 111       allocation_timeout_(0), | 
| 112 #endif  // DEBUG | 112 #endif  // DEBUG | 
| 113       old_generation_allocation_limit_(initial_old_generation_size_), | 113       old_generation_allocation_limit_(initial_old_generation_size_), | 
| 114       old_gen_exhausted_(false), | 114       old_gen_exhausted_(false), | 
| 115       optimize_for_memory_usage_(false), | 115       optimize_for_memory_usage_(false), | 
| 116       inline_allocation_disabled_(false), | 116       inline_allocation_disabled_(false), | 
| 117       total_regexp_code_generated_(0), | 117       total_regexp_code_generated_(0), | 
| 118       tracer_(nullptr), | 118       tracer_(nullptr), | 
|  | 119       embedder_heap_tracer_(nullptr), | 
| 119       high_survival_rate_period_length_(0), | 120       high_survival_rate_period_length_(0), | 
| 120       promoted_objects_size_(0), | 121       promoted_objects_size_(0), | 
| 121       promotion_ratio_(0), | 122       promotion_ratio_(0), | 
| 122       semi_space_copied_object_size_(0), | 123       semi_space_copied_object_size_(0), | 
| 123       previous_semi_space_copied_object_size_(0), | 124       previous_semi_space_copied_object_size_(0), | 
| 124       semi_space_copied_rate_(0), | 125       semi_space_copied_rate_(0), | 
| 125       nodes_died_in_new_space_(0), | 126       nodes_died_in_new_space_(0), | 
| 126       nodes_copied_in_new_space_(0), | 127       nodes_copied_in_new_space_(0), | 
| 127       nodes_promoted_(0), | 128       nodes_promoted_(0), | 
| 128       maximum_size_scavenges_(0), | 129       maximum_size_scavenges_(0), | 
| (...skipping 5284 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5413 #ifdef DEBUG | 5414 #ifdef DEBUG | 
| 5414   // All pages right after bootstrapping must be marked as never-evacuate. | 5415   // All pages right after bootstrapping must be marked as never-evacuate. | 
| 5415   PagedSpaces spaces(this); | 5416   PagedSpaces spaces(this); | 
| 5416   for (PagedSpace* s = spaces.next(); s != NULL; s = spaces.next()) { | 5417   for (PagedSpace* s = spaces.next(); s != NULL; s = spaces.next()) { | 
| 5417     PageIterator it(s); | 5418     PageIterator it(s); | 
| 5418     while (it.has_next()) CHECK(it.next()->NeverEvacuate()); | 5419     while (it.has_next()) CHECK(it.next()->NeverEvacuate()); | 
| 5419   } | 5420   } | 
| 5420 #endif  // DEBUG | 5421 #endif  // DEBUG | 
| 5421 } | 5422 } | 
| 5422 | 5423 | 
|  | 5424 void Heap::RegisterExternallyReferencedObject(Object** object) { | 
|  | 5425   DCHECK(mark_compact_collector()->in_use()); | 
|  | 5426   HeapObject* heap_object = HeapObject::cast(*object); | 
|  | 5427   DCHECK(Contains(heap_object)); | 
|  | 5428   MarkBit mark_bit = Marking::MarkBitFrom(heap_object); | 
|  | 5429   mark_compact_collector()->MarkObject(heap_object, mark_bit); | 
|  | 5430 } | 
| 5423 | 5431 | 
| 5424 void Heap::TearDown() { | 5432 void Heap::TearDown() { | 
| 5425 #ifdef VERIFY_HEAP | 5433 #ifdef VERIFY_HEAP | 
| 5426   if (FLAG_verify_heap) { | 5434   if (FLAG_verify_heap) { | 
| 5427     Verify(); | 5435     Verify(); | 
| 5428   } | 5436   } | 
| 5429 #endif | 5437 #endif | 
| 5430 | 5438 | 
| 5431   UpdateMaximumCommitted(); | 5439   UpdateMaximumCommitted(); | 
| 5432 | 5440 | 
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5578   DCHECK(callback != NULL); | 5586   DCHECK(callback != NULL); | 
| 5579   for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { | 5587   for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { | 
| 5580     if (gc_epilogue_callbacks_[i].callback == callback) { | 5588     if (gc_epilogue_callbacks_[i].callback == callback) { | 
| 5581       gc_epilogue_callbacks_.Remove(i); | 5589       gc_epilogue_callbacks_.Remove(i); | 
| 5582       return; | 5590       return; | 
| 5583     } | 5591     } | 
| 5584   } | 5592   } | 
| 5585   UNREACHABLE(); | 5593   UNREACHABLE(); | 
| 5586 } | 5594 } | 
| 5587 | 5595 | 
|  | 5596 void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { | 
|  | 5597   DCHECK_NOT_NULL(tracer); | 
|  | 5598   CHECK_NULL(embedder_heap_tracer_); | 
|  | 5599   embedder_heap_tracer_ = tracer; | 
|  | 5600 } | 
| 5588 | 5601 | 
| 5589 // TODO(ishell): Find a better place for this. | 5602 // TODO(ishell): Find a better place for this. | 
| 5590 void Heap::AddWeakObjectToCodeDependency(Handle<HeapObject> obj, | 5603 void Heap::AddWeakObjectToCodeDependency(Handle<HeapObject> obj, | 
| 5591                                          Handle<DependentCode> dep) { | 5604                                          Handle<DependentCode> dep) { | 
| 5592   DCHECK(!InNewSpace(*obj)); | 5605   DCHECK(!InNewSpace(*obj)); | 
| 5593   DCHECK(!InNewSpace(*dep)); | 5606   DCHECK(!InNewSpace(*dep)); | 
| 5594   Handle<WeakHashTable> table(weak_object_to_code_table(), isolate()); | 5607   Handle<WeakHashTable> table(weak_object_to_code_table(), isolate()); | 
| 5595   table = WeakHashTable::Put(table, obj, dep); | 5608   table = WeakHashTable::Put(table, obj, dep); | 
| 5596   if (*table != weak_object_to_code_table()) | 5609   if (*table != weak_object_to_code_table()) | 
| 5597     set_weak_object_to_code_table(*table); | 5610     set_weak_object_to_code_table(*table); | 
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6473 } | 6486 } | 
| 6474 | 6487 | 
| 6475 | 6488 | 
| 6476 // static | 6489 // static | 
| 6477 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6490 int Heap::GetStaticVisitorIdForMap(Map* map) { | 
| 6478   return StaticVisitorBase::GetVisitorId(map); | 6491   return StaticVisitorBase::GetVisitorId(map); | 
| 6479 } | 6492 } | 
| 6480 | 6493 | 
| 6481 }  // namespace internal | 6494 }  // namespace internal | 
| 6482 }  // namespace v8 | 6495 }  // namespace v8 | 
| OLD | NEW | 
|---|