| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 __ Bind(&advance); | 512 __ Bind(&advance); |
| 513 __ AdvanceCP(); | 513 __ AdvanceCP(); |
| 514 __ Bind(&look_for_foo); | 514 __ Bind(&look_for_foo); |
| 515 __ FailIfWithin(3); | 515 __ FailIfWithin(3); |
| 516 __ LoadCurrentChar(0); | 516 __ LoadCurrentChar(0); |
| 517 __ CheckChar('f', &advance); | 517 __ CheckChar('f', &advance); |
| 518 __ LoadCurrentChar(1); | 518 __ LoadCurrentChar(1); |
| 519 __ CheckChar('o', &advance); | 519 __ CheckChar('o', &advance); |
| 520 __ LoadCurrentChar(2); | 520 __ LoadCurrentChar(2); |
| 521 __ CheckChar('o', &advance); | 521 __ CheckChar('o', &advance); |
| 522 __ SetCapture(0); | 522 __ SetRegister(0); |
| 523 __ SetCapture(1, 2); | 523 __ SetRegister(1, 2); |
| 524 __ Succeed(); | 524 __ Succeed(); |
| 525 | 525 |
| 526 v8::HandleScope scope; | 526 v8::HandleScope scope; |
| 527 Handle<ByteArray> array = Factory::NewByteArray(assembler.length()); | 527 Handle<ByteArray> array = Factory::NewByteArray(assembler.length()); |
| 528 assembler.Copy(array->GetDataStartAddress()); | 528 assembler.Copy(array->GetDataStartAddress()); |
| 529 int captures[2]; | 529 int captures[2]; |
| 530 | 530 |
| 531 Handle<String> f1 = Factory::NewStringFromAscii(CStrVector("Now is the time"))
; | 531 Handle<String> f1 = |
| 532 Factory::NewStringFromAscii(CStrVector("Now is the time")); |
| 532 CHECK(!Re2kInterpreter::Match(*array, *f1, captures, 0)); | 533 CHECK(!Re2kInterpreter::Match(*array, *f1, captures, 0)); |
| 533 | 534 |
| 534 Handle<String> f2 = Factory::NewStringFromAscii(CStrVector("foo bar baz")); | 535 Handle<String> f2 = Factory::NewStringFromAscii(CStrVector("foo bar baz")); |
| 535 CHECK(Re2kInterpreter::Match(*array, *f2, captures, 0)); | 536 CHECK(Re2kInterpreter::Match(*array, *f2, captures, 0)); |
| 536 CHECK_EQ(0, captures[0]); | 537 CHECK_EQ(0, captures[0]); |
| 537 CHECK_EQ(2, captures[1]); | 538 CHECK_EQ(2, captures[1]); |
| 538 | 539 |
| 539 Handle<String> f3 = Factory::NewStringFromAscii(CStrVector("tomfoolery")); | 540 Handle<String> f3 = Factory::NewStringFromAscii(CStrVector("tomfoolery")); |
| 540 CHECK(Re2kInterpreter::Match(*array, *f3, captures, 0)); | 541 CHECK(Re2kInterpreter::Match(*array, *f3, captures, 0)); |
| 541 CHECK_EQ(3, captures[0]); | 542 CHECK_EQ(3, captures[0]); |
| 542 CHECK_EQ(5, captures[1]); | 543 CHECK_EQ(5, captures[1]); |
| 543 } | 544 } |
| 544 | 545 |
| 545 | 546 |
| 546 | 547 |
| OLD | NEW |