OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 169 } |
170 | 170 |
171 // For acting on the JSRegExp data FixedArray. | 171 // For acting on the JSRegExp data FixedArray. |
172 static int IrregexpMaxRegisterCount(FixedArray* re); | 172 static int IrregexpMaxRegisterCount(FixedArray* re); |
173 static void SetIrregexpMaxRegisterCount(FixedArray* re, int value); | 173 static void SetIrregexpMaxRegisterCount(FixedArray* re, int value); |
174 static int IrregexpNumberOfCaptures(FixedArray* re); | 174 static int IrregexpNumberOfCaptures(FixedArray* re); |
175 static int IrregexpNumberOfRegisters(FixedArray* re); | 175 static int IrregexpNumberOfRegisters(FixedArray* re); |
176 static ByteArray* IrregexpByteCode(FixedArray* re, bool is_ascii); | 176 static ByteArray* IrregexpByteCode(FixedArray* re, bool is_ascii); |
177 static Code* IrregexpNativeCode(FixedArray* re, bool is_ascii); | 177 static Code* IrregexpNativeCode(FixedArray* re, bool is_ascii); |
178 | 178 |
| 179 // Limit the space regexps take up on the heap. In order to limit this we |
| 180 // would like to keep track of the amount of regexp code on the heap. This |
| 181 // is not tracked, however. As a conservative approximation we track the |
| 182 // total regexp code compiled including code that has subsequently been freed |
| 183 // and the total executable memory at any point. |
| 184 static const int kRegExpExecutableMemoryLimit = 16 * MB; |
| 185 static const int kRegWxpCompiledLimit = 1 * MB; |
| 186 |
179 private: | 187 private: |
180 static String* last_ascii_string_; | 188 static String* last_ascii_string_; |
181 static String* two_byte_cached_string_; | 189 static String* two_byte_cached_string_; |
182 | 190 |
183 static bool CompileIrregexp(Handle<JSRegExp> re, bool is_ascii); | 191 static bool CompileIrregexp(Handle<JSRegExp> re, bool is_ascii); |
184 static inline bool EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii); | 192 static inline bool EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii); |
185 | 193 |
186 | 194 |
187 // Set the subject cache. The previous string buffer is not deleted, so the | 195 // Set the subject cache. The previous string buffer is not deleted, so the |
188 // caller should ensure that it doesn't leak. | 196 // caller should ensure that it doesn't leak. |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 int* vector_; | 1483 int* vector_; |
1476 int offsets_vector_length_; | 1484 int offsets_vector_length_; |
1477 | 1485 |
1478 friend class ExternalReference; | 1486 friend class ExternalReference; |
1479 }; | 1487 }; |
1480 | 1488 |
1481 | 1489 |
1482 } } // namespace v8::internal | 1490 } } // namespace v8::internal |
1483 | 1491 |
1484 #endif // V8_JSREGEXP_H_ | 1492 #endif // V8_JSREGEXP_H_ |
OLD | NEW |