Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/jsregexp.h

Issue 1014005: Attempt at pre-calculating replace regexp matches. (Closed)
Patch Set: Reuse result array. Avoid using apply. Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 static void SetCapture(FixedArray* array, int index, int to) { 139 static void SetCapture(FixedArray* array, int index, int to) {
140 array->set(index + kFirstCapture, Smi::FromInt(to)); 140 array->set(index + kFirstCapture, Smi::FromInt(to));
141 } 141 }
142 142
143 static int GetLastCaptureCount(FixedArray* array) { 143 static int GetLastCaptureCount(FixedArray* array) {
144 return Smi::cast(array->get(kLastCaptureCount))->value(); 144 return Smi::cast(array->get(kLastCaptureCount))->value();
145 } 145 }
146 146
147 // For acting on the JSRegExp data FixedArray. 147 // For acting on the JSRegExp data FixedArray.
148 static bool RegExpIsAtom(FixedArray* re) {
149 return re->get(JSRegExp::kTagIndex) == Smi::FromInt(JSRegExp::ATOM);
150 }
151 static int RegExpNumberOfCaptures(FixedArray* re) {
152 return (re->get(JSRegExp::kTagIndex) == Smi::FromInt(JSRegExp::ATOM))
153 ? 0
154 : IrregexpNumberOfCaptures(re);
155 }
148 static int IrregexpMaxRegisterCount(FixedArray* re); 156 static int IrregexpMaxRegisterCount(FixedArray* re);
149 static void SetIrregexpMaxRegisterCount(FixedArray* re, int value); 157 static void SetIrregexpMaxRegisterCount(FixedArray* re, int value);
150 static int IrregexpNumberOfCaptures(FixedArray* re); 158 static int IrregexpNumberOfCaptures(FixedArray* re);
151 static int IrregexpNumberOfRegisters(FixedArray* re); 159 static int IrregexpNumberOfRegisters(FixedArray* re);
152 static ByteArray* IrregexpByteCode(FixedArray* re, bool is_ascii); 160 static ByteArray* IrregexpByteCode(FixedArray* re, bool is_ascii);
153 static Code* IrregexpNativeCode(FixedArray* re, bool is_ascii); 161 static Code* IrregexpNativeCode(FixedArray* re, bool is_ascii);
154 162
155 private: 163 private:
156 static String* last_ascii_string_; 164 static String* last_ascii_string_;
157 static String* two_byte_cached_string_; 165 static String* two_byte_cached_string_;
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 int offsets_vector_length_; 1439 int offsets_vector_length_;
1432 static int static_offsets_vector_[kStaticOffsetsVectorSize]; 1440 static int static_offsets_vector_[kStaticOffsetsVectorSize];
1433 1441
1434 friend class ExternalReference; 1442 friend class ExternalReference;
1435 }; 1443 };
1436 1444
1437 1445
1438 } } // namespace v8::internal 1446 } } // namespace v8::internal
1439 1447
1440 #endif // V8_JSREGEXP_H_ 1448 #endif // V8_JSREGEXP_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698