Chromium Code Reviews| Index: src/scanner-character-streams.cc |
| diff --git a/src/scanner-character-streams.cc b/src/scanner-character-streams.cc |
| index cc4a18b540f3555a2ea53ab9b9c66147f9979b99..dbd1f548bf667211dbe59f7e22df7a35d2d4fc0d 100644 |
| --- a/src/scanner-character-streams.cc |
| +++ b/src/scanner-character-streams.cc |
| @@ -130,7 +130,7 @@ size_t BufferedUtf16CharacterStream::SlowSeekForward(size_t delta) { |
| GenericStringUtf16CharacterStream::GenericStringUtf16CharacterStream( |
| Handle<String> data, size_t start_position, size_t end_position) |
| - : string_(data), length_(end_position) { |
| + : string_(data), length_(end_position), bookmark_(start_position) { |
| DCHECK(end_position >= start_position); |
| pos_ = start_position; |
| } |
| @@ -139,6 +139,19 @@ GenericStringUtf16CharacterStream::GenericStringUtf16CharacterStream( |
| GenericStringUtf16CharacterStream::~GenericStringUtf16CharacterStream() { } |
| +bool GenericStringUtf16CharacterStream::SetBookmark() { |
| + bookmark_ = pos_; |
| + return true; |
| +} |
| + |
| + |
| +void GenericStringUtf16CharacterStream::ResetToBookmark() { |
| + pos_ = bookmark_; |
|
jochen (gone - plz use gerrit)
2015/04/30 13:20:18
why no DCHECK here?
vogelheim
2015/04/30 15:35:05
Done.
No big reason, really. For whatever reason
|
| + buffer_cursor_ = buffer_; |
| + buffer_end_ = buffer_ + FillBuffer(pos_); |
| +} |
| + |
| + |
| size_t GenericStringUtf16CharacterStream::BufferSeekForward(size_t delta) { |
| size_t old_pos = pos_; |
| pos_ = Min(pos_ + delta, length_); |
| @@ -447,17 +460,29 @@ ExternalTwoByteStringUtf16CharacterStream:: |
| ~ExternalTwoByteStringUtf16CharacterStream() { } |
| -ExternalTwoByteStringUtf16CharacterStream |
| - ::ExternalTwoByteStringUtf16CharacterStream( |
| - Handle<ExternalTwoByteString> data, |
| - int start_position, |
| +ExternalTwoByteStringUtf16CharacterStream:: |
| + ExternalTwoByteStringUtf16CharacterStream( |
| + Handle<ExternalTwoByteString> data, int start_position, |
| int end_position) |
| : Utf16CharacterStream(), |
| source_(data), |
| - raw_data_(data->GetTwoByteData(start_position)) { |
| + raw_data_(data->GetTwoByteData(start_position)), |
| + bookmark_(kNoBookmark) { |
| buffer_cursor_ = raw_data_, |
| buffer_end_ = raw_data_ + (end_position - start_position); |
| pos_ = start_position; |
| } |
| + |
| +bool ExternalTwoByteStringUtf16CharacterStream::SetBookmark() { |
| + bookmark_ = pos_; |
| + return true; |
| +} |
| + |
| + |
| +void ExternalTwoByteStringUtf16CharacterStream::ResetToBookmark() { |
| + DCHECK(bookmark_ != kNoBookmark); |
| + pos_ = bookmark_; |
| + buffer_cursor_ = raw_data_ + bookmark_; |
| +} |
| } } // namespace v8::internal |