OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4219 // Once we've found the end point we look up its uncanonicalization | 4219 // Once we've found the end point we look up its uncanonicalization |
4220 // and produce a range for each element. For instance for [c-f] | 4220 // and produce a range for each element. For instance for [c-f] |
4221 // we look up ['z', 'Z'] and produce [c-f] and [C-F]. We then only | 4221 // we look up ['z', 'Z'] and produce [c-f] and [C-F]. We then only |
4222 // add a range if it is not already contained in the input, so [c-f] | 4222 // add a range if it is not already contained in the input, so [c-f] |
4223 // will be skipped but [C-F] will be added. If this range is not | 4223 // will be skipped but [C-F] will be added. If this range is not |
4224 // completely contained in a block we do this for all the blocks | 4224 // completely contained in a block we do this for all the blocks |
4225 // covered by the range (handling characters that is not in a block | 4225 // covered by the range (handling characters that is not in a block |
4226 // as a "singleton block"). | 4226 // as a "singleton block"). |
4227 unibrow::uchar range[unibrow::Ecma262UnCanonicalize::kMaxWidth]; | 4227 unibrow::uchar range[unibrow::Ecma262UnCanonicalize::kMaxWidth]; |
4228 int pos = bottom; | 4228 int pos = bottom; |
4229 while (pos < top) { | 4229 while (pos <= top) { |
4230 int length = isolate->jsregexp_canonrange()->get(pos, '\0', range); | 4230 int length = isolate->jsregexp_canonrange()->get(pos, '\0', range); |
4231 uc16 block_end; | 4231 uc16 block_end; |
4232 if (length == 0) { | 4232 if (length == 0) { |
4233 block_end = pos; | 4233 block_end = pos; |
4234 } else { | 4234 } else { |
4235 ASSERT_EQ(1, length); | 4235 ASSERT_EQ(1, length); |
4236 block_end = range[0]; | 4236 block_end = range[0]; |
4237 } | 4237 } |
4238 int end = (block_end > top) ? top : block_end; | 4238 int end = (block_end > top) ? top : block_end; |
4239 length = isolate->jsregexp_uncanonicalize()->get(block_end, '\0', range); | 4239 length = isolate->jsregexp_uncanonicalize()->get(block_end, '\0', range); |
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5334 } | 5334 } |
5335 | 5335 |
5336 return compiler.Assemble(¯o_assembler, | 5336 return compiler.Assemble(¯o_assembler, |
5337 node, | 5337 node, |
5338 data->capture_count, | 5338 data->capture_count, |
5339 pattern); | 5339 pattern); |
5340 } | 5340 } |
5341 | 5341 |
5342 | 5342 |
5343 }} // namespace v8::internal | 5343 }} // namespace v8::internal |
OLD | NEW |