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_JSREGEXP_H_ | 5 #ifndef V8_JSREGEXP_H_ |
6 #define V8_JSREGEXP_H_ | 6 #define V8_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 #include "src/zone-inl.h" | 10 #include "src/zone-inl.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 static int IrregexpNumberOfRegisters(FixedArray* re); | 206 static int IrregexpNumberOfRegisters(FixedArray* re); |
207 static ByteArray* IrregexpByteCode(FixedArray* re, bool is_one_byte); | 207 static ByteArray* IrregexpByteCode(FixedArray* re, bool is_one_byte); |
208 static Code* IrregexpNativeCode(FixedArray* re, bool is_one_byte); | 208 static Code* IrregexpNativeCode(FixedArray* re, bool is_one_byte); |
209 | 209 |
210 // Limit the space regexps take up on the heap. In order to limit this we | 210 // Limit the space regexps take up on the heap. In order to limit this we |
211 // would like to keep track of the amount of regexp code on the heap. This | 211 // would like to keep track of the amount of regexp code on the heap. This |
212 // is not tracked, however. As a conservative approximation we track the | 212 // is not tracked, however. As a conservative approximation we track the |
213 // total regexp code compiled including code that has subsequently been freed | 213 // total regexp code compiled including code that has subsequently been freed |
214 // and the total executable memory at any point. | 214 // and the total executable memory at any point. |
215 static const int kRegExpExecutableMemoryLimit = 16 * MB; | 215 static const int kRegExpExecutableMemoryLimit = 16 * MB; |
216 static const int kRegWxpCompiledLimit = 1 * MB; | 216 static const int kRegExpCompiledLimit = 1 * MB; |
| 217 static const int kRegExpTooLargeToOptimize = 10 * KB; |
217 | 218 |
218 private: | 219 private: |
219 static bool CompileIrregexp(Handle<JSRegExp> re, | 220 static bool CompileIrregexp(Handle<JSRegExp> re, |
220 Handle<String> sample_subject, bool is_one_byte); | 221 Handle<String> sample_subject, bool is_one_byte); |
221 static inline bool EnsureCompiledIrregexp(Handle<JSRegExp> re, | 222 static inline bool EnsureCompiledIrregexp(Handle<JSRegExp> re, |
222 Handle<String> sample_subject, | 223 Handle<String> sample_subject, |
223 bool is_one_byte); | 224 bool is_one_byte); |
224 }; | 225 }; |
225 | 226 |
226 | 227 |
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 Object* code; | 1660 Object* code; |
1660 int num_registers; | 1661 int num_registers; |
1661 }; | 1662 }; |
1662 | 1663 |
1663 static CompilationResult Compile(RegExpCompileData* input, bool ignore_case, | 1664 static CompilationResult Compile(RegExpCompileData* input, bool ignore_case, |
1664 bool global, bool multiline, bool sticky, | 1665 bool global, bool multiline, bool sticky, |
1665 Handle<String> pattern, | 1666 Handle<String> pattern, |
1666 Handle<String> sample_subject, | 1667 Handle<String> sample_subject, |
1667 bool is_one_byte, Zone* zone); | 1668 bool is_one_byte, Zone* zone); |
1668 | 1669 |
| 1670 static bool TooMuchRegExpCode(Handle<String> pattern); |
| 1671 |
1669 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); | 1672 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); |
1670 }; | 1673 }; |
1671 | 1674 |
1672 | 1675 |
1673 } } // namespace v8::internal | 1676 } } // namespace v8::internal |
1674 | 1677 |
1675 #endif // V8_JSREGEXP_H_ | 1678 #endif // V8_JSREGEXP_H_ |
OLD | NEW |