| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 Handle<JSArray> lastMatchInfo); | 105 Handle<JSArray> lastMatchInfo); |
| 106 | 106 |
| 107 static Handle<Object> IrregexpExecGlobal(Handle<JSRegExp> regexp, | 107 static Handle<Object> IrregexpExecGlobal(Handle<JSRegExp> regexp, |
| 108 Handle<String> subject, | 108 Handle<String> subject, |
| 109 Handle<JSArray> lastMatchInfo); | 109 Handle<JSArray> lastMatchInfo); |
| 110 | 110 |
| 111 // Offsets in the lastMatchInfo array. | 111 // Offsets in the lastMatchInfo array. |
| 112 static const int kLastCaptureCount = 0; | 112 static const int kLastCaptureCount = 0; |
| 113 static const int kLastSubject = 1; | 113 static const int kLastSubject = 1; |
| 114 static const int kLastInput = 2; | 114 static const int kLastInput = 2; |
| 115 static const int kFirstCapture = 1; | 115 static const int kFirstCapture = 3; |
| 116 static const int kLastMatchOverhead = 3; | 116 static const int kLastMatchOverhead = 3; |
| 117 | 117 |
| 118 // Used to access the lastMatchInfo array. | 118 // Used to access the lastMatchInfo array. |
| 119 static int GetCapture(FixedArray* array, int index) { | 119 static int GetCapture(FixedArray* array, int index) { |
| 120 return Smi::cast(array->get(index + kFirstCapture))->value(); | 120 return Smi::cast(array->get(index + kFirstCapture))->value(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 static void SetLastCaptureCount(FixedArray* array, int to) { | 123 static void SetLastCaptureCount(FixedArray* array, int to) { |
| 124 array->set(kLastCaptureCount, Smi::FromInt(to)); | 124 array->set(kLastCaptureCount, Smi::FromInt(to)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 static void SetLastSubject(FixedArray* array, String* to) { | 127 static void SetLastSubject(FixedArray* array, String* to) { |
| 128 int capture_count = GetLastCaptureCount(array); | 128 array->set(kLastSubject, to); |
| 129 array->set(capture_count + kLastSubject, to); | |
| 130 } | 129 } |
| 131 | 130 |
| 132 static void SetLastInput(FixedArray* array, String* to) { | 131 static void SetLastInput(FixedArray* array, String* to) { |
| 133 int capture_count = GetLastCaptureCount(array); | 132 array->set(kLastInput, to); |
| 134 array->set(capture_count + kLastInput, to); | |
| 135 } | 133 } |
| 136 | 134 |
| 137 static void SetCapture(FixedArray* array, int index, int to) { | 135 static void SetCapture(FixedArray* array, int index, int to) { |
| 138 array->set(index + kFirstCapture, Smi::FromInt(to)); | 136 array->set(index + kFirstCapture, Smi::FromInt(to)); |
| 139 } | 137 } |
| 140 | 138 |
| 141 static int GetLastCaptureCount(FixedArray* array) { | 139 static int GetLastCaptureCount(FixedArray* array) { |
| 142 return Smi::cast(array->get(kLastCaptureCount))->value(); | 140 return Smi::cast(array->get(kLastCaptureCount))->value(); |
| 143 } | 141 } |
| 144 | 142 |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 Handle<String> pattern, | 1379 Handle<String> pattern, |
| 1382 bool is_ascii); | 1380 bool is_ascii); |
| 1383 | 1381 |
| 1384 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); | 1382 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); |
| 1385 }; | 1383 }; |
| 1386 | 1384 |
| 1387 | 1385 |
| 1388 } } // namespace v8::internal | 1386 } } // namespace v8::internal |
| 1389 | 1387 |
| 1390 #endif // V8_JSREGEXP_H_ | 1388 #endif // V8_JSREGEXP_H_ |
| OLD | NEW |