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/objects.h

Issue 2776293003: Revert of [regexp] Named capture support for string replacements (Closed)
Patch Set: Created 3 years, 8 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 | « src/messages.h ('k') | src/objects.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 8251 matching lines...) Expand 10 before | Expand all | Expand 10 after
8262 Flags flags); 8262 Flags flags);
8263 static Handle<JSRegExp> Copy(Handle<JSRegExp> regexp); 8263 static Handle<JSRegExp> Copy(Handle<JSRegExp> regexp);
8264 8264
8265 static MaybeHandle<JSRegExp> Initialize(Handle<JSRegExp> regexp, 8265 static MaybeHandle<JSRegExp> Initialize(Handle<JSRegExp> regexp,
8266 Handle<String> source, Flags flags); 8266 Handle<String> source, Flags flags);
8267 static MaybeHandle<JSRegExp> Initialize(Handle<JSRegExp> regexp, 8267 static MaybeHandle<JSRegExp> Initialize(Handle<JSRegExp> regexp,
8268 Handle<String> source, 8268 Handle<String> source,
8269 Handle<String> flags_string); 8269 Handle<String> flags_string);
8270 8270
8271 inline Type TypeTag(); 8271 inline Type TypeTag();
8272 // Number of captures (without the match itself).
8273 inline int CaptureCount(); 8272 inline int CaptureCount();
8274 inline Flags GetFlags(); 8273 inline Flags GetFlags();
8275 inline String* Pattern(); 8274 inline String* Pattern();
8276 inline Object* CaptureNameMap(); 8275 inline Object* CaptureNameMap();
8277 inline Object* DataAt(int index); 8276 inline Object* DataAt(int index);
8278 // Set implementation data after the object has been prepared. 8277 // Set implementation data after the object has been prepared.
8279 inline void SetDataAt(int index, Object* value); 8278 inline void SetDataAt(int index, Object* value);
8280 8279
8281 inline void SetLastIndex(int index); 8280 inline void SetLastIndex(int index);
8282 inline Object* LastIndex(); 8281 inline Object* LastIndex();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
8335 // Saved instance of Irregexp compiled code or bytecode for UC16 that is 8334 // Saved instance of Irregexp compiled code or bytecode for UC16 that is
8336 // a potential candidate for flushing. 8335 // a potential candidate for flushing.
8337 static const int kIrregexpUC16CodeSavedIndex = kDataIndex + 3; 8336 static const int kIrregexpUC16CodeSavedIndex = kDataIndex + 3;
8338 8337
8339 // Maximal number of registers used by either Latin1 or UC16. 8338 // Maximal number of registers used by either Latin1 or UC16.
8340 // Only used to check that there is enough stack space 8339 // Only used to check that there is enough stack space
8341 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 4; 8340 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 4;
8342 // Number of captures in the compiled regexp. 8341 // Number of captures in the compiled regexp.
8343 static const int kIrregexpCaptureCountIndex = kDataIndex + 5; 8342 static const int kIrregexpCaptureCountIndex = kDataIndex + 5;
8344 // Maps names of named capture groups (at indices 2i) to their corresponding 8343 // Maps names of named capture groups (at indices 2i) to their corresponding
8345 // (1-based) capture group indices (at indices 2i + 1). 8344 // capture group indices (at indices 2i + 1).
8346 static const int kIrregexpCaptureNameMapIndex = kDataIndex + 6; 8345 static const int kIrregexpCaptureNameMapIndex = kDataIndex + 6;
8347 8346
8348 static const int kIrregexpDataSize = kIrregexpCaptureNameMapIndex + 1; 8347 static const int kIrregexpDataSize = kIrregexpCaptureNameMapIndex + 1;
8349 8348
8350 // In-object fields. 8349 // In-object fields.
8351 static const int kLastIndexFieldIndex = 0; 8350 static const int kLastIndexFieldIndex = 0;
8352 static const int kInObjectFieldCount = 1; 8351 static const int kInObjectFieldCount = 1;
8353 8352
8354 // The uninitialized value for a regexp code object. 8353 // The uninitialized value for a regexp code object.
8355 static const int kUninitializedValue = -1; 8354 static const int kUninitializedValue = -1;
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
9190 Handle<String> search, int start_index); 9189 Handle<String> search, int start_index);
9191 9190
9192 static Object* LastIndexOf(Isolate* isolate, Handle<Object> receiver, 9191 static Object* LastIndexOf(Isolate* isolate, Handle<Object> receiver,
9193 Handle<Object> search, Handle<Object> position); 9192 Handle<Object> search, Handle<Object> position);
9194 9193
9195 // Encapsulates logic related to a match and its capture groups as required 9194 // Encapsulates logic related to a match and its capture groups as required
9196 // by GetSubstitution. 9195 // by GetSubstitution.
9197 class Match { 9196 class Match {
9198 public: 9197 public:
9199 virtual Handle<String> GetMatch() = 0; 9198 virtual Handle<String> GetMatch() = 0;
9199 virtual MaybeHandle<String> GetCapture(int i, bool* capture_exists) = 0;
9200 virtual Handle<String> GetPrefix() = 0; 9200 virtual Handle<String> GetPrefix() = 0;
9201 virtual Handle<String> GetSuffix() = 0; 9201 virtual Handle<String> GetSuffix() = 0;
9202
9203 virtual int CaptureCount() = 0; 9202 virtual int CaptureCount() = 0;
9204 virtual bool HasNamedCaptures() = 0;
9205 virtual MaybeHandle<String> GetCapture(int i, bool* capture_exists) = 0;
9206 virtual MaybeHandle<String> GetNamedCapture(Handle<String> name,
9207 bool* capture_exists) = 0;
9208
9209 virtual ~Match() {} 9203 virtual ~Match() {}
9210 }; 9204 };
9211 9205
9212 // ES#sec-getsubstitution 9206 // ES#sec-getsubstitution
9213 // GetSubstitution(matched, str, position, captures, replacement) 9207 // GetSubstitution(matched, str, position, captures, replacement)
9214 // Expand the $-expressions in the string and return a new string with 9208 // Expand the $-expressions in the string and return a new string with
9215 // the result. 9209 // the result.
9216 MUST_USE_RESULT static MaybeHandle<String> GetSubstitution( 9210 MUST_USE_RESULT static MaybeHandle<String> GetSubstitution(
9217 Isolate* isolate, Match* match, Handle<String> replacement); 9211 Isolate* isolate, Match* match, Handle<String> replacement);
9218 9212
9219 // String equality operations. 9213 // String equality operations.
9220 inline bool Equals(String* other); 9214 inline bool Equals(String* other);
9221 inline static bool Equals(Handle<String> one, Handle<String> two); 9215 inline static bool Equals(Handle<String> one, Handle<String> two);
9222 bool IsUtf8EqualTo(Vector<const char> str, bool allow_prefix_match = false); 9216 bool IsUtf8EqualTo(Vector<const char> str, bool allow_prefix_match = false);
9223
9224 // Dispatches to Is{One,Two}ByteEqualTo.
9225 template <typename Char>
9226 bool IsEqualTo(Vector<const Char> str);
9227
9228 bool IsOneByteEqualTo(Vector<const uint8_t> str); 9217 bool IsOneByteEqualTo(Vector<const uint8_t> str);
9229 bool IsTwoByteEqualTo(Vector<const uc16> str); 9218 bool IsTwoByteEqualTo(Vector<const uc16> str);
9230 9219
9231 // Return a UTF8 representation of the string. The string is null 9220 // Return a UTF8 representation of the string. The string is null
9232 // terminated but may optionally contain nulls. Length is returned 9221 // terminated but may optionally contain nulls. Length is returned
9233 // in length_output if length_output is not a null pointer The string 9222 // in length_output if length_output is not a null pointer The string
9234 // should be nearly flat, otherwise the performance of this method may 9223 // should be nearly flat, otherwise the performance of this method may
9235 // be very slow (quadratic in the length). Setting robustness_flag to 9224 // be very slow (quadratic in the length). Setting robustness_flag to
9236 // ROBUST_STRING_TRAVERSAL invokes behaviour that is robust This means it 9225 // ROBUST_STRING_TRAVERSAL invokes behaviour that is robust This means it
9237 // handles unexpected data without causing assert failures and it does not 9226 // handles unexpected data without causing assert failures and it does not
(...skipping 2091 matching lines...) Expand 10 before | Expand all | Expand 10 after
11329 } 11318 }
11330 }; 11319 };
11331 11320
11332 11321
11333 } // NOLINT, false-positive due to second-order macros. 11322 } // NOLINT, false-positive due to second-order macros.
11334 } // NOLINT, false-positive due to second-order macros. 11323 } // NOLINT, false-positive due to second-order macros.
11335 11324
11336 #include "src/objects/object-macros-undef.h" 11325 #include "src/objects/object-macros-undef.h"
11337 11326
11338 #endif // V8_OBJECTS_H_ 11327 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/messages.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698