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

Side by Side Diff: src/heap/heap.cc

Issue 2046423002: [snapshot] introduce SnapshotCreator API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
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 5592 matching lines...) Expand 10 before | Expand all | Expand 10 after
5603 DCHECK_EQ(*dep, LookupWeakObjectToCodeDependency(obj)); 5603 DCHECK_EQ(*dep, LookupWeakObjectToCodeDependency(obj));
5604 } 5604 }
5605 5605
5606 5606
5607 DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) { 5607 DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<HeapObject> obj) {
5608 Object* dep = weak_object_to_code_table()->Lookup(obj); 5608 Object* dep = weak_object_to_code_table()->Lookup(obj);
5609 if (dep->IsDependentCode()) return DependentCode::cast(dep); 5609 if (dep->IsDependentCode()) return DependentCode::cast(dep);
5610 return DependentCode::cast(empty_fixed_array()); 5610 return DependentCode::cast(empty_fixed_array());
5611 } 5611 }
5612 5612
5613 void Heap::CompactWeakFixedArrays() {
5614 // Find known WeakFixedArrays and compact them.
5615 i::HeapIterator iterator(this);
5616 for (i::HeapObject* o = iterator.next(); o != NULL; o = iterator.next()) {
5617 if (o->IsPrototypeInfo()) {
5618 i::Object* prototype_users = i::PrototypeInfo::cast(o)->prototype_users();
5619 if (prototype_users->IsWeakFixedArray()) {
5620 i::WeakFixedArray* array = i::WeakFixedArray::cast(prototype_users);
5621 array->Compact<i::JSObject::PrototypeRegistryCompactionCallback>();
5622 }
5623 } else if (o->IsScript()) {
5624 i::Object* shared_list = i::Script::cast(o)->shared_function_infos();
5625 if (shared_list->IsWeakFixedArray()) {
5626 i::WeakFixedArray* array = i::WeakFixedArray::cast(shared_list);
5627 array->Compact<i::WeakFixedArray::NullCallback>();
5628 }
5629 }
5630 }
5631 }
5613 5632
5614 void Heap::AddRetainedMap(Handle<Map> map) { 5633 void Heap::AddRetainedMap(Handle<Map> map) {
5615 Handle<WeakCell> cell = Map::WeakCellForMap(map); 5634 Handle<WeakCell> cell = Map::WeakCellForMap(map);
5616 Handle<ArrayList> array(retained_maps(), isolate()); 5635 Handle<ArrayList> array(retained_maps(), isolate());
5617 if (array->IsFull()) { 5636 if (array->IsFull()) {
5618 CompactRetainedMaps(*array); 5637 CompactRetainedMaps(*array);
5619 } 5638 }
5620 array = ArrayList::Add( 5639 array = ArrayList::Add(
5621 array, cell, handle(Smi::FromInt(FLAG_retain_maps_for_n_gc), isolate()), 5640 array, cell, handle(Smi::FromInt(FLAG_retain_maps_for_n_gc), isolate()),
5622 ArrayList::kReloadLengthAfterAllocation); 5641 ArrayList::kReloadLengthAfterAllocation);
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
6407 } 6426 }
6408 6427
6409 6428
6410 // static 6429 // static
6411 int Heap::GetStaticVisitorIdForMap(Map* map) { 6430 int Heap::GetStaticVisitorIdForMap(Map* map) {
6412 return StaticVisitorBase::GetVisitorId(map); 6431 return StaticVisitorBase::GetVisitorId(map);
6413 } 6432 }
6414 6433
6415 } // namespace internal 6434 } // namespace internal
6416 } // namespace v8 6435 } // namespace v8
OLDNEW
« include/v8.h ('K') | « src/heap/heap.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698