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 #include "src/regexp/regexp-ast.h" | 10 #include "src/regexp/regexp-ast.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 array->set(index + kFirstCapture, Smi::FromInt(to)); | 189 array->set(index + kFirstCapture, Smi::FromInt(to)); |
190 } | 190 } |
191 | 191 |
192 static int GetLastCaptureCount(FixedArray* array) { | 192 static int GetLastCaptureCount(FixedArray* array) { |
193 return Smi::cast(array->get(kLastCaptureCount))->value(); | 193 return Smi::cast(array->get(kLastCaptureCount))->value(); |
194 } | 194 } |
195 | 195 |
196 // For acting on the JSRegExp data FixedArray. | 196 // For acting on the JSRegExp data FixedArray. |
197 static int IrregexpMaxRegisterCount(FixedArray* re); | 197 static int IrregexpMaxRegisterCount(FixedArray* re); |
198 static void SetIrregexpMaxRegisterCount(FixedArray* re, int value); | 198 static void SetIrregexpMaxRegisterCount(FixedArray* re, int value); |
| 199 static void SetIrregexpCaptureNameMap(FixedArray* re, |
| 200 Handle<FixedArray> value); |
199 static int IrregexpNumberOfCaptures(FixedArray* re); | 201 static int IrregexpNumberOfCaptures(FixedArray* re); |
200 static int IrregexpNumberOfRegisters(FixedArray* re); | 202 static int IrregexpNumberOfRegisters(FixedArray* re); |
201 static ByteArray* IrregexpByteCode(FixedArray* re, bool is_one_byte); | 203 static ByteArray* IrregexpByteCode(FixedArray* re, bool is_one_byte); |
202 static Code* IrregexpNativeCode(FixedArray* re, bool is_one_byte); | 204 static Code* IrregexpNativeCode(FixedArray* re, bool is_one_byte); |
203 | 205 |
204 // Limit the space regexps take up on the heap. In order to limit this we | 206 // Limit the space regexps take up on the heap. In order to limit this we |
205 // would like to keep track of the amount of regexp code on the heap. This | 207 // would like to keep track of the amount of regexp code on the heap. This |
206 // is not tracked, however. As a conservative approximation we track the | 208 // is not tracked, however. As a conservative approximation we track the |
207 // total regexp code compiled including code that has subsequently been freed | 209 // total regexp code compiled including code that has subsequently been freed |
208 // and the total executable memory at any point. | 210 // and the total executable memory at any point. |
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 RegExpCompileData() | 1525 RegExpCompileData() |
1524 : tree(NULL), | 1526 : tree(NULL), |
1525 node(NULL), | 1527 node(NULL), |
1526 simple(true), | 1528 simple(true), |
1527 contains_anchor(false), | 1529 contains_anchor(false), |
1528 capture_count(0) { } | 1530 capture_count(0) { } |
1529 RegExpTree* tree; | 1531 RegExpTree* tree; |
1530 RegExpNode* node; | 1532 RegExpNode* node; |
1531 bool simple; | 1533 bool simple; |
1532 bool contains_anchor; | 1534 bool contains_anchor; |
| 1535 Handle<FixedArray> capture_name_map; |
1533 Handle<String> error; | 1536 Handle<String> error; |
1534 int capture_count; | 1537 int capture_count; |
1535 }; | 1538 }; |
1536 | 1539 |
1537 | 1540 |
1538 class RegExpEngine: public AllStatic { | 1541 class RegExpEngine: public AllStatic { |
1539 public: | 1542 public: |
1540 struct CompilationResult { | 1543 struct CompilationResult { |
1541 CompilationResult(Isolate* isolate, const char* error_message) | 1544 CompilationResult(Isolate* isolate, const char* error_message) |
1542 : error_message(error_message), | 1545 : error_message(error_message), |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 static const int kStringOffset = 0; | 1586 static const int kStringOffset = 0; |
1584 static const int kPatternOffset = 1; | 1587 static const int kPatternOffset = 1; |
1585 static const int kArrayOffset = 2; | 1588 static const int kArrayOffset = 2; |
1586 static const int kLastMatchOffset = 3; | 1589 static const int kLastMatchOffset = 3; |
1587 }; | 1590 }; |
1588 | 1591 |
1589 } // namespace internal | 1592 } // namespace internal |
1590 } // namespace v8 | 1593 } // namespace v8 |
1591 | 1594 |
1592 #endif // V8_REGEXP_JSREGEXP_H_ | 1595 #endif // V8_REGEXP_JSREGEXP_H_ |
OLD | NEW |