Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 9eaf25f625015cebff56fb96f9c29846a1514d35..495edceedddf1476a7e23fbb68dedbe4058306a7 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -16111,7 +16111,7 @@ inline Handle<StringType> WriteEscapedRegExpSource(Handle<String> source, |
MaybeHandle<String> EscapeRegExpSource(Isolate* isolate, |
Handle<String> source) { |
- String::Flatten(source); |
+ DCHECK(source->IsFlat()); |
if (source->length() == 0) return isolate->factory()->query_colon_string(); |
bool one_byte = source->IsOneByteRepresentationUnderneath(); |
int escapes = one_byte ? CountRequiredEscapes<uint8_t>(source) |
@@ -16160,6 +16160,8 @@ MaybeHandle<JSRegExp> JSRegExp::Initialize(Handle<JSRegExp> regexp, |
// suggested by ECMA-262, 5th, section 15.10.4.1. |
if (source->length() == 0) source = factory->query_colon_string(); |
+ source = String::Flatten(source); |
+ |
Handle<String> escaped_source; |
ASSIGN_RETURN_ON_EXCEPTION(isolate, escaped_source, |
EscapeRegExpSource(isolate, source), JSRegExp); |