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

Side by Side Diff: src/objects.h

Issue 2398423002: [regexp] Port RegExp.prototype[@@replace] (Closed)
Patch Set: Tweaks in string code-stub-assembler methods Created 4 years, 2 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
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 9397 matching lines...) Expand 10 before | Expand all | Expand 10 after
9408 Handle<String> y); 9408 Handle<String> y);
9409 9409
9410 // Perform string match of pattern on subject, starting at start index. 9410 // Perform string match of pattern on subject, starting at start index.
9411 // Caller must ensure that 0 <= start_index <= sub->length(). 9411 // Caller must ensure that 0 <= start_index <= sub->length().
9412 static int IndexOf(Isolate* isolate, Handle<String> sub, Handle<String> pat, 9412 static int IndexOf(Isolate* isolate, Handle<String> sub, Handle<String> pat,
9413 int start_index); 9413 int start_index);
9414 9414
9415 static Object* LastIndexOf(Isolate* isolate, Handle<Object> receiver, 9415 static Object* LastIndexOf(Isolate* isolate, Handle<Object> receiver,
9416 Handle<Object> search, Handle<Object> position); 9416 Handle<Object> search, Handle<Object> position);
9417 9417
9418 // Encapsulates logic related to a match and its capture groups as required
9419 // by GetSubstitution.
9420 class Match {
9421 public:
9422 virtual Handle<String> GetMatch() = 0;
9423 virtual MaybeHandle<String> GetCapture(int i, bool* capture_exists) = 0;
9424 virtual Handle<String> GetPrefix() = 0;
9425 virtual Handle<String> GetSuffix() = 0;
9426 virtual int CaptureCount() = 0;
9427 virtual ~Match() {}
9428 };
9429
9430 // ES#sec-getsubstitution
9431 // GetSubstitution(matched, str, position, captures, replacement)
9432 // Expand the $-expressions in the string and return a new string with
9433 // the result.
9434 MUST_USE_RESULT static MaybeHandle<String> GetSubstitution(
9435 Isolate* isolate, Match* match, Handle<String> replacement);
9436
9418 // String equality operations. 9437 // String equality operations.
9419 inline bool Equals(String* other); 9438 inline bool Equals(String* other);
9420 inline static bool Equals(Handle<String> one, Handle<String> two); 9439 inline static bool Equals(Handle<String> one, Handle<String> two);
9421 bool IsUtf8EqualTo(Vector<const char> str, bool allow_prefix_match = false); 9440 bool IsUtf8EqualTo(Vector<const char> str, bool allow_prefix_match = false);
9422 bool IsOneByteEqualTo(Vector<const uint8_t> str); 9441 bool IsOneByteEqualTo(Vector<const uint8_t> str);
9423 bool IsTwoByteEqualTo(Vector<const uc16> str); 9442 bool IsTwoByteEqualTo(Vector<const uc16> str);
9424 9443
9425 // Return a UTF8 representation of the string. The string is null 9444 // Return a UTF8 representation of the string. The string is null
9426 // terminated but may optionally contain nulls. Length is returned 9445 // terminated but may optionally contain nulls. Length is returned
9427 // in length_output if length_output is not a null pointer The string 9446 // in length_output if length_output is not a null pointer The string
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after
11408 } 11427 }
11409 return value; 11428 return value;
11410 } 11429 }
11411 }; 11430 };
11412 11431
11413 11432
11414 } // NOLINT, false-positive due to second-order macros. 11433 } // NOLINT, false-positive due to second-order macros.
11415 } // NOLINT, false-positive due to second-order macros. 11434 } // NOLINT, false-positive due to second-order macros.
11416 11435
11417 #endif // V8_OBJECTS_H_ 11436 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698