| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 m.Bind(&fail2); | 634 m.Bind(&fail2); |
| 635 m.PopRegister(0); | 635 m.PopRegister(0); |
| 636 m.Fail(); | 636 m.Fail(); |
| 637 | 637 |
| 638 v8::HandleScope scope; | 638 v8::HandleScope scope; |
| 639 | 639 |
| 640 Handle<String> source = Factory::NewStringFromAscii(CStrVector("^f(o)o")); | 640 Handle<String> source = Factory::NewStringFromAscii(CStrVector("^f(o)o")); |
| 641 Handle<ByteArray> array = Handle<ByteArray>::cast(m.GetCode(source)); | 641 Handle<ByteArray> array = Handle<ByteArray>::cast(m.GetCode(source)); |
| 642 int captures[5]; | 642 int captures[5]; |
| 643 | 643 |
| 644 Handle<String> f1 = | 644 const uc16 str1[] = {'f', 'o', 'o', 'b', 'a', 'r'}; |
| 645 Factory::NewStringFromAscii(CStrVector("foobar")); | 645 Handle<String> f1_16 = |
| 646 CHECK(IrregexpInterpreter::Match(array, f1, captures, 0)); | 646 Factory::NewStringFromTwoByte(Vector<const uc16>(str1, 6)); |
| 647 |
| 648 CHECK(IrregexpInterpreter::Match(array, f1_16, captures, 0)); |
| 647 CHECK_EQ(0, captures[0]); | 649 CHECK_EQ(0, captures[0]); |
| 648 CHECK_EQ(3, captures[1]); | 650 CHECK_EQ(3, captures[1]); |
| 649 CHECK_EQ(1, captures[2]); | 651 CHECK_EQ(1, captures[2]); |
| 650 CHECK_EQ(2, captures[3]); | 652 CHECK_EQ(2, captures[3]); |
| 651 CHECK_EQ(84, captures[4]); | 653 CHECK_EQ(84, captures[4]); |
| 652 | 654 |
| 653 Handle<String> f2 = | 655 const uc16 str2[] = {'b', 'a', 'r', 'f', 'o', 'o'}; |
| 654 Factory::NewStringFromAscii(CStrVector("barfoo")); | 656 Handle<String> f2_16 = |
| 655 CHECK(!IrregexpInterpreter::Match(array, f2, captures, 0)); | 657 Factory::NewStringFromTwoByte(Vector<const uc16>(str2, 6)); |
| 658 |
| 659 CHECK(!IrregexpInterpreter::Match(array, f2_16, captures, 0)); |
| 656 CHECK_EQ(42, captures[0]); | 660 CHECK_EQ(42, captures[0]); |
| 657 } | 661 } |
| 658 | 662 |
| 659 | 663 |
| 660 #ifndef ARM // IA32 only tests. | 664 #ifndef ARM // IA32 only tests. |
| 661 | 665 |
| 662 class ContextInitializer { | 666 class ContextInitializer { |
| 663 public: | 667 public: |
| 664 ContextInitializer() : env_(), scope_(), stack_guard_() { | 668 ContextInitializer() : env_(), scope_(), stack_guard_() { |
| 665 env_ = v8::Context::New(); | 669 env_ = v8::Context::New(); |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 CHECK(!InClass(i, excluded)); | 1556 CHECK(!InClass(i, excluded)); |
| 1553 } | 1557 } |
| 1554 } | 1558 } |
| 1555 } | 1559 } |
| 1556 | 1560 |
| 1557 | 1561 |
| 1558 TEST(Graph) { | 1562 TEST(Graph) { |
| 1559 V8::Initialize(NULL); | 1563 V8::Initialize(NULL); |
| 1560 Execute("(?:(?:x(.))?\1)+$", false, true, true); | 1564 Execute("(?:(?:x(.))?\1)+$", false, true, true); |
| 1561 } | 1565 } |
| OLD | NEW |