Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: src/runtime.cc

Issue 7477045: Tentative implementation of string slices (hidden under the flag --string-slices). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Some more suggested changes. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698