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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 v8::ScriptCompiler::StreamedSource::Encoding encoding) | 84 v8::ScriptCompiler::StreamedSource::Encoding encoding) |
85 : source_stream_(source_stream), | 85 : source_stream_(source_stream), |
86 encoding_(encoding), | 86 encoding_(encoding), |
87 current_data_(NULL), | 87 current_data_(NULL), |
88 current_data_offset_(0), | 88 current_data_offset_(0), |
89 current_data_length_(0), | 89 current_data_length_(0), |
90 utf8_split_char_buffer_length_(0) {} | 90 utf8_split_char_buffer_length_(0) {} |
91 | 91 |
92 virtual ~ExternalStreamingStream() { delete[] current_data_; } | 92 virtual ~ExternalStreamingStream() { delete[] current_data_; } |
93 | 93 |
94 virtual unsigned BufferSeekForward(unsigned delta) OVERRIDE { | 94 unsigned BufferSeekForward(unsigned delta) OVERRIDE { |
95 // We never need to seek forward when streaming scripts. We only seek | 95 // We never need to seek forward when streaming scripts. We only seek |
96 // forward when we want to parse a function whose location we already know, | 96 // forward when we want to parse a function whose location we already know, |
97 // and when streaming, we don't know the locations of anything we haven't | 97 // and when streaming, we don't know the locations of anything we haven't |
98 // seen yet. | 98 // seen yet. |
99 UNREACHABLE(); | 99 UNREACHABLE(); |
100 return 0; | 100 return 0; |
101 } | 101 } |
102 | 102 |
103 virtual unsigned FillBuffer(unsigned position) OVERRIDE; | 103 unsigned FillBuffer(unsigned position) OVERRIDE; |
104 | 104 |
105 private: | 105 private: |
106 void HandleUtf8SplitCharacters(unsigned* data_in_buffer); | 106 void HandleUtf8SplitCharacters(unsigned* data_in_buffer); |
107 | 107 |
108 ScriptCompiler::ExternalSourceStream* source_stream_; | 108 ScriptCompiler::ExternalSourceStream* source_stream_; |
109 v8::ScriptCompiler::StreamedSource::Encoding encoding_; | 109 v8::ScriptCompiler::StreamedSource::Encoding encoding_; |
110 const uint8_t* current_data_; | 110 const uint8_t* current_data_; |
111 unsigned current_data_offset_; | 111 unsigned current_data_offset_; |
112 unsigned current_data_length_; | 112 unsigned current_data_length_; |
113 // For converting UTF-8 characters which are split across two data chunks. | 113 // For converting UTF-8 characters which are split across two data chunks. |
(...skipping 25 matching lines...) Expand all Loading... |
139 // Entire string is read at start. | 139 // Entire string is read at start. |
140 return false; | 140 return false; |
141 } | 141 } |
142 Handle<ExternalTwoByteString> source_; | 142 Handle<ExternalTwoByteString> source_; |
143 const uc16* raw_data_; // Pointer to the actual array of characters. | 143 const uc16* raw_data_; // Pointer to the actual array of characters. |
144 }; | 144 }; |
145 | 145 |
146 } } // namespace v8::internal | 146 } } // namespace v8::internal |
147 | 147 |
148 #endif // V8_SCANNER_CHARACTER_STREAMS_H_ | 148 #endif // V8_SCANNER_CHARACTER_STREAMS_H_ |
OLD | NEW |