OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 } | 1878 } |
1879 CharacterRange range = ranges->at(first_range); | 1879 CharacterRange range = ranges->at(first_range); |
1880 uc16 from = range.from(); | 1880 uc16 from = range.from(); |
1881 uc16 to = range.to(); | 1881 uc16 to = range.to(); |
1882 if (to > char_mask) { | 1882 if (to > char_mask) { |
1883 to = char_mask; | 1883 to = char_mask; |
1884 } | 1884 } |
1885 uint32_t differing_bits = (from ^ to); | 1885 uint32_t differing_bits = (from ^ to); |
1886 // A mask and compare is only perfect if the differing bits form a | 1886 // A mask and compare is only perfect if the differing bits form a |
1887 // number like 00011111 with one single block of trailing 1s. | 1887 // number like 00011111 with one single block of trailing 1s. |
1888 if ((differing_bits & (differing_bits + 1)) == 0) { | 1888 if ((differing_bits & (differing_bits + 1)) == 0 && |
| 1889 from + differing_bits == to) { |
1889 pos->determines_perfectly = true; | 1890 pos->determines_perfectly = true; |
1890 } | 1891 } |
1891 uint32_t common_bits = ~SmearBitsRight(differing_bits); | 1892 uint32_t common_bits = ~SmearBitsRight(differing_bits); |
1892 uint32_t bits = (from & common_bits); | 1893 uint32_t bits = (from & common_bits); |
1893 for (int i = first_range + 1; i < ranges->length(); i++) { | 1894 for (int i = first_range + 1; i < ranges->length(); i++) { |
1894 CharacterRange range = ranges->at(i); | 1895 CharacterRange range = ranges->at(i); |
1895 uc16 from = range.from(); | 1896 uc16 from = range.from(); |
1896 uc16 to = range.to(); | 1897 uc16 to = range.to(); |
1897 if (from > char_mask) continue; | 1898 if (from > char_mask) continue; |
1898 if (to > char_mask) to = char_mask; | 1899 if (to > char_mask) to = char_mask; |
(...skipping 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4480 EmbeddedVector<byte, 1024> codes; | 4481 EmbeddedVector<byte, 1024> codes; |
4481 RegExpMacroAssemblerIrregexp macro_assembler(codes); | 4482 RegExpMacroAssemblerIrregexp macro_assembler(codes); |
4482 return compiler.Assemble(¯o_assembler, | 4483 return compiler.Assemble(¯o_assembler, |
4483 node, | 4484 node, |
4484 data->capture_count, | 4485 data->capture_count, |
4485 pattern); | 4486 pattern); |
4486 } | 4487 } |
4487 | 4488 |
4488 | 4489 |
4489 }} // namespace v8::internal | 4490 }} // namespace v8::internal |
OLD | NEW |