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

Unified Diff: src/heap/scavenger.cc

Issue 2007563004: Revert of [heap] Pass a force_promotion flag to the evacuation routine in the scavenger. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/scavenger.h ('k') | src/heap/scavenger-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/scavenger.cc
diff --git a/src/heap/scavenger.cc b/src/heap/scavenger.cc
index 4fa30e2650890945097555663006d63f86040512..51968c3990b23f1916a773917b17d801052071f8 100644
--- a/src/heap/scavenger.cc
+++ b/src/heap/scavenger.cc
@@ -200,16 +200,15 @@
return false;
}
+
template <ObjectContents object_contents, AllocationAlignment alignment>
static inline void EvacuateObject(Map* map, HeapObject** slot,
- HeapObject* object, int object_size,
- PromotionMode promotion_mode) {
+ HeapObject* object, int object_size) {
SLOW_DCHECK(object_size <= Page::kAllocatableMemory);
SLOW_DCHECK(object->Size() == object_size);
Heap* heap = map->GetHeap();
- if (promotion_mode != FORCE_PROMOTION &&
- !heap->ShouldBePromoted(object->address(), object_size)) {
+ if (!heap->ShouldBePromoted(object->address(), object_size)) {
// A semi-space copy may fail due to fragmentation. In that case, we
// try to promote the object.
if (SemiSpaceCopyObject<alignment>(map, slot, object, object_size)) {
@@ -221,20 +220,17 @@
object_size)) {
return;
}
- if (promotion_mode == FORCE_PROMOTION) {
- FatalProcessOutOfMemory("Scavenger: forced promotion\n");
- }
+
// If promotion failed, we try to copy the object to the other semi-space
if (SemiSpaceCopyObject<alignment>(map, slot, object, object_size)) return;
FatalProcessOutOfMemory("Scavenger: semi-space copy\n");
}
+
static inline void EvacuateJSFunction(Map* map, HeapObject** slot,
- HeapObject* object,
- PromotionMode promotion_mode) {
- ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object,
- promotion_mode);
+ HeapObject* object) {
+ ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object);
if (marks_handling == IGNORE_MARKS) return;
@@ -256,76 +252,71 @@
}
}
+
static inline void EvacuateFixedArray(Map* map, HeapObject** slot,
- HeapObject* object,
- PromotionMode promotion_mode) {
+ HeapObject* object) {
int length = reinterpret_cast<FixedArray*>(object)->synchronized_length();
int object_size = FixedArray::SizeFor(length);
- EvacuateObject<POINTER_OBJECT, kWordAligned>(map, slot, object, object_size,
- promotion_mode);
- }
+ EvacuateObject<POINTER_OBJECT, kWordAligned>(map, slot, object,
+ object_size);
+ }
+
static inline void EvacuateFixedDoubleArray(Map* map, HeapObject** slot,
- HeapObject* object,
- PromotionMode promotion_mode) {
+ HeapObject* object) {
int length = reinterpret_cast<FixedDoubleArray*>(object)->length();
int object_size = FixedDoubleArray::SizeFor(length);
- EvacuateObject<DATA_OBJECT, kDoubleAligned>(map, slot, object, object_size,
- promotion_mode);
- }
+ EvacuateObject<DATA_OBJECT, kDoubleAligned>(map, slot, object, object_size);
+ }
+
static inline void EvacuateFixedTypedArray(Map* map, HeapObject** slot,
- HeapObject* object,
- PromotionMode promotion_mode) {
+ HeapObject* object) {
int object_size = reinterpret_cast<FixedTypedArrayBase*>(object)->size();
- EvacuateObject<POINTER_OBJECT, kWordAligned>(map, slot, object, object_size,
- promotion_mode);
- }
+ EvacuateObject<POINTER_OBJECT, kWordAligned>(map, slot, object,
+ object_size);
+ }
+
static inline void EvacuateFixedFloat64Array(Map* map, HeapObject** slot,
- HeapObject* object,
- PromotionMode promotion_mode) {
+ HeapObject* object) {
int object_size = reinterpret_cast<FixedFloat64Array*>(object)->size();
EvacuateObject<POINTER_OBJECT, kDoubleAligned>(map, slot, object,
- object_size, promotion_mode);
- }
+ object_size);
+ }
+
static inline void EvacuateJSArrayBuffer(Map* map, HeapObject** slot,
- HeapObject* object,
- PromotionMode promotion_mode) {
- ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object,
- promotion_mode);
- }
+ HeapObject* object) {
+ ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object);
+ }
+
static inline void EvacuateByteArray(Map* map, HeapObject** slot,
- HeapObject* object,
- PromotionMode promotion_mode) {
+ HeapObject* object) {
int object_size = reinterpret_cast<ByteArray*>(object)->ByteArraySize();
- EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size,
- promotion_mode);
- }
+ EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size);
+ }
+
static inline void EvacuateSeqOneByteString(Map* map, HeapObject** slot,
- HeapObject* object,
- PromotionMode promotion_mode) {
+ HeapObject* object) {
int object_size = SeqOneByteString::cast(object)
->SeqOneByteStringSize(map->instance_type());
- EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size,
- promotion_mode);
- }
+ EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size);
+ }
+
static inline void EvacuateSeqTwoByteString(Map* map, HeapObject** slot,
- HeapObject* object,
- PromotionMode promotion_mode) {
+ HeapObject* object) {
int object_size = SeqTwoByteString::cast(object)
->SeqTwoByteStringSize(map->instance_type());
- EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size,
- promotion_mode);
- }
+ EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size);
+ }
+
static inline void EvacuateShortcutCandidate(Map* map, HeapObject** slot,
- HeapObject* object,
- PromotionMode promotion_mode) {
+ HeapObject* object) {
DCHECK(IsShortcutCandidate(map->instance_type()));
Heap* heap = map->GetHeap();
@@ -351,14 +342,14 @@
return;
}
- Scavenger::ScavengeObjectSlow(slot, first, promotion_mode);
+ Scavenger::ScavengeObjectSlow(slot, first);
object->set_map_word(MapWord::FromForwardingAddress(*slot));
return;
}
int object_size = ConsString::kSize;
- EvacuateObject<POINTER_OBJECT, kWordAligned>(map, slot, object, object_size,
- promotion_mode);
+ EvacuateObject<POINTER_OBJECT, kWordAligned>(map, slot, object,
+ object_size);
}
template <ObjectContents object_contents>
@@ -366,17 +357,15 @@
public:
template <int object_size>
static inline void VisitSpecialized(Map* map, HeapObject** slot,
- HeapObject* object,
- PromotionMode promotion_mode) {
- EvacuateObject<object_contents, kWordAligned>(
- map, slot, object, object_size, promotion_mode);
- }
-
- static inline void Visit(Map* map, HeapObject** slot, HeapObject* object,
- PromotionMode promotion_mode) {
+ HeapObject* object) {
+ EvacuateObject<object_contents, kWordAligned>(map, slot, object,
+ object_size);
+ }
+
+ static inline void Visit(Map* map, HeapObject** slot, HeapObject* object) {
int object_size = map->instance_size();
- EvacuateObject<object_contents, kWordAligned>(
- map, slot, object, object_size, promotion_mode);
+ EvacuateObject<object_contents, kWordAligned>(map, slot, object,
+ object_size);
}
};
@@ -402,15 +391,13 @@
// static
-void Scavenger::ScavengeObjectSlow(HeapObject** p, HeapObject* object,
- PromotionMode promotion_mode) {
+void Scavenger::ScavengeObjectSlow(HeapObject** p, HeapObject* object) {
SLOW_DCHECK(object->GetIsolate()->heap()->InFromSpace(object));
MapWord first_word = object->map_word();
SLOW_DCHECK(!first_word.IsForwardingAddress());
Map* map = first_word.ToMap();
Scavenger* scavenger = map->GetHeap()->scavenge_collector_;
- scavenger->scavenging_visitors_table_.GetVisitor(map)(map, p, object,
- promotion_mode);
+ scavenger->scavenging_visitors_table_.GetVisitor(map)(map, p, object);
}
« no previous file with comments | « src/heap/scavenger.h ('k') | src/heap/scavenger-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698