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/handles.h" | 8 #include "src/handles.h" |
9 #include "src/scanner.h" | 9 #include "src/scanner.h" |
10 #include "src/vector.h" | 10 #include "src/vector.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 public: | 92 public: |
93 ExternalStreamingStream(ScriptCompiler::ExternalSourceStream* source_stream, | 93 ExternalStreamingStream(ScriptCompiler::ExternalSourceStream* source_stream, |
94 v8::ScriptCompiler::StreamedSource::Encoding encoding) | 94 v8::ScriptCompiler::StreamedSource::Encoding encoding) |
95 : source_stream_(source_stream), | 95 : source_stream_(source_stream), |
96 encoding_(encoding), | 96 encoding_(encoding), |
97 current_data_(NULL), | 97 current_data_(NULL), |
98 current_data_offset_(0), | 98 current_data_offset_(0), |
99 current_data_length_(0), | 99 current_data_length_(0), |
100 utf8_split_char_buffer_length_(0), | 100 utf8_split_char_buffer_length_(0), |
101 bookmark_(0), | 101 bookmark_(0), |
| 102 bookmark_data_is_from_current_data_(false), |
| 103 bookmark_data_offset_(0), |
102 bookmark_utf8_split_char_buffer_length_(0) {} | 104 bookmark_utf8_split_char_buffer_length_(0) {} |
103 | 105 |
104 virtual ~ExternalStreamingStream() { | 106 virtual ~ExternalStreamingStream() { |
105 delete[] current_data_; | 107 delete[] current_data_; |
106 bookmark_buffer_.Dispose(); | 108 bookmark_buffer_.Dispose(); |
107 bookmark_data_.Dispose(); | 109 bookmark_data_.Dispose(); |
108 } | 110 } |
109 | 111 |
110 size_t BufferSeekForward(size_t delta) override { | 112 size_t BufferSeekForward(size_t delta) override { |
111 // We never need to seek forward when streaming scripts. We only seek | 113 // We never need to seek forward when streaming scripts. We only seek |
(...skipping 20 matching lines...) Expand all Loading... |
132 size_t current_data_length_; | 134 size_t current_data_length_; |
133 // For converting UTF-8 characters which are split across two data chunks. | 135 // For converting UTF-8 characters which are split across two data chunks. |
134 uint8_t utf8_split_char_buffer_[4]; | 136 uint8_t utf8_split_char_buffer_[4]; |
135 size_t utf8_split_char_buffer_length_; | 137 size_t utf8_split_char_buffer_length_; |
136 | 138 |
137 // Bookmark support. See comments in ExternalStreamingStream::SetBookmark | 139 // Bookmark support. See comments in ExternalStreamingStream::SetBookmark |
138 // for additional details. | 140 // for additional details. |
139 size_t bookmark_; | 141 size_t bookmark_; |
140 Vector<uint16_t> bookmark_buffer_; | 142 Vector<uint16_t> bookmark_buffer_; |
141 Vector<uint8_t> bookmark_data_; | 143 Vector<uint8_t> bookmark_data_; |
| 144 bool bookmark_data_is_from_current_data_; |
| 145 size_t bookmark_data_offset_; |
142 uint8_t bookmark_utf8_split_char_buffer_[4]; | 146 uint8_t bookmark_utf8_split_char_buffer_[4]; |
143 size_t bookmark_utf8_split_char_buffer_length_; | 147 size_t bookmark_utf8_split_char_buffer_length_; |
144 }; | 148 }; |
145 | 149 |
146 | 150 |
147 // UTF16 buffer to read characters from an external string. | 151 // UTF16 buffer to read characters from an external string. |
148 class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream { | 152 class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream { |
149 public: | 153 public: |
150 ExternalTwoByteStringUtf16CharacterStream(Handle<ExternalTwoByteString> data, | 154 ExternalTwoByteStringUtf16CharacterStream(Handle<ExternalTwoByteString> data, |
151 int start_position, | 155 int start_position, |
(...skipping 23 matching lines...) Expand all Loading... |
175 | 179 |
176 private: | 180 private: |
177 static const size_t kNoBookmark = -1; | 181 static const size_t kNoBookmark = -1; |
178 | 182 |
179 size_t bookmark_; | 183 size_t bookmark_; |
180 }; | 184 }; |
181 | 185 |
182 } } // namespace v8::internal | 186 } } // namespace v8::internal |
183 | 187 |
184 #endif // V8_SCANNER_CHARACTER_STREAMS_H_ | 188 #endif // V8_SCANNER_CHARACTER_STREAMS_H_ |
OLD | NEW |