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

Side by Side Diff: src/objects.h

Issue 2398423002: [regexp] Port RegExp.prototype[@@replace] (Closed)
Patch Set: Smi::kZero 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
« no previous file with comments | « src/js/regexp.js ('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 9466 matching lines...) Expand 10 before | Expand all | Expand 10 after
9477 Handle<Object> search, Handle<Object> position); 9477 Handle<Object> search, Handle<Object> position);
9478 // Perform string match of pattern on subject, starting at start index. 9478 // Perform string match of pattern on subject, starting at start index.
9479 // Caller must ensure that 0 <= start_index <= sub->length(), as this does not 9479 // Caller must ensure that 0 <= start_index <= sub->length(), as this does not
9480 // check any arguments. 9480 // check any arguments.
9481 static int IndexOf(Isolate* isolate, Handle<String> receiver, 9481 static int IndexOf(Isolate* isolate, Handle<String> receiver,
9482 Handle<String> search, int start_index); 9482 Handle<String> search, int start_index);
9483 9483
9484 static Object* LastIndexOf(Isolate* isolate, Handle<Object> receiver, 9484 static Object* LastIndexOf(Isolate* isolate, Handle<Object> receiver,
9485 Handle<Object> search, Handle<Object> position); 9485 Handle<Object> search, Handle<Object> position);
9486 9486
9487 // Encapsulates logic related to a match and its capture groups as required
9488 // by GetSubstitution.
9489 class Match {
9490 public:
9491 virtual Handle<String> GetMatch() = 0;
9492 virtual MaybeHandle<String> GetCapture(int i, bool* capture_exists) = 0;
9493 virtual Handle<String> GetPrefix() = 0;
9494 virtual Handle<String> GetSuffix() = 0;
9495 virtual int CaptureCount() = 0;
9496 virtual ~Match() {}
9497 };
9498
9499 // ES#sec-getsubstitution
9500 // GetSubstitution(matched, str, position, captures, replacement)
9501 // Expand the $-expressions in the string and return a new string with
9502 // the result.
9503 MUST_USE_RESULT static MaybeHandle<String> GetSubstitution(
9504 Isolate* isolate, Match* match, Handle<String> replacement);
9505
9487 // String equality operations. 9506 // String equality operations.
9488 inline bool Equals(String* other); 9507 inline bool Equals(String* other);
9489 inline static bool Equals(Handle<String> one, Handle<String> two); 9508 inline static bool Equals(Handle<String> one, Handle<String> two);
9490 bool IsUtf8EqualTo(Vector<const char> str, bool allow_prefix_match = false); 9509 bool IsUtf8EqualTo(Vector<const char> str, bool allow_prefix_match = false);
9491 bool IsOneByteEqualTo(Vector<const uint8_t> str); 9510 bool IsOneByteEqualTo(Vector<const uint8_t> str);
9492 bool IsTwoByteEqualTo(Vector<const uc16> str); 9511 bool IsTwoByteEqualTo(Vector<const uc16> str);
9493 9512
9494 // Return a UTF8 representation of the string. The string is null 9513 // Return a UTF8 representation of the string. The string is null
9495 // terminated but may optionally contain nulls. Length is returned 9514 // terminated but may optionally contain nulls. Length is returned
9496 // in length_output if length_output is not a null pointer The string 9515 // in length_output if length_output is not a null pointer The string
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after
11475 } 11494 }
11476 return value; 11495 return value;
11477 } 11496 }
11478 }; 11497 };
11479 11498
11480 11499
11481 } // NOLINT, false-positive due to second-order macros. 11500 } // NOLINT, false-positive due to second-order macros.
11482 } // NOLINT, false-positive due to second-order macros. 11501 } // NOLINT, false-positive due to second-order macros.
11483 11502
11484 #endif // V8_OBJECTS_H_ 11503 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/js/regexp.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698