Version 2.1.9
Added API support for reattaching a global object to a context.
Extended debugger API with access to the internal debugger context.
Fixed Chromium crashes (issues http://crbug.com/39128 and http://crbug.com/39160)
git-svn-id: http://v8.googlecode.com/svn/trunk@4280 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/jsregexp.cc b/src/jsregexp.cc
index 5a0a482..dfd9ef6 100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -4987,7 +4987,9 @@
case AFTER_WORD_CHARACTER: {
ASSERT_NOT_NULL(on_success());
budget = on_success()->ComputeFirstCharacterSet(budget);
- set_first_character_set(on_success()->first_character_set());
+ if (budget >= 0) {
+ set_first_character_set(on_success()->first_character_set());
+ }
break;
}
}
@@ -5013,6 +5015,10 @@
int BackReferenceNode::ComputeFirstCharacterSet(int budget) {
// We don't know anything about the first character of a backreference
// at this point.
+ // The potential first characters are the first characters of the capture,
+ // and the first characters of the on_success node, depending on whether the
+ // capture can be empty and whether it is known to be participating or known
+ // not to be.
return kComputeFirstCharacterSetFail;
}
@@ -5032,8 +5038,11 @@
} else {
ASSERT(text.type == TextElement::CHAR_CLASS);
RegExpCharacterClass* char_class = text.data.u_char_class;
+ ZoneList<CharacterRange>* ranges = char_class->ranges();
+ // TODO(lrn): Canonicalize ranges when they are created
+ // instead of waiting until now.
+ CharacterRange::Canonicalize(ranges);
if (char_class->is_negated()) {
- ZoneList<CharacterRange>* ranges = char_class->ranges();
int length = ranges->length();
int new_length = length + 1;
if (length > 0) {
@@ -5047,7 +5056,7 @@
CharacterRange::Negate(ranges, negated_ranges);
set_first_character_set(negated_ranges);
} else {
- set_first_character_set(char_class->ranges());
+ set_first_character_set(ranges);
}
}
}