| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 m.Succeed(); | 854 m.Succeed(); |
| 855 m.Bind(&fail); | 855 m.Bind(&fail); |
| 856 m.Fail(); | 856 m.Fail(); |
| 857 | 857 |
| 858 Handle<String> source = factory->NewStringFromAscii(CStrVector("^foo")); | 858 Handle<String> source = factory->NewStringFromAscii(CStrVector("^foo")); |
| 859 Handle<Object> code_object = m.GetCode(source); | 859 Handle<Object> code_object = m.GetCode(source); |
| 860 Handle<Code> code = Handle<Code>::cast(code_object); | 860 Handle<Code> code = Handle<Code>::cast(code_object); |
| 861 | 861 |
| 862 int captures[4] = {42, 37, 87, 117}; | 862 int captures[4] = {42, 37, 87, 117}; |
| 863 const uc16 input_data[6] = {'f', 'o', 'o', 'f', 'o', | 863 const uc16 input_data[6] = {'f', 'o', 'o', 'f', 'o', |
| 864 static_cast<uc16>('\xa0')}; | 864 static_cast<uc16>(0x2603)}; |
| 865 Handle<String> input = | 865 Handle<String> input = |
| 866 factory->NewStringFromTwoByte(Vector<const uc16>(input_data, 6)); | 866 factory->NewStringFromTwoByte(Vector<const uc16>(input_data, 6)); |
| 867 Handle<SeqTwoByteString> seq_input = Handle<SeqTwoByteString>::cast(input); | 867 Handle<SeqTwoByteString> seq_input = Handle<SeqTwoByteString>::cast(input); |
| 868 Address start_adr = seq_input->GetCharsAddress(); | 868 Address start_adr = seq_input->GetCharsAddress(); |
| 869 | 869 |
| 870 NativeRegExpMacroAssembler::Result result = | 870 NativeRegExpMacroAssembler::Result result = |
| 871 Execute(*code, | 871 Execute(*code, |
| 872 *input, | 872 *input, |
| 873 0, | 873 0, |
| 874 start_adr, | 874 start_adr, |
| 875 start_adr + input->length(), | 875 start_adr + input->length(), |
| 876 captures); | 876 captures); |
| 877 | 877 |
| 878 CHECK_EQ(NativeRegExpMacroAssembler::SUCCESS, result); | 878 CHECK_EQ(NativeRegExpMacroAssembler::SUCCESS, result); |
| 879 CHECK_EQ(0, captures[0]); | 879 CHECK_EQ(0, captures[0]); |
| 880 CHECK_EQ(3, captures[1]); | 880 CHECK_EQ(3, captures[1]); |
| 881 CHECK_EQ(-1, captures[2]); | 881 CHECK_EQ(-1, captures[2]); |
| 882 CHECK_EQ(-1, captures[3]); | 882 CHECK_EQ(-1, captures[3]); |
| 883 | 883 |
| 884 const uc16 input_data2[9] = {'b', 'a', 'r', 'b', 'a', 'r', 'b', 'a', | 884 const uc16 input_data2[9] = {'b', 'a', 'r', 'b', 'a', 'r', 'b', 'a', |
| 885 static_cast<uc16>('\xa0')}; | 885 static_cast<uc16>(0x2603)}; |
| 886 input = factory->NewStringFromTwoByte(Vector<const uc16>(input_data2, 9)); | 886 input = factory->NewStringFromTwoByte(Vector<const uc16>(input_data2, 9)); |
| 887 seq_input = Handle<SeqTwoByteString>::cast(input); | 887 seq_input = Handle<SeqTwoByteString>::cast(input); |
| 888 start_adr = seq_input->GetCharsAddress(); | 888 start_adr = seq_input->GetCharsAddress(); |
| 889 | 889 |
| 890 result = Execute(*code, | 890 result = Execute(*code, |
| 891 *input, | 891 *input, |
| 892 0, | 892 0, |
| 893 start_adr, | 893 start_adr, |
| 894 start_adr + input->length() * 2, | 894 start_adr + input->length() * 2, |
| 895 captures); | 895 captures); |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 ZoneList<CharacterRange> first_only(4, Isolate::Current()->runtime_zone()); | 1800 ZoneList<CharacterRange> first_only(4, Isolate::Current()->runtime_zone()); |
| 1801 ZoneList<CharacterRange> second_only(4, Isolate::Current()->runtime_zone()); | 1801 ZoneList<CharacterRange> second_only(4, Isolate::Current()->runtime_zone()); |
| 1802 ZoneList<CharacterRange> both(4, Isolate::Current()->runtime_zone()); | 1802 ZoneList<CharacterRange> both(4, Isolate::Current()->runtime_zone()); |
| 1803 } | 1803 } |
| 1804 | 1804 |
| 1805 | 1805 |
| 1806 TEST(Graph) { | 1806 TEST(Graph) { |
| 1807 V8::Initialize(NULL); | 1807 V8::Initialize(NULL); |
| 1808 Execute("\\b\\w+\\b", false, true, true); | 1808 Execute("\\b\\w+\\b", false, true, true); |
| 1809 } | 1809 } |
| OLD | NEW |