Chromium Code Reviews| 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 // Features shared by parsing and pre-parsing scanners. | 5 // Features shared by parsing and pre-parsing scanners. |
| 6 | 6 |
| 7 #ifndef V8_PARSING_SCANNER_H_ | 7 #ifndef V8_PARSING_SCANNER_H_ |
| 8 #define V8_PARSING_SCANNER_H_ | 8 #define V8_PARSING_SCANNER_H_ |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 | 155 |
| 156 class LiteralBuffer { | 156 class LiteralBuffer { |
| 157 public: | 157 public: |
| 158 LiteralBuffer() : is_one_byte_(true), position_(0), backing_store_() { } | 158 LiteralBuffer() : is_one_byte_(true), position_(0), backing_store_() { } |
| 159 | 159 |
| 160 ~LiteralBuffer() { backing_store_.Dispose(); } | 160 ~LiteralBuffer() { backing_store_.Dispose(); } |
| 161 | 161 |
| 162 INLINE(void AddChar(char code_unit)) { | 162 INLINE(void AddChar(char code_unit)) { |
| 163 if (position_ >= backing_store_.length()) ExpandBuffer(); | 163 if (position_ >= backing_store_.length()) ExpandBuffer(); |
| 164 DCHECK(is_one_byte_); | 164 DCHECK(is_one_byte_); |
| 165 DCHECK(0 <= code_unit && code_unit <= kMaxAscii); | 165 // DCHECK((0 < code_unit && code_unit <= kMaxAscii) || code_unit == 0); |
|
rmcilroy
2016/07/08 11:15:06
Remove comment?
oth
2016/07/10 15:34:16
Done.
| |
| 166 DCHECK(iscntrl(code_unit) || isprint(code_unit)); | |
| 166 backing_store_[position_] = static_cast<byte>(code_unit); | 167 backing_store_[position_] = static_cast<byte>(code_unit); |
| 167 position_ += kOneByteSize; | 168 position_ += kOneByteSize; |
| 168 return; | 169 return; |
| 169 } | 170 } |
| 170 | 171 |
| 171 INLINE(void AddChar(uc32 code_unit)) { | 172 INLINE(void AddChar(uc32 code_unit)) { |
| 172 if (position_ >= backing_store_.length()) ExpandBuffer(); | 173 if (position_ >= backing_store_.length()) ExpandBuffer(); |
| 173 if (is_one_byte_) { | 174 if (is_one_byte_) { |
| 174 if (code_unit <= unibrow::Latin1::kMaxChar) { | 175 if (code_unit <= unibrow::Latin1::kMaxChar) { |
| 175 backing_store_[position_] = static_cast<byte>(code_unit); | 176 backing_store_[position_] = static_cast<byte>(code_unit); |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 822 bool allow_harmony_exponentiation_operator_; | 823 bool allow_harmony_exponentiation_operator_; |
| 823 | 824 |
| 824 MessageTemplate::Template scanner_error_; | 825 MessageTemplate::Template scanner_error_; |
| 825 Location scanner_error_location_; | 826 Location scanner_error_location_; |
| 826 }; | 827 }; |
| 827 | 828 |
| 828 } // namespace internal | 829 } // namespace internal |
| 829 } // namespace v8 | 830 } // namespace v8 |
| 830 | 831 |
| 831 #endif // V8_PARSING_SCANNER_H_ | 832 #endif // V8_PARSING_SCANNER_H_ |
| OLD | NEW |