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

Unified Diff: src/scanner-character-streams.cc

Issue 214883002: Two-threaded parser (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: code review (svenpanne) Created 6 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 side-by-side diff with in-line comments
Download patch
Index: src/scanner-character-streams.cc
diff --git a/src/scanner-character-streams.cc b/src/scanner-character-streams.cc
index 201b597fb72d92365e17a1f3fb7e5e1866c67e15..d42e86a1a3c2db370d33b765fd031017495f51f5 100644
--- a/src/scanner-character-streams.cc
+++ b/src/scanner-character-streams.cc
@@ -307,17 +307,52 @@ ExternalTwoByteStringUtf16CharacterStream::
~ExternalTwoByteStringUtf16CharacterStream() { }
-ExternalTwoByteStringUtf16CharacterStream
- ::ExternalTwoByteStringUtf16CharacterStream(
- Handle<ExternalTwoByteString> data,
- int start_position,
- int end_position)
- : Utf16CharacterStream(),
- source_(data),
- raw_data_(data->GetTwoByteData(start_position)) {
- buffer_cursor_ = raw_data_,
+ExternalTwoByteStringUtf16CharacterStream::
+ ExternalTwoByteStringUtf16CharacterStream(const uint16_t* raw_data,
+ int start_position,
+ int end_position)
+ : Utf16CharacterStream(), raw_data_(raw_data + start_position) {
+ buffer_cursor_ = raw_data_;
buffer_end_ = raw_data_ + (end_position - start_position);
pos_ = start_position;
}
+
+// ----------------------------------------------------------------------------
+// ExternalOneByteStringUtf16CharacterStream
+
+ExternalOneByteStringUtf16CharacterStream::
+ ExternalOneByteStringUtf16CharacterStream(const uint8_t* raw_data,
+ int start_position,
+ int end_position)
+ : raw_data_(raw_data + start_position),
+ length_(end_position) {
+ pos_ = start_position;
+}
+
+
+ExternalOneByteStringUtf16CharacterStream::
+ ~ExternalOneByteStringUtf16CharacterStream() {}
+
+
+unsigned ExternalOneByteStringUtf16CharacterStream::BufferSeekForward(
+ unsigned delta) {
+ unsigned old_pos = pos_;
+ pos_ = Min(pos_ + delta, length_);
+ ReadBlock();
+ return pos_ - old_pos;
+}
+
+
+unsigned ExternalOneByteStringUtf16CharacterStream::FillBuffer(
+ unsigned from_pos, unsigned length) {
+ if (from_pos >= length_) return 0;
+ if (from_pos + length > length_) {
+ length = length_ - from_pos;
+ }
+ CopyChars(buffer_, raw_data_ + from_pos, length);
+ return length;
+}
+
+
} } // namespace v8::internal

Powered by Google App Engine
This is Rietveld 408576698