Commit 3f962f0f authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Irregexp:

* Fix UC16 character classes on ASCII subjects.
* Fix sign problem in Irregexp interpreter.
* Make passes over text nodes more readable.
Review URL: http://codereview.chromium.org/21450

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1304 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b4b5e3ca
......@@ -33,7 +33,10 @@ namespace v8 { namespace internal {
static const int BYTECODE_MASK = 0xff;
static const unsigned int MAX_FIRST_ARG = 0xffffffu;
// The first argument is packed in with the byte code in one word, but so it
// has 24 bits, but it can be positive and negative so only use 23 bits for
// positive values.
static const unsigned int MAX_FIRST_ARG = 0x7fffffu;
static const int BYTECODE_SHIFT = 8;
#define BYTECODE_ITERATOR(V) \
......
This diff is collapsed.
......@@ -824,11 +824,15 @@ class TextNode: public SeqRegExpNode {
private:
enum TextEmitPassType {
NON_ASCII_MATCH,
CHARACTER_MATCH,
CASE_CHARACTER_MATCH,
CHARACTER_CLASS_MATCH
NON_ASCII_MATCH, // Check for characters that can't match.
SIMPLE_CHARACTER_MATCH, // Case-dependent single character check.
NON_LETTER_CHARACTER_MATCH, // Check characters that have no case equivs.
CASE_CHARACTER_MATCH, // Case-independent single character check.
CHARACTER_CLASS_MATCH // Character class.
};
static bool SkipPass(int pass, bool ignore_case);
static const int kFirstRealPass = SIMPLE_CHARACTER_MATCH;
static const int kLastPass = CHARACTER_CLASS_MATCH;
void TextEmitPass(RegExpCompiler* compiler,
TextEmitPassType pass,
bool preloaded,
......
......@@ -3240,6 +3240,7 @@ class String: public HeapObject {
// Max ascii char code.
static const int kMaxAsciiCharCode = unibrow::Utf8::kMaxOneByteChar;
static const unsigned kMaxAsciiCharCodeU = unibrow::Utf8::kMaxOneByteChar;
static const int kMaxUC16CharCode = 0xffff;
// Minimum length for a cons or sliced string.
......
......@@ -41,3 +41,7 @@ var longUC16String = "x\u03a3\u03c2\u039b\u03c2\u03c3\u03bb\u03c3\u03a3\u03bb";
assertEquals(longUC16String + "," + longUC16String.substring(1,4),
String(/x(...)\1\1/i.exec(longUC16String)),
"backref-UC16-twice");
assertFalse(/\xc1/i.test('fooA'), "quickcheck-uc16-pattern-ascii-subject");
assertFalse(/[\xe9]/.test('i'), "charclass-uc16-pattern-ascii-subject");
assertFalse(/\u5e74|\u6708/.test('t'), "alternation-uc16-pattern-ascii-subject");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment