OLD | NEW |
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_SCANNER_CHARACTER_STREAMS_H_ | 5 #ifndef V8_SCANNER_CHARACTER_STREAMS_H_ |
6 #define V8_SCANNER_CHARACTER_STREAMS_H_ | 6 #define V8_SCANNER_CHARACTER_STREAMS_H_ |
7 | 7 |
8 #include "src/scanner.h" | 8 #include "src/scanner.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 class ExternalStreamingStream : public BufferedUtf16CharacterStream { | 86 class ExternalStreamingStream : public BufferedUtf16CharacterStream { |
87 public: | 87 public: |
88 ExternalStreamingStream(ScriptCompiler::ExternalSourceStream* source_stream, | 88 ExternalStreamingStream(ScriptCompiler::ExternalSourceStream* source_stream, |
89 v8::ScriptCompiler::StreamedSource::Encoding encoding) | 89 v8::ScriptCompiler::StreamedSource::Encoding encoding) |
90 : source_stream_(source_stream), | 90 : source_stream_(source_stream), |
91 encoding_(encoding), | 91 encoding_(encoding), |
92 current_data_(NULL), | 92 current_data_(NULL), |
93 current_data_offset_(0), | 93 current_data_offset_(0), |
94 current_data_length_(0), | 94 current_data_length_(0), |
95 utf8_split_char_buffer_length_(0), | 95 utf8_split_char_buffer_length_(0), |
96 bookmark_(0) {} | 96 bookmark_(0), |
| 97 bookmark_utf8_split_char_buffer_length_(0) {} |
97 | 98 |
98 virtual ~ExternalStreamingStream() { | 99 virtual ~ExternalStreamingStream() { |
99 delete[] current_data_; | 100 delete[] current_data_; |
100 bookmark_buffer_.Dispose(); | 101 bookmark_buffer_.Dispose(); |
101 bookmark_data_.Dispose(); | 102 bookmark_data_.Dispose(); |
102 } | 103 } |
103 | 104 |
104 size_t BufferSeekForward(size_t delta) override { | 105 size_t BufferSeekForward(size_t delta) override { |
105 // We never need to seek forward when streaming scripts. We only seek | 106 // We never need to seek forward when streaming scripts. We only seek |
106 // forward when we want to parse a function whose location we already know, | 107 // forward when we want to parse a function whose location we already know, |
(...skipping 19 matching lines...) Expand all Loading... |
126 size_t current_data_length_; | 127 size_t current_data_length_; |
127 // For converting UTF-8 characters which are split across two data chunks. | 128 // For converting UTF-8 characters which are split across two data chunks. |
128 uint8_t utf8_split_char_buffer_[4]; | 129 uint8_t utf8_split_char_buffer_[4]; |
129 size_t utf8_split_char_buffer_length_; | 130 size_t utf8_split_char_buffer_length_; |
130 | 131 |
131 // Bookmark support. See comments in ExternalStreamingStream::SetBookmark | 132 // Bookmark support. See comments in ExternalStreamingStream::SetBookmark |
132 // for additional details. | 133 // for additional details. |
133 size_t bookmark_; | 134 size_t bookmark_; |
134 Vector<uint16_t> bookmark_buffer_; | 135 Vector<uint16_t> bookmark_buffer_; |
135 Vector<uint8_t> bookmark_data_; | 136 Vector<uint8_t> bookmark_data_; |
| 137 uint8_t bookmark_utf8_split_char_buffer_[4]; |
| 138 size_t bookmark_utf8_split_char_buffer_length_; |
136 }; | 139 }; |
137 | 140 |
138 | 141 |
139 // UTF16 buffer to read characters from an external string. | 142 // UTF16 buffer to read characters from an external string. |
140 class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream { | 143 class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream { |
141 public: | 144 public: |
142 ExternalTwoByteStringUtf16CharacterStream(Handle<ExternalTwoByteString> data, | 145 ExternalTwoByteStringUtf16CharacterStream(Handle<ExternalTwoByteString> data, |
143 int start_position, | 146 int start_position, |
144 int end_position); | 147 int end_position); |
145 virtual ~ExternalTwoByteStringUtf16CharacterStream(); | 148 virtual ~ExternalTwoByteStringUtf16CharacterStream(); |
(...skipping 21 matching lines...) Expand all Loading... |
167 | 170 |
168 private: | 171 private: |
169 static const size_t kNoBookmark = -1; | 172 static const size_t kNoBookmark = -1; |
170 | 173 |
171 size_t bookmark_; | 174 size_t bookmark_; |
172 }; | 175 }; |
173 | 176 |
174 } } // namespace v8::internal | 177 } } // namespace v8::internal |
175 | 178 |
176 #endif // V8_SCANNER_CHARACTER_STREAMS_H_ | 179 #endif // V8_SCANNER_CHARACTER_STREAMS_H_ |
OLD | NEW |