[regexp] Remove code flushing support
Regexp code flushing support has been unintentionally disabled for quite a while without any signals on our benchmarks. This CL completely removes support. BUG=v8:6569 Change-Id: Ic018a115c38387ff5610b34d3c09cb360e30ad3f Reviewed-on: https://chromium-review.googlesource.com/559331 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#46401}
This commit is contained in:
parent
23c2edd42b
commit
e81af43045
@ -377,10 +377,22 @@ Node* RegExpBuiltinsAssembler::RegExpExecInternal(Node* const context,
|
||||
}
|
||||
|
||||
// Check that the irregexp code has been generated for the actual string
|
||||
// encoding. If it has, the field contains a code object otherwise it contains
|
||||
// smi (code flushing support).
|
||||
// encoding. If it has, the field contains a code object; and otherwise it
|
||||
// contains the uninitialized sentinel as a smi.
|
||||
|
||||
Node* const code = var_code.value();
|
||||
#ifdef DEBUG
|
||||
{
|
||||
Label next(this);
|
||||
GotoIfNot(TaggedIsSmi(code), &next);
|
||||
|
||||
CSA_ASSERT(this,
|
||||
SmiEqual(code, SmiConstant(JSRegExp::kUninitializedValue)));
|
||||
Goto(&next);
|
||||
|
||||
BIND(&next);
|
||||
}
|
||||
#endif
|
||||
GotoIf(TaggedIsSmi(code), &runtime);
|
||||
CSA_ASSERT(this, HasInstanceType(code, CODE_TYPE));
|
||||
|
||||
|
@ -2763,8 +2763,6 @@ void Factory::SetRegExpIrregexpData(Handle<JSRegExp> regexp,
|
||||
store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags));
|
||||
store->set(JSRegExp::kIrregexpLatin1CodeIndex, uninitialized);
|
||||
store->set(JSRegExp::kIrregexpUC16CodeIndex, uninitialized);
|
||||
store->set(JSRegExp::kIrregexpLatin1CodeSavedIndex, uninitialized);
|
||||
store->set(JSRegExp::kIrregexpUC16CodeSavedIndex, uninitialized);
|
||||
store->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::kZero);
|
||||
store->set(JSRegExp::kIrregexpCaptureCountIndex,
|
||||
Smi::FromInt(capture_count));
|
||||
|
@ -1095,23 +1095,16 @@ void JSRegExp::JSRegExpVerify() {
|
||||
|
||||
FixedArray* arr = FixedArray::cast(data());
|
||||
Object* one_byte_data = arr->get(JSRegExp::kIrregexpLatin1CodeIndex);
|
||||
// Smi : Not compiled yet (-1) or code prepared for flushing.
|
||||
// JSObject: Compilation error.
|
||||
// Smi : Not compiled yet (-1).
|
||||
// Code/ByteArray: Compiled code.
|
||||
CHECK(
|
||||
one_byte_data->IsSmi() ||
|
||||
(one_byte_data->IsSmi() && Smi::cast(one_byte_data)->value() ==
|
||||
JSRegExp::kUninitializedValue) ||
|
||||
(is_native ? one_byte_data->IsCode() : one_byte_data->IsByteArray()));
|
||||
Object* uc16_data = arr->get(JSRegExp::kIrregexpUC16CodeIndex);
|
||||
CHECK(uc16_data->IsSmi() ||
|
||||
(is_native ? uc16_data->IsCode() : uc16_data->IsByteArray()));
|
||||
|
||||
Object* one_byte_saved =
|
||||
arr->get(JSRegExp::kIrregexpLatin1CodeSavedIndex);
|
||||
CHECK(one_byte_saved->IsSmi() || one_byte_saved->IsString() ||
|
||||
one_byte_saved->IsCode());
|
||||
Object* uc16_saved = arr->get(JSRegExp::kIrregexpUC16CodeSavedIndex);
|
||||
CHECK(uc16_saved->IsSmi() || uc16_saved->IsString() ||
|
||||
uc16_saved->IsCode());
|
||||
CHECK((uc16_data->IsSmi() &&
|
||||
Smi::cast(uc16_data)->value() == JSRegExp::kUninitializedValue) ||
|
||||
(is_native ? uc16_data->IsCode() : uc16_data->IsByteArray()));
|
||||
|
||||
CHECK(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi());
|
||||
CHECK(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi());
|
||||
|
@ -5652,14 +5652,6 @@ class JSRegExp: public JSObject {
|
||||
}
|
||||
}
|
||||
|
||||
static int saved_code_index(bool is_latin1) {
|
||||
if (is_latin1) {
|
||||
return kIrregexpLatin1CodeSavedIndex;
|
||||
} else {
|
||||
return kIrregexpUC16CodeSavedIndex;
|
||||
}
|
||||
}
|
||||
|
||||
DECL_CAST(JSRegExp)
|
||||
|
||||
// Dispatched behavior.
|
||||
@ -5691,22 +5683,14 @@ class JSRegExp: public JSObject {
|
||||
// fails, this fields hold an exception object that should be
|
||||
// thrown if the regexp is used again.
|
||||
static const int kIrregexpUC16CodeIndex = kDataIndex + 1;
|
||||
|
||||
// Saved instance of Irregexp compiled code or bytecode for Latin1 that
|
||||
// is a potential candidate for flushing.
|
||||
static const int kIrregexpLatin1CodeSavedIndex = kDataIndex + 2;
|
||||
// Saved instance of Irregexp compiled code or bytecode for UC16 that is
|
||||
// a potential candidate for flushing.
|
||||
static const int kIrregexpUC16CodeSavedIndex = kDataIndex + 3;
|
||||
|
||||
// Maximal number of registers used by either Latin1 or UC16.
|
||||
// Only used to check that there is enough stack space
|
||||
static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 4;
|
||||
static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 2;
|
||||
// Number of captures in the compiled regexp.
|
||||
static const int kIrregexpCaptureCountIndex = kDataIndex + 5;
|
||||
static const int kIrregexpCaptureCountIndex = kDataIndex + 3;
|
||||
// Maps names of named capture groups (at indices 2i) to their corresponding
|
||||
// (1-based) capture group indices (at indices 2i + 1).
|
||||
static const int kIrregexpCaptureNameMapIndex = kDataIndex + 6;
|
||||
static const int kIrregexpCaptureNameMapIndex = kDataIndex + 4;
|
||||
|
||||
static const int kIrregexpDataSize = kIrregexpCaptureNameMapIndex + 1;
|
||||
|
||||
@ -5716,15 +5700,6 @@ class JSRegExp: public JSObject {
|
||||
|
||||
// The uninitialized value for a regexp code object.
|
||||
static const int kUninitializedValue = -1;
|
||||
|
||||
// The compilation error value for the regexp code object. The real error
|
||||
// object is in the saved code field.
|
||||
static const int kCompilationErrorValue = -2;
|
||||
|
||||
// When we store the sweep generation at which we moved the code from the
|
||||
// code index to the saved code index we mask it of to be in the [0:255]
|
||||
// range.
|
||||
static const int kCodeAgeMask = 0xff;
|
||||
};
|
||||
|
||||
DEFINE_OPERATORS_FOR_FLAGS(JSRegExp::Flags)
|
||||
|
@ -330,28 +330,14 @@ bool RegExpImpl::CompileIrregexp(Handle<JSRegExp> re,
|
||||
Isolate* isolate = re->GetIsolate();
|
||||
Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
PostponeInterruptsScope postpone(isolate);
|
||||
// If we had a compilation error the last time this is saved at the
|
||||
// saved code index.
|
||||
#ifdef DEBUG
|
||||
Object* entry = re->DataAt(JSRegExp::code_index(is_one_byte));
|
||||
// When arriving here entry can only be a smi, either representing an
|
||||
// uncompiled regexp, a previous compilation error, or code that has
|
||||
// been flushed.
|
||||
// When arriving here entry can only be a smi representing an uncompiled
|
||||
// regexp.
|
||||
DCHECK(entry->IsSmi());
|
||||
int entry_value = Smi::cast(entry)->value();
|
||||
DCHECK(entry_value == JSRegExp::kUninitializedValue ||
|
||||
entry_value == JSRegExp::kCompilationErrorValue ||
|
||||
(entry_value < JSRegExp::kCodeAgeMask && entry_value >= 0));
|
||||
|
||||
if (entry_value == JSRegExp::kCompilationErrorValue) {
|
||||
// A previous compilation failed and threw an error which we store in
|
||||
// the saved code index (we store the error message, not the actual
|
||||
// error). Recreate the error object and throw it.
|
||||
Object* error_string = re->DataAt(JSRegExp::saved_code_index(is_one_byte));
|
||||
DCHECK(error_string->IsString());
|
||||
Handle<String> error_message(String::cast(error_string));
|
||||
ThrowRegExpException(re, error_message);
|
||||
return false;
|
||||
}
|
||||
DCHECK_EQ(JSRegExp::kUninitializedValue, entry_value);
|
||||
#endif
|
||||
|
||||
JSRegExp::Flags flags = re->GetFlags();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user