| Index: src/parsing/scanner.h
|
| diff --git a/src/parsing/scanner.h b/src/parsing/scanner.h
|
| index 0acc7ab019a1c7e033ec9160d905990b4419b1bf..a71770083d66efaef26de6b272533de4110d8228 100644
|
| --- a/src/parsing/scanner.h
|
| +++ b/src/parsing/scanner.h
|
| @@ -148,17 +148,27 @@ class DuplicateFinder {
|
| char number_buffer_[kBufferSize];
|
| };
|
|
|
| -
|
| // ----------------------------------------------------------------------------
|
| // LiteralBuffer - Collector of chars of literals.
|
|
|
| +const int kMaxAscii = 127;
|
| +
|
| class LiteralBuffer {
|
| public:
|
| LiteralBuffer() : is_one_byte_(true), position_(0), backing_store_() { }
|
|
|
| ~LiteralBuffer() { backing_store_.Dispose(); }
|
|
|
| - INLINE(void AddChar(uint32_t code_unit)) {
|
| + INLINE(void AddChar(char code_unit)) {
|
| + if (position_ >= backing_store_.length()) ExpandBuffer();
|
| + DCHECK(is_one_byte_);
|
| + DCHECK(0 <= code_unit && code_unit <= kMaxAscii);
|
| + backing_store_[position_] = static_cast<byte>(code_unit);
|
| + position_ += kOneByteSize;
|
| + return;
|
| + }
|
| +
|
| + INLINE(void AddChar(uc32 code_unit)) {
|
| if (position_ >= backing_store_.length()) ExpandBuffer();
|
| if (is_one_byte_) {
|
| if (code_unit <= unibrow::Latin1::kMaxChar) {
|
| @@ -557,6 +567,11 @@ class Scanner {
|
| next_.literal_chars->AddChar(c);
|
| }
|
|
|
| + INLINE(void AddLiteralChar(char c)) {
|
| + DCHECK_NOT_NULL(next_.literal_chars);
|
| + next_.literal_chars->AddChar(c);
|
| + }
|
| +
|
| INLINE(void AddRawLiteralChar(uc32 c)) {
|
| DCHECK_NOT_NULL(next_.raw_literal_chars);
|
| next_.raw_literal_chars->AddChar(c);
|
|
|