Commit 7b4e940a authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

Remove flushing/aging of regexp code

Did only work with full MCs. Since the majority of GCs is now
incremental and will be concurrent in future this becomes obsolete.

Bug: v8:6569
Change-Id: I28280a71dd4e779742dd4d1b3dd01087cd4f8fe0
Reviewed-on: https://chromium-review.googlesource.com/558983Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46399}
parent e85a8fd1
......@@ -648,8 +648,6 @@ DEFINE_BOOL(trace_fragmentation_verbose, false,
DEFINE_BOOL(trace_evacuation, false, "report evacuation statistics")
DEFINE_BOOL(trace_mutator_utilization, false,
"print mutator utilization, allocation speed, gc speed")
DEFINE_BOOL(flush_regexp_code, true,
"flush regexp code that we expect not to use again")
DEFINE_BOOL(age_code, true, "track un-executed functions to age code")
DEFINE_BOOL(incremental_marking, true, "use incremental marking")
DEFINE_BOOL(incremental_marking_wrappers, true,
......
......@@ -1079,20 +1079,7 @@ class MarkCompactMarkingVisitor final
collector_->MarkObject(target_object);
}
V8_INLINE int VisitJSRegExp(Map* map, JSRegExp* re) {
if (!FLAG_flush_regexp_code) {
return VisitJSObject(map, re);
}
// Flush code or set age on both one byte and two byte code.
UpdateRegExpCodeAgeAndFlush(re, true);
UpdateRegExpCodeAgeAndFlush(re, false);
// Visit the fields of the RegExp, including the updated FixedArray.
return VisitJSObject(map, re);
}
protected:
static const int kRegExpCodeThreshold = 5;
// Visit all unmarked objects pointed to by [start, end).
// Returns false if the operation fails (lack of stack space).
V8_INLINE bool VisitUnmarkedObjects(HeapObject* host, Object** start,
......@@ -1123,54 +1110,6 @@ class MarkCompactMarkingVisitor final
Visit(map, obj);
}
}
V8_INLINE void UpdateRegExpCodeAgeAndFlush(JSRegExp* re, bool is_one_byte) {
// Make sure that the fixed array is in fact initialized on the RegExp.
// We could potentially trigger a GC when initializing the RegExp.
if (HeapObject::cast(re->data())->map()->instance_type() !=
FIXED_ARRAY_TYPE)
return;
// Make sure this is a RegExp that actually contains code.
if (re->TypeTag() != JSRegExp::IRREGEXP) return;
Object* code = re->DataAt(JSRegExp::code_index(is_one_byte));
if (!code->IsSmi() &&
HeapObject::cast(code)->map()->instance_type() == CODE_TYPE) {
// Save a copy that can be reinstated if we need the code again.
re->SetDataAt(JSRegExp::saved_code_index(is_one_byte), code);
// Saving a copy might create a pointer into compaction candidate
// that was not observed by marker. This might happen if JSRegExp data
// was marked through the compilation cache before marker reached JSRegExp
// object.
FixedArray* data = FixedArray::cast(re->data());
if (ObjectMarking::IsBlackOrGrey(data, MarkingState::Internal(data))) {
Object** slot =
data->data_start() + JSRegExp::saved_code_index(is_one_byte);
collector_->RecordSlot(data, slot, code);
}
// Set a number in the 0-255 range to guarantee no smi overflow.
re->SetDataAt(JSRegExp::code_index(is_one_byte),
Smi::FromInt(heap_->ms_count() & 0xff));
} else if (code->IsSmi()) {
int value = Smi::cast(code)->value();
// The regexp has not been compiled yet or there was a compilation error.
if (value == JSRegExp::kUninitializedValue ||
value == JSRegExp::kCompilationErrorValue) {
return;
}
// Check if we should flush now.
if (value == ((heap_->ms_count() - kRegExpCodeThreshold) & 0xff)) {
re->SetDataAt(JSRegExp::code_index(is_one_byte),
Smi::FromInt(JSRegExp::kUninitializedValue));
re->SetDataAt(JSRegExp::saved_code_index(is_one_byte),
Smi::FromInt(JSRegExp::kUninitializedValue));
}
}
}
};
void MinorMarkCompactCollector::CleanupSweepToIteratePages() {
......
......@@ -319,15 +319,6 @@ bool RegExpImpl::EnsureCompiledIrregexp(Handle<JSRegExp> re,
#else // V8_INTERPRETED_REGEXP (RegExp native code)
if (compiled_code->IsCode()) return true;
#endif
// We could potentially have marked this as flushable, but have kept
// a saved version if we did not flush it yet.
Object* saved_code = re->DataAt(JSRegExp::saved_code_index(is_one_byte));
if (saved_code->IsCode()) {
// Reinstate the code in the original place.
re->SetDataAt(JSRegExp::code_index(is_one_byte), saved_code);
DCHECK(compiled_code->IsSmi());
return true;
}
return CompileIrregexp(re, sample_subject, is_one_byte);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment