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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 // UTF16 buffer to read characters from an external string. | 76 // UTF16 buffer to read characters from an external string. |
77 class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream { | 77 class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream { |
78 public: | 78 public: |
79 ExternalTwoByteStringUtf16CharacterStream(Handle<ExternalTwoByteString> data, | 79 ExternalTwoByteStringUtf16CharacterStream(Handle<ExternalTwoByteString> data, |
80 int start_position, | 80 int start_position, |
81 int end_position); | 81 int end_position); |
82 virtual ~ExternalTwoByteStringUtf16CharacterStream(); | 82 virtual ~ExternalTwoByteStringUtf16CharacterStream(); |
83 | 83 |
84 virtual void PushBack(uc32 character) { | 84 virtual void PushBack(uc32 character) { |
85 ASSERT(buffer_cursor_ > raw_data_); | 85 DCHECK(buffer_cursor_ > raw_data_); |
86 buffer_cursor_--; | 86 buffer_cursor_--; |
87 pos_--; | 87 pos_--; |
88 } | 88 } |
89 | 89 |
90 protected: | 90 protected: |
91 virtual unsigned SlowSeekForward(unsigned delta) { | 91 virtual unsigned SlowSeekForward(unsigned delta) { |
92 // Fast case always handles seeking. | 92 // Fast case always handles seeking. |
93 return 0; | 93 return 0; |
94 } | 94 } |
95 virtual bool ReadBlock() { | 95 virtual bool ReadBlock() { |
96 // Entire string is read at start. | 96 // Entire string is read at start. |
97 return false; | 97 return false; |
98 } | 98 } |
99 Handle<ExternalTwoByteString> source_; | 99 Handle<ExternalTwoByteString> source_; |
100 const uc16* raw_data_; // Pointer to the actual array of characters. | 100 const uc16* raw_data_; // Pointer to the actual array of characters. |
101 }; | 101 }; |
102 | 102 |
103 } } // namespace v8::internal | 103 } } // namespace v8::internal |
104 | 104 |
105 #endif // V8_SCANNER_CHARACTER_STREAMS_H_ | 105 #endif // V8_SCANNER_CHARACTER_STREAMS_H_ |
OLD | NEW |