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 2560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2571 } | 2571 } |
2572 | 2572 |
2573 | 2573 |
2574 // Cap on the maximal shift in the Boyer-Moore implementation. By setting a | 2574 // Cap on the maximal shift in the Boyer-Moore implementation. By setting a |
2575 // limit, we can fix the size of tables. | 2575 // limit, we can fix the size of tables. |
2576 static const int kBMMaxShift = 0xff; | 2576 static const int kBMMaxShift = 0xff; |
2577 // Reduce alphabet to this size. | 2577 // Reduce alphabet to this size. |
2578 static const int kBMAlphabetSize = 0x100; | 2578 static const int kBMAlphabetSize = 0x100; |
2579 // For patterns below this length, the skip length of Boyer-Moore is too short | 2579 // For patterns below this length, the skip length of Boyer-Moore is too short |
2580 // to compensate for the algorithmic overhead compared to simple brute force. | 2580 // to compensate for the algorithmic overhead compared to simple brute force. |
2581 static const int kBMMinPatternLength = 5; | 2581 static const int kBMMinPatternLength = 7; |
2582 | 2582 |
2583 // Holds the two buffers used by Boyer-Moore string search's Good Suffix | 2583 // Holds the two buffers used by Boyer-Moore string search's Good Suffix |
2584 // shift. Only allows the last kBMMaxShift characters of the needle | 2584 // shift. Only allows the last kBMMaxShift characters of the needle |
2585 // to be indexed. | 2585 // to be indexed. |
2586 class BMGoodSuffixBuffers { | 2586 class BMGoodSuffixBuffers { |
2587 public: | 2587 public: |
2588 BMGoodSuffixBuffers() {} | 2588 BMGoodSuffixBuffers() {} |
2589 inline void init(int needle_length) { | 2589 inline void init(int needle_length) { |
2590 ASSERT(needle_length > 1); | 2590 ASSERT(needle_length > 1); |
2591 int start = needle_length < kBMMaxShift ? 0 : needle_length - kBMMaxShift; | 2591 int start = needle_length < kBMMaxShift ? 0 : needle_length - kBMMaxShift; |
(...skipping 7939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10531 } else { | 10531 } else { |
10532 // Handle last resort GC and make sure to allow future allocations | 10532 // Handle last resort GC and make sure to allow future allocations |
10533 // to grow the heap without causing GCs (if possible). | 10533 // to grow the heap without causing GCs (if possible). |
10534 Counters::gc_last_resort_from_js.Increment(); | 10534 Counters::gc_last_resort_from_js.Increment(); |
10535 Heap::CollectAllGarbage(false); | 10535 Heap::CollectAllGarbage(false); |
10536 } | 10536 } |
10537 } | 10537 } |
10538 | 10538 |
10539 | 10539 |
10540 } } // namespace v8::internal | 10540 } } // namespace v8::internal |
OLD | NEW |