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

Side by Side Diff: src/parsing/scanner-character-streams.h

Issue 1941843002: Fix ExternalTwobyteStringUtf16CharacterStream::PushBack(kEndOfInput) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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_PARSING_SCANNER_CHARACTER_STREAMS_H_ 5 #ifndef V8_PARSING_SCANNER_CHARACTER_STREAMS_H_
6 #define V8_PARSING_SCANNER_CHARACTER_STREAMS_H_ 6 #define V8_PARSING_SCANNER_CHARACTER_STREAMS_H_
7 7
8 #include "src/handles.h" 8 #include "src/handles.h"
9 #include "src/parsing/scanner.h" 9 #include "src/parsing/scanner.h"
10 #include "src/vector.h" 10 #include "src/vector.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // UTF16 buffer to read characters from an external string. 151 // UTF16 buffer to read characters from an external string.
152 class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream { 152 class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream {
153 public: 153 public:
154 ExternalTwoByteStringUtf16CharacterStream(Handle<ExternalTwoByteString> data, 154 ExternalTwoByteStringUtf16CharacterStream(Handle<ExternalTwoByteString> data,
155 int start_position, 155 int start_position,
156 int end_position); 156 int end_position);
157 ~ExternalTwoByteStringUtf16CharacterStream() override; 157 ~ExternalTwoByteStringUtf16CharacterStream() override;
158 158
159 void PushBack(uc32 character) override { 159 void PushBack(uc32 character) override {
160 DCHECK(buffer_cursor_ > raw_data_); 160 DCHECK(buffer_cursor_ > raw_data_);
161 buffer_cursor_--;
162 pos_--; 161 pos_--;
162 if (character != kEndOfInput) {
163 buffer_cursor_--;
164 }
163 } 165 }
164 166
165 bool SetBookmark() override; 167 bool SetBookmark() override;
166 void ResetToBookmark() override; 168 void ResetToBookmark() override;
167 169
168 protected: 170 protected:
169 size_t SlowSeekForward(size_t delta) override { 171 size_t SlowSeekForward(size_t delta) override {
170 // Fast case always handles seeking. 172 // Fast case always handles seeking.
171 return 0; 173 return 0;
172 } 174 }
173 bool ReadBlock() override { 175 bool ReadBlock() override {
174 // Entire string is read at start. 176 // Entire string is read at start.
175 return false; 177 return false;
176 } 178 }
177 Handle<ExternalTwoByteString> source_; 179 Handle<ExternalTwoByteString> source_;
178 const uc16* raw_data_; // Pointer to the actual array of characters. 180 const uc16* raw_data_; // Pointer to the actual array of characters.
179 181
180 private: 182 private:
181 static const size_t kNoBookmark = -1; 183 static const size_t kNoBookmark = -1;
182 184
183 size_t bookmark_; 185 size_t bookmark_;
184 }; 186 };
185 187
186 } // namespace internal 188 } // namespace internal
187 } // namespace v8 189 } // namespace v8
188 190
189 #endif // V8_PARSING_SCANNER_CHARACTER_STREAMS_H_ 191 #endif // V8_PARSING_SCANNER_CHARACTER_STREAMS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698