| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_data_is_from_current_data_(false), |
| 98 bookmark_data_offset_(0), |
| 97 bookmark_utf8_split_char_buffer_length_(0) {} | 99 bookmark_utf8_split_char_buffer_length_(0) {} |
| 98 | 100 |
| 99 virtual ~ExternalStreamingStream() { | 101 virtual ~ExternalStreamingStream() { |
| 100 delete[] current_data_; | 102 delete[] current_data_; |
| 101 bookmark_buffer_.Dispose(); | 103 bookmark_buffer_.Dispose(); |
| 102 bookmark_data_.Dispose(); | 104 bookmark_data_.Dispose(); |
| 103 } | 105 } |
| 104 | 106 |
| 105 size_t BufferSeekForward(size_t delta) override { | 107 size_t BufferSeekForward(size_t delta) override { |
| 106 // We never need to seek forward when streaming scripts. We only seek | 108 // We never need to seek forward when streaming scripts. We only seek |
| (...skipping 20 matching lines...) Expand all Loading... |
| 127 size_t current_data_length_; | 129 size_t current_data_length_; |
| 128 // For converting UTF-8 characters which are split across two data chunks. | 130 // For converting UTF-8 characters which are split across two data chunks. |
| 129 uint8_t utf8_split_char_buffer_[4]; | 131 uint8_t utf8_split_char_buffer_[4]; |
| 130 size_t utf8_split_char_buffer_length_; | 132 size_t utf8_split_char_buffer_length_; |
| 131 | 133 |
| 132 // Bookmark support. See comments in ExternalStreamingStream::SetBookmark | 134 // Bookmark support. See comments in ExternalStreamingStream::SetBookmark |
| 133 // for additional details. | 135 // for additional details. |
| 134 size_t bookmark_; | 136 size_t bookmark_; |
| 135 Vector<uint16_t> bookmark_buffer_; | 137 Vector<uint16_t> bookmark_buffer_; |
| 136 Vector<uint8_t> bookmark_data_; | 138 Vector<uint8_t> bookmark_data_; |
| 139 bool bookmark_data_is_from_current_data_; |
| 140 size_t bookmark_data_offset_; |
| 137 uint8_t bookmark_utf8_split_char_buffer_[4]; | 141 uint8_t bookmark_utf8_split_char_buffer_[4]; |
| 138 size_t bookmark_utf8_split_char_buffer_length_; | 142 size_t bookmark_utf8_split_char_buffer_length_; |
| 139 }; | 143 }; |
| 140 | 144 |
| 141 | 145 |
| 142 // UTF16 buffer to read characters from an external string. | 146 // UTF16 buffer to read characters from an external string. |
| 143 class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream { | 147 class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream { |
| 144 public: | 148 public: |
| 145 ExternalTwoByteStringUtf16CharacterStream(Handle<ExternalTwoByteString> data, | 149 ExternalTwoByteStringUtf16CharacterStream(Handle<ExternalTwoByteString> data, |
| 146 int start_position, | 150 int start_position, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 170 | 174 |
| 171 private: | 175 private: |
| 172 static const size_t kNoBookmark = -1; | 176 static const size_t kNoBookmark = -1; |
| 173 | 177 |
| 174 size_t bookmark_; | 178 size_t bookmark_; |
| 175 }; | 179 }; |
| 176 | 180 |
| 177 } } // namespace v8::internal | 181 } } // namespace v8::internal |
| 178 | 182 |
| 179 #endif // V8_SCANNER_CHARACTER_STREAMS_H_ | 183 #endif // V8_SCANNER_CHARACTER_STREAMS_H_ |
| OLD | NEW |