Index: src/regexp/jsregexp.cc |
diff --git a/src/regexp/jsregexp.cc b/src/regexp/jsregexp.cc |
index 9e1941fc0a9e70414129822316abbe8e79d5fdbe..8b21459059aa76a47dd9cfe3ca369a9d317be6cb 100644 |
--- a/src/regexp/jsregexp.cc |
+++ b/src/regexp/jsregexp.cc |
@@ -451,7 +451,7 @@ void RegExpImpl::IrregexpInitialize(Handle<JSRegExp> re, |
int RegExpImpl::IrregexpPrepare(Handle<JSRegExp> regexp, |
Handle<String> subject) { |
- subject = String::Flatten(subject); |
+ DCHECK(subject->IsFlat()); |
// Check representation of the underlying storage. |
bool is_one_byte = subject->IsOneByteRepresentationUnderneath(); |
@@ -565,6 +565,8 @@ MaybeHandle<Object> RegExpImpl::IrregexpExec( |
Isolate* isolate = regexp->GetIsolate(); |
DCHECK_EQ(regexp->TypeTag(), JSRegExp::IRREGEXP); |
+ subject = String::Flatten(subject); |
+ |
// Prepare space for the return values. |
#if defined(V8_INTERPRETED_REGEXP) && defined(DEBUG) |
if (FLAG_trace_regexp_bytecodes) { |