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

Unified Diff: src/regexp/regexp-macro-assembler.cc

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: forgot one Created 4 years 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/regexp-macro-assembler.cc
diff --git a/src/regexp/regexp-macro-assembler.cc b/src/regexp/regexp-macro-assembler.cc
index 0a7f5c1b9e295727ac672cc008adee0dbfc41ed6..025ffb566025f09121a0253241f1ac30b81ae8a5 100644
--- a/src/regexp/regexp-macro-assembler.cc
+++ b/src/regexp/regexp-macro-assembler.cc
@@ -133,6 +133,8 @@ const byte* NativeRegExpMacroAssembler::StringCharacterPosition(
} else if (subject->IsSlicedString()) {
start_index += SlicedString::cast(subject)->offset();
subject = SlicedString::cast(subject)->parent();
+ } else if (subject->IsThinString()) {
+ subject = ThinString::cast(subject)->actual();
}
DCHECK(start_index >= 0);
DCHECK(start_index <= subject->length());
@@ -238,6 +240,8 @@ NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Match(
SlicedString* slice = SlicedString::cast(subject_ptr);
subject_ptr = slice->parent();
slice_offset = slice->offset();
+ } else if (StringShape(subject_ptr).IsThin()) {
+ subject_ptr = ThinString::cast(subject_ptr)->actual();
}
// Ensure that an underlying string has the same representation.
bool is_one_byte = subject_ptr->IsOneByteRepresentation();

Powered by Google App Engine
This is Rietveld 408576698