OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_REGEXP_JSREGEXP_H_ | 5 #ifndef V8_REGEXP_JSREGEXP_H_ |
6 #define V8_REGEXP_JSREGEXP_H_ | 6 #define V8_REGEXP_JSREGEXP_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 | 10 |
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 Handle<String> pattern, | 1652 Handle<String> pattern, |
1653 Handle<String> sample_subject, | 1653 Handle<String> sample_subject, |
1654 bool is_one_byte); | 1654 bool is_one_byte); |
1655 | 1655 |
1656 static bool TooMuchRegExpCode(Handle<String> pattern); | 1656 static bool TooMuchRegExpCode(Handle<String> pattern); |
1657 | 1657 |
1658 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); | 1658 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); |
1659 }; | 1659 }; |
1660 | 1660 |
1661 | 1661 |
1662 } } // namespace v8::internal | 1662 class RegExpResultsCache : public AllStatic { |
| 1663 public: |
| 1664 enum ResultsCacheType { REGEXP_MULTIPLE_INDICES, STRING_SPLIT_SUBSTRINGS }; |
| 1665 |
| 1666 // Attempt to retrieve a cached result. On failure, 0 is returned as a Smi. |
| 1667 // On success, the returned result is guaranteed to be a COW-array. |
| 1668 static Object* Lookup(Heap* heap, String* key_string, Object* key_pattern, |
| 1669 ResultsCacheType type); |
| 1670 // Attempt to add value_array to the cache specified by type. On success, |
| 1671 // value_array is turned into a COW-array. |
| 1672 static void Enter(Isolate* isolate, Handle<String> key_string, |
| 1673 Handle<Object> key_pattern, Handle<FixedArray> value_array, |
| 1674 ResultsCacheType type); |
| 1675 static void Clear(FixedArray* cache); |
| 1676 static const int kRegExpResultsCacheSize = 0x100; |
| 1677 |
| 1678 private: |
| 1679 static const int kArrayEntriesPerCacheEntry = 4; |
| 1680 static const int kStringOffset = 0; |
| 1681 static const int kPatternOffset = 1; |
| 1682 static const int kArrayOffset = 2; |
| 1683 }; |
| 1684 |
| 1685 } // namespace internal |
| 1686 } // namespace v8 |
1663 | 1687 |
1664 #endif // V8_REGEXP_JSREGEXP_H_ | 1688 #endif // V8_REGEXP_JSREGEXP_H_ |
OLD | NEW |