diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-07-03 08:36:33 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-07-03 08:37:05 +0200 |
commit | 2072925f121fe8785dfd046eba24f8d18c59ae75 (patch) | |
tree | 70dcc90532a9f4da485453c6f40bc93235196071 /deps/v8/src/jsregexp.cc | |
parent | 94cd83ef34176f4e451e91c92d3b2596032b8e96 (diff) | |
download | node-new-2072925f121fe8785dfd046eba24f8d18c59ae75.tar.gz |
Upgrade V8 to 2.2.21
Diffstat (limited to 'deps/v8/src/jsregexp.cc')
-rw-r--r-- | deps/v8/src/jsregexp.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/deps/v8/src/jsregexp.cc b/deps/v8/src/jsregexp.cc index 3e9c5eab9a..9f98782bbc 100644 --- a/deps/v8/src/jsregexp.cc +++ b/deps/v8/src/jsregexp.cc @@ -356,7 +356,16 @@ int RegExpImpl::IrregexpPrepare(Handle<JSRegExp> regexp, if (!subject->IsFlat()) { FlattenString(subject); } - bool is_ascii = subject->IsAsciiRepresentation(); + // Check the asciiness of the underlying storage. + bool is_ascii; + { + AssertNoAllocation no_gc; + String* sequential_string = *subject; + if (subject->IsConsString()) { + sequential_string = ConsString::cast(*subject)->first(); + } + is_ascii = sequential_string->IsAsciiRepresentation(); + } if (!EnsureCompiledIrregexp(regexp, is_ascii)) { return -1; } @@ -381,6 +390,11 @@ RegExpImpl::IrregexpResult RegExpImpl::IrregexpExecOnce(Handle<JSRegExp> regexp, ASSERT(index <= subject->length()); ASSERT(subject->IsFlat()); + // A flat ASCII string might have a two-byte first part. + if (subject->IsConsString()) { + subject = Handle<String>(ConsString::cast(*subject)->first()); + } + #ifndef V8_INTERPRETED_REGEXP ASSERT(output.length() >= (IrregexpNumberOfCaptures(*irregexp) + 1) * 2); @@ -407,7 +421,7 @@ RegExpImpl::IrregexpResult RegExpImpl::IrregexpExecOnce(Handle<JSRegExp> regexp, // If result is RETRY, the string has changed representation, and we // must restart from scratch. // In this case, it means we must make sure we are prepared to handle - // the, potentially, differen subject (the string can switch between + // the, potentially, different subject (the string can switch between // being internal and external, and even between being ASCII and UC16, // but the characters are always the same). IrregexpPrepare(regexp, subject); |