Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index de8c6fddc4231e5579a8b2afa6dd1a6276c478e9..c638397338c7b6b55a43eca28d69c74fb61d3506 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -2966,35 +2966,30 @@ int Runtime::StringMatch(Isolate* isolate, |
if (!pat->IsFlat()) FlattenString(pat); |
AssertNoAllocation no_heap_allocation; // ensure vectors stay valid |
- // Extract flattened substrings of cons strings before determining asciiness. |
- String* seq_sub = *sub; |
- if (seq_sub->IsConsString()) seq_sub = ConsString::cast(seq_sub)->first(); |
- String* seq_pat = *pat; |
- if (seq_pat->IsConsString()) seq_pat = ConsString::cast(seq_pat)->first(); |
// dispatch on type of strings |
- if (seq_pat->IsAsciiRepresentation()) { |
- Vector<const char> pat_vector = seq_pat->ToAsciiVector(); |
- if (seq_sub->IsAsciiRepresentation()) { |
+ if (pat->IsAsciiRepresentationUnderneath()) { |
+ Vector<const char> pat_vector = pat->ToAsciiVector(); |
+ if (sub->IsAsciiRepresentationUnderneath()) { |
return SearchString(isolate, |
- seq_sub->ToAsciiVector(), |
+ sub->ToAsciiVector(), |
pat_vector, |
start_index); |
} |
return SearchString(isolate, |
- seq_sub->ToUC16Vector(), |
+ sub->ToUC16Vector(), |
pat_vector, |
start_index); |
} |
- Vector<const uc16> pat_vector = seq_pat->ToUC16Vector(); |
- if (seq_sub->IsAsciiRepresentation()) { |
+ Vector<const uc16> pat_vector = pat->ToUC16Vector(); |
+ if (sub->IsAsciiRepresentationUnderneath()) { |
return SearchString(isolate, |
- seq_sub->ToAsciiVector(), |
+ sub->ToAsciiVector(), |
pat_vector, |
start_index); |
} |
return SearchString(isolate, |
- seq_sub->ToUC16Vector(), |
+ sub->ToUC16Vector(), |
pat_vector, |
start_index); |
} |
@@ -3579,7 +3574,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExecMultiple) { |
HandleScope handles(isolate); |
CONVERT_ARG_CHECKED(String, subject, 1); |
- if (!subject->IsFlat()) { FlattenString(subject); } |
+ if (!subject->IsFlat()) FlattenString(subject); |
CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); |
CONVERT_ARG_CHECKED(JSArray, last_match_info, 2); |
CONVERT_ARG_CHECKED(JSArray, result_array, 3); |