Chromium Code Reviews| Index: test/cctest/test-regexp.cc |
| diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc |
| index 4f075a1fb2e568d8a31ee54bf07f09f10257e9e3..38177c9787e8f72621c46b42c22309ea7589c29d 100644 |
| --- a/test/cctest/test-regexp.cc |
| +++ b/test/cctest/test-regexp.cc |
| @@ -582,9 +582,6 @@ TEST(MacroAssembler) { |
| #ifndef ARM // IA32 only tests. |
| TEST(MacroAssemblerIA32Success) { |
| - typedef bool (*AsciiTest) ( |
| - SeqAsciiString** base, int start_index, int end_index, int* captures); |
| - |
| V8::Initialize(NULL); |
| // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| @@ -597,7 +594,6 @@ TEST(MacroAssemblerIA32Success) { |
| Handle<Object> code_object = m.GetCode(); |
| Handle<Code> code = Handle<Code>::cast(code_object); |
| - AsciiTest test = FUNCTION_CAST<AsciiTest>(code->entry()); |
| int captures[4] = {42, 37, 87, 117}; |
| Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo")); |
| @@ -606,8 +602,8 @@ TEST(MacroAssemblerIA32Success) { |
| int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| int end_offset = start_offset + seq_input->length(); |
| - bool success = |
| - test(seq_input.location(), start_offset, end_offset, captures); |
| + bool success = RegExpMacroAssemblerIA32::Execute( |
| + *code, seq_input.location(), start_offset, end_offset, captures, true); |
|
Erik Corry
2008/11/30 19:39:27
Although the style guide is not strict on this poi
Lasse Reichstein
2008/12/04 15:18:37
Done.
|
| CHECK(success); |
| CHECK_EQ(-1, captures[0]); |
| @@ -618,9 +614,6 @@ TEST(MacroAssemblerIA32Success) { |
| TEST(MacroAssemblerIA32Simple) { |
| - typedef bool (*AsciiTest) ( |
| - SeqAsciiString** base, int start_index, int end_index, int* captures); |
| - |
| V8::Initialize(NULL); |
| // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| @@ -643,7 +636,6 @@ TEST(MacroAssemblerIA32Simple) { |
| Handle<Object> code_object = m.GetCode(); |
| Handle<Code> code = Handle<Code>::cast(code_object); |
| - AsciiTest test = FUNCTION_CAST<AsciiTest>(code->entry()); |
| int captures[4] = {42, 37, 87, 117}; |
| Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo")); |
| @@ -652,8 +644,8 @@ TEST(MacroAssemblerIA32Simple) { |
| int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| int end_offset = start_offset + seq_input->length(); |
| - bool success = |
| - test(seq_input.location(), start_offset, end_offset, captures); |
| + bool success = RegExpMacroAssemblerIA32::Execute( |
| + *code, seq_input.location(), start_offset, end_offset, captures, true); |
| CHECK(success); |
| CHECK_EQ(0, captures[0]); |
| @@ -667,16 +659,14 @@ TEST(MacroAssemblerIA32Simple) { |
| start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| end_offset = start_offset + seq_input->length(); |
| - success = test(seq_input.location(), start_offset, end_offset, captures); |
| + success = RegExpMacroAssemblerIA32::Execute( |
| + *code, seq_input.location(), start_offset, end_offset, captures, true); |
| CHECK(!success); |
| } |
| TEST(MacroAssemblerIA32SimpleUC16) { |
| - typedef bool (*UC16Test) ( |
| - SeqTwoByteString** base, int start_index, int end_index, int* captures); |
| - |
| V8::Initialize(NULL); |
| // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| @@ -699,7 +689,6 @@ TEST(MacroAssemblerIA32SimpleUC16) { |
| Handle<Object> code_object = m.GetCode(); |
| Handle<Code> code = Handle<Code>::cast(code_object); |
| - UC16Test test = FUNCTION_CAST<UC16Test>(code->entry()); |
| int captures[4] = {42, 37, 87, 117}; |
| const uc16 input_data[6] = {'f', 'o', 'o', 'f', 'o', '\xa0'}; |
| @@ -710,8 +699,8 @@ TEST(MacroAssemblerIA32SimpleUC16) { |
| int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| int end_offset = start_offset + seq_input->length() * sizeof(uc16); |
| - bool success = |
| - test(seq_input.location(), start_offset, end_offset, captures); |
| + bool success = RegExpMacroAssemblerIA32::Execute( |
| + *code, seq_input.location(), start_offset, end_offset, captures, true); |
| CHECK(success); |
| CHECK_EQ(0, captures[0]); |
| @@ -726,16 +715,14 @@ TEST(MacroAssemblerIA32SimpleUC16) { |
| start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| end_offset = start_offset + seq_input->length() * sizeof(uc16); |
| - success = test(seq_input.location(), start_offset, end_offset, captures); |
| + success = RegExpMacroAssemblerIA32::Execute( |
| + *code, seq_input.location(), start_offset, end_offset, captures, true); |
| CHECK(!success); |
| } |
| TEST(MacroAssemblerIA32Backtrack) { |
| - typedef bool (*AsciiTest) ( |
| - SeqAsciiString** base, int start_index, int end_index, int* captures); |
| - |
| V8::Initialize(NULL); |
| // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| @@ -760,7 +747,6 @@ TEST(MacroAssemblerIA32Backtrack) { |
| Handle<Object> code_object = m.GetCode(); |
| Handle<Code> code = Handle<Code>::cast(code_object); |
| - AsciiTest test = FUNCTION_CAST<AsciiTest>(code->entry()); |
| Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo")); |
| Handle<SeqAsciiString> seq_input = Handle<SeqAsciiString>::cast(input); |
| @@ -768,17 +754,56 @@ TEST(MacroAssemblerIA32Backtrack) { |
| int start_offset = start_adr - reinterpret_cast<Address>(*seq_input); |
| int end_offset = start_offset + seq_input->length(); |
| - bool success = |
| - test(seq_input.location(), start_offset, end_offset, NULL); |
| + bool success = RegExpMacroAssemblerIA32::Execute( |
| + *code, seq_input.location(), start_offset, end_offset, NULL, true); |
| CHECK(!success); |
| } |
| +TEST(MacroAssemblerIA32AtStart) { |
| + V8::Initialize(NULL); |
| + |
| + // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| + // byte-arrays for constants. |
| + v8::HandleScope scope; |
| -TEST(MacroAssemblerIA32Registers) { |
| - typedef bool (*AsciiTest) ( |
| - SeqAsciiString** base, int start_index, int end_index, int* captures); |
| + RegExpMacroAssemblerIA32 m(RegExpMacroAssemblerIA32::ASCII, 0); |
| + |
| + uc16 foo_chars[3] = {'f', 'o', 'o'}; |
| + Vector<const uc16> foo(foo_chars, 3); |
| + |
| + // RegExp: /^foo/ |
| + Label fail; |
| + m.CheckNotAtStart(&fail); |
| + m.CheckCharacters(foo, 0, &fail); |
| + m.Succeed(); |
| + m.Bind(&fail); |
| + m.Fail(); |
| + Handle<Object> code_object = m.GetCode(); |
| + Handle<Code> code = Handle<Code>::cast(code_object); |
| + |
| + Handle<String> input = Factory::NewStringFromAscii(CStrVector("foofoo")); |
| + 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(); |
| + |
| + bool success = RegExpMacroAssemblerIA32::Execute( |
| + *code, seq_input.location(), start_offset, end_offset, NULL, true); |
| + |
| + CHECK(success); |
| + |
| + start_offset += 3; |
| + success = RegExpMacroAssemblerIA32::Execute( |
| + *code, seq_input.location(), start_offset, end_offset, NULL, false); |
| + |
| + CHECK(!success); |
| +} |
| + |
| + |
| + |
| +TEST(MacroAssemblerIA32Registers) { |
| V8::Initialize(NULL); |
| // regexp-macro-assembler-ia32 needs a handle scope to allocate |
| @@ -850,7 +875,6 @@ TEST(MacroAssemblerIA32Registers) { |
| Handle<Object> code_object = m.GetCode(); |
| Handle<Code> code = Handle<Code>::cast(code_object); |
| - AsciiTest test = FUNCTION_CAST<AsciiTest>(code->entry()); |
| // String long enough for test (content doesn't matter). |
| Handle<String> input = |
| @@ -861,8 +885,8 @@ TEST(MacroAssemblerIA32Registers) { |
| int end_offset = start_offset + seq_input->length(); |
| int output[5]; |
| - bool success = |
| - test(seq_input.location(), start_offset, end_offset, output); |
| + bool success = RegExpMacroAssemblerIA32::Execute( |
| + *code, seq_input.location(), start_offset, end_offset, output, true); |
| CHECK(success); |
| CHECK_EQ(0, output[0]); |