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

Side by Side Diff: src/objects.cc

Issue 2310143002: [heap] Introduce enum of garbage collection reasons. (Closed)
Patch Set: rebase Created 4 years, 3 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
« no previous file with comments | « src/isolate.cc ('k') | src/profiler/heap-snapshot-generator.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 18107 matching lines...) Expand 10 before | Expand all | Expand 10 after
18118 table->Rehash(isolate->factory()->undefined_value()); 18118 table->Rehash(isolate->factory()->undefined_value());
18119 } 18119 }
18120 // If we're out of luck, we didn't get a GC recently, and so rehashing 18120 // If we're out of luck, we didn't get a GC recently, and so rehashing
18121 // isn't enough to avoid a crash. 18121 // isn't enough to avoid a crash.
18122 if (!table->HasSufficientCapacityToAdd(1)) { 18122 if (!table->HasSufficientCapacityToAdd(1)) {
18123 int nof = table->NumberOfElements() + 1; 18123 int nof = table->NumberOfElements() + 1;
18124 int capacity = ObjectHashTable::ComputeCapacity(nof * 2); 18124 int capacity = ObjectHashTable::ComputeCapacity(nof * 2);
18125 if (capacity > ObjectHashTable::kMaxCapacity) { 18125 if (capacity > ObjectHashTable::kMaxCapacity) {
18126 for (size_t i = 0; i < 2; ++i) { 18126 for (size_t i = 0; i < 2; ++i) {
18127 isolate->heap()->CollectAllGarbage( 18127 isolate->heap()->CollectAllGarbage(
18128 Heap::kFinalizeIncrementalMarkingMask, "full object hash table"); 18128 Heap::kFinalizeIncrementalMarkingMask,
18129 GarbageCollectionReason::kFullHashtable);
18129 } 18130 }
18130 table->Rehash(isolate->factory()->undefined_value()); 18131 table->Rehash(isolate->factory()->undefined_value());
18131 } 18132 }
18132 } 18133 }
18133 18134
18134 // Check whether the hash table should be extended. 18135 // Check whether the hash table should be extended.
18135 table = EnsureCapacity(table, 1, key); 18136 table = EnsureCapacity(table, 1, key);
18136 table->AddEntry(table->FindInsertionEntry(hash), *key, *value); 18137 table->AddEntry(table->FindInsertionEntry(hash), *key, *value);
18137 return table; 18138 return table;
18138 } 18139 }
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
19417 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, 19418 for (PrototypeIterator iter(isolate, this, kStartAtReceiver,
19418 PrototypeIterator::END_AT_NULL); 19419 PrototypeIterator::END_AT_NULL);
19419 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { 19420 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) {
19420 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; 19421 if (iter.GetCurrent<Object>()->IsJSProxy()) return true;
19421 } 19422 }
19422 return false; 19423 return false;
19423 } 19424 }
19424 19425
19425 } // namespace internal 19426 } // namespace internal
19426 } // namespace v8 19427 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/profiler/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698