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

Unified Diff: test/cctest/test-regexp.cc

Issue 12944: * Implemented case-insensitive back-reference matching in irregexp-ia32. (Closed)
Patch Set: Review comments addressed Created 12 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
« no previous file with comments | « src/regexp-macro-assembler-ia32.cc ('k') | test/mjsunit/regexp.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-regexp.cc
diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc
index 8325080b1061d2a22e0a785b70ad65f182b5ac04..cf0733efaafcc8ec922dfcb346245da76f92d51f 100644
--- a/test/cctest/test-regexp.cc
+++ b/test/cctest/test-regexp.cc
@@ -817,7 +817,6 @@ TEST(MacroAssemblerIA32BackReference) {
}
-
TEST(MacroAssemblerIA32AtStart) {
V8::Initialize(NULL);
@@ -882,6 +881,65 @@ TEST(MacroAssemblerIA32AtStart) {
+
+TEST(MacroAssemblerIA32BackRefNoCase) {
+ V8::Initialize(NULL);
+
+ // regexp-macro-assembler-ia32 needs a handle scope to allocate
+ // byte-arrays for constants.
+ v8::HandleScope scope;
+
+ RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 4);
+
+ Label fail, succ;
+
+ m.WriteCurrentPositionToRegister(0);
+ m.WriteCurrentPositionToRegister(2);
+ m.AdvanceCurrentPosition(3);
+ m.WriteCurrentPositionToRegister(3);
+ m.CheckNotBackReferenceIgnoreCase(2, &fail); // Match "AbC".
+ m.CheckNotBackReferenceIgnoreCase(2, &fail); // Match "ABC".
+ Label expected_fail;
+ m.CheckNotBackReferenceIgnoreCase(2, &expected_fail);
+ m.Bind(&fail);
+ m.Fail();
+
+ m.Bind(&expected_fail);
+ m.AdvanceCurrentPosition(3); // Skip "xYz"
+ m.CheckNotBackReferenceIgnoreCase(2, &succ);
+ m.Fail();
+
+ m.Bind(&succ);
+ m.WriteCurrentPositionToRegister(1);
+ m.Succeed();
+
+ Handle<Object> code_object = m.GetCode();
+ Handle<Code> code = Handle<Code>::cast(code_object);
+
+ Handle<String> input =
+ Factory::NewStringFromAscii(CStrVector("aBcAbCABCxYzab"));
+ Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input);
+ Address start_adr = seq_input->GetCharsAddress();
+ int start_offset = start_adr - reinterpret_cast<Address>(*seq_input);
+ int end_offset = start_offset + seq_input->length();
+
+ int output[4];
+ bool success = RegExpMacroAssemblerIA32::Execute(*code,
+ seq_input.location(),
+ start_offset,
+ end_offset,
+ output,
+ true);
+
+ CHECK(success);
+ CHECK_EQ(0, output[0]);
+ CHECK_EQ(12, output[1]);
+ CHECK_EQ(0, output[2]);
+ CHECK_EQ(3, output[3]);
+}
+
+
+
TEST(MacroAssemblerIA32Registers) {
V8::Initialize(NULL);
« no previous file with comments | « src/regexp-macro-assembler-ia32.cc ('k') | test/mjsunit/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698