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

Unified Diff: src/regexp-macro-assembler.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: Created 9 years, 5 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/regexp-macro-assembler.cc
diff --git a/src/regexp-macro-assembler.cc b/src/regexp-macro-assembler.cc
index 55782431bec353820f868b71b94b4d4cb0a661e6..a48cb0c54681eee6be6ed188c1fef51bc3586680 100644
--- a/src/regexp-macro-assembler.cc
+++ b/src/regexp-macro-assembler.cc
@@ -74,6 +74,12 @@ bool NativeRegExpMacroAssembler::CanReadUnaligned() {
const byte* NativeRegExpMacroAssembler::StringCharacterPosition(
String* subject,
int start_index) {
+ // Unpack sliced string.
+ if (subject->IsSlicedString()) {
+ SlicedString* slice = SlicedString::cast(subject);
+ subject = slice->parent();
+ start_index += slice->offset();
+ }
// Not just flat, but ultra flat.
ASSERT(subject->IsExternalString() || subject->IsSeqString());
ASSERT(start_index >= 0);
@@ -130,7 +136,9 @@ NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Match(
}
// Ensure that an underlying string has the same ascii-ness.
bool is_ascii = subject_ptr->IsAsciiRepresentation();
- ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString());
+ ASSERT(subject_ptr->IsExternalString() ||
+ subject_ptr->IsSeqString() ||
+ subject_ptr->IsSlicedString());
// String is now either Sequential or External
int char_size_shift = is_ascii ? 0 : 1;
int char_length = end_offset - start_offset;

Powered by Google App Engine
This is Rietveld 408576698