| 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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Handle<String> f1 = |
| 645 Factory::NewStringFromAscii(CStrVector("foobar")); | 645 Factory::NewStringFromAscii(CStrVector("foobar")); |
| 646 Handle<String> f1_16 = RegExpImpl::StringToTwoByte(f1); | 646 CHECK(IrregexpInterpreter::Match(array, f1, captures, 0)); |
| 647 CHECK(IrregexpInterpreter::Match(array, f1_16, captures, 0)); | |
| 648 CHECK_EQ(0, captures[0]); | 647 CHECK_EQ(0, captures[0]); |
| 649 CHECK_EQ(3, captures[1]); | 648 CHECK_EQ(3, captures[1]); |
| 650 CHECK_EQ(1, captures[2]); | 649 CHECK_EQ(1, captures[2]); |
| 651 CHECK_EQ(2, captures[3]); | 650 CHECK_EQ(2, captures[3]); |
| 652 CHECK_EQ(84, captures[4]); | 651 CHECK_EQ(84, captures[4]); |
| 653 | 652 |
| 654 Handle<String> f2 = | 653 Handle<String> f2 = |
| 655 Factory::NewStringFromAscii(CStrVector("barfoo")); | 654 Factory::NewStringFromAscii(CStrVector("barfoo")); |
| 656 Handle<String> f2_16 = RegExpImpl::StringToTwoByte(f2); | 655 CHECK(!IrregexpInterpreter::Match(array, f2, captures, 0)); |
| 657 CHECK(!IrregexpInterpreter::Match(array, f2_16, captures, 0)); | |
| 658 CHECK_EQ(42, captures[0]); | 656 CHECK_EQ(42, captures[0]); |
| 659 } | 657 } |
| 660 | 658 |
| 661 | 659 |
| 662 #ifndef ARM // IA32 only tests. | 660 #ifndef ARM // IA32 only tests. |
| 663 | 661 |
| 664 class ContextInitializer { | 662 class ContextInitializer { |
| 665 public: | 663 public: |
| 666 ContextInitializer() : env_(), scope_(), stack_guard_() { | 664 ContextInitializer() : env_(), scope_(), stack_guard_() { |
| 667 env_ = v8::Context::New(); | 665 env_ = v8::Context::New(); |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 CHECK(!InClass(i, excluded)); | 1552 CHECK(!InClass(i, excluded)); |
| 1555 } | 1553 } |
| 1556 } | 1554 } |
| 1557 } | 1555 } |
| 1558 | 1556 |
| 1559 | 1557 |
| 1560 TEST(Graph) { | 1558 TEST(Graph) { |
| 1561 V8::Initialize(NULL); | 1559 V8::Initialize(NULL); |
| 1562 Execute("(?:(?:x(.))?\1)+$", false, true, true); | 1560 Execute("(?:(?:x(.))?\1)+$", false, true, true); |
| 1563 } | 1561 } |
| OLD | NEW |