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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 namespace v8 { | 31 namespace v8 { |
32 namespace internal { | 32 namespace internal { |
33 | 33 |
34 | 34 |
35 class RegExpMacroAssembler; | 35 class RegExpMacroAssembler; |
36 | 36 |
37 | 37 |
38 class RegExpImpl { | 38 class RegExpImpl { |
39 public: | 39 public: |
40 static inline bool UseNativeRegexp() { | 40 // Whether V8 is compiled with native regexp support or not. |
41 #ifdef V8_TARGET_ARCH_IA32 | 41 static bool UsesNativeRegExp() { |
42 return FLAG_regexp_native; | 42 #ifdef V8_NATIVE_REGEXP |
| 43 return true; |
43 #else | 44 #else |
44 return false; | 45 return false; |
45 #endif | 46 #endif |
46 } | 47 } |
| 48 |
47 // Creates a regular expression literal in the old space. | 49 // Creates a regular expression literal in the old space. |
48 // This function calls the garbage collector if necessary. | 50 // This function calls the garbage collector if necessary. |
49 static Handle<Object> CreateRegExpLiteral(Handle<JSFunction> constructor, | 51 static Handle<Object> CreateRegExpLiteral(Handle<JSFunction> constructor, |
50 Handle<String> pattern, | 52 Handle<String> pattern, |
51 Handle<String> flags, | 53 Handle<String> flags, |
52 bool* has_pending_exception); | 54 bool* has_pending_exception); |
53 | 55 |
54 // Returns a string representation of a regular expression. | 56 // Returns a string representation of a regular expression. |
55 // Implements RegExp.prototype.toString, see ECMA-262 section 15.10.6.4. | 57 // Implements RegExp.prototype.toString, see ECMA-262 section 15.10.6.4. |
56 // This function calls the garbage collector if necessary. | 58 // This function calls the garbage collector if necessary. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 static void SetIrregexpMaxRegisterCount(FixedArray* re, int value); | 143 static void SetIrregexpMaxRegisterCount(FixedArray* re, int value); |
142 static int IrregexpNumberOfCaptures(FixedArray* re); | 144 static int IrregexpNumberOfCaptures(FixedArray* re); |
143 static int IrregexpNumberOfRegisters(FixedArray* re); | 145 static int IrregexpNumberOfRegisters(FixedArray* re); |
144 static ByteArray* IrregexpByteCode(FixedArray* re, bool is_ascii); | 146 static ByteArray* IrregexpByteCode(FixedArray* re, bool is_ascii); |
145 static Code* IrregexpNativeCode(FixedArray* re, bool is_ascii); | 147 static Code* IrregexpNativeCode(FixedArray* re, bool is_ascii); |
146 | 148 |
147 private: | 149 private: |
148 static String* last_ascii_string_; | 150 static String* last_ascii_string_; |
149 static String* two_byte_cached_string_; | 151 static String* two_byte_cached_string_; |
150 | 152 |
151 static bool EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii); | 153 static bool CompileIrregexp(Handle<JSRegExp> re, bool is_ascii); |
| 154 static inline bool EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii); |
152 | 155 |
153 | 156 |
154 // Set the subject cache. The previous string buffer is not deleted, so the | 157 // Set the subject cache. The previous string buffer is not deleted, so the |
155 // caller should ensure that it doesn't leak. | 158 // caller should ensure that it doesn't leak. |
156 static void SetSubjectCache(String* subject, | 159 static void SetSubjectCache(String* subject, |
157 char* utf8_subject, | 160 char* utf8_subject, |
158 int uft8_length, | 161 int uft8_length, |
159 int character_position, | 162 int character_position, |
160 int utf8_position); | 163 int utf8_position); |
161 | 164 |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 Handle<String> pattern, | 1376 Handle<String> pattern, |
1374 bool is_ascii); | 1377 bool is_ascii); |
1375 | 1378 |
1376 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); | 1379 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); |
1377 }; | 1380 }; |
1378 | 1381 |
1379 | 1382 |
1380 } } // namespace v8::internal | 1383 } } // namespace v8::internal |
1381 | 1384 |
1382 #endif // V8_JSREGEXP_H_ | 1385 #endif // V8_JSREGEXP_H_ |
OLD | NEW |