OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 StaticResource<Utf8Decoder>* utf8_decoder() { | 128 StaticResource<Utf8Decoder>* utf8_decoder() { |
129 return &utf8_decoder_; | 129 return &utf8_decoder_; |
130 } | 130 } |
131 | 131 |
132 bool IsIdentifierStart(unibrow::uchar c) { return kIsIdentifierStart.get(c); } | 132 bool IsIdentifierStart(unibrow::uchar c) { return kIsIdentifierStart.get(c); } |
133 bool IsIdentifierPart(unibrow::uchar c) { return kIsIdentifierPart.get(c); } | 133 bool IsIdentifierPart(unibrow::uchar c) { return kIsIdentifierPart.get(c); } |
134 bool IsLineTerminator(unibrow::uchar c) { return kIsLineTerminator.get(c); } | 134 bool IsLineTerminator(unibrow::uchar c) { return kIsLineTerminator.get(c); } |
135 bool IsWhiteSpace(unibrow::uchar c) { return kIsWhiteSpace.get(c); } | 135 bool IsWhiteSpace(unibrow::uchar c) { return kIsWhiteSpace.get(c); } |
136 | 136 |
137 private: | 137 private: |
138 | |
139 unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart; | 138 unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart; |
140 unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart; | 139 unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart; |
141 unibrow::Predicate<unibrow::LineTerminator, 128> kIsLineTerminator; | 140 unibrow::Predicate<unibrow::LineTerminator, 128> kIsLineTerminator; |
142 unibrow::Predicate<unibrow::WhiteSpace, 128> kIsWhiteSpace; | 141 unibrow::Predicate<unibrow::WhiteSpace, 128> kIsWhiteSpace; |
143 StaticResource<Utf8Decoder> utf8_decoder_; | 142 StaticResource<Utf8Decoder> utf8_decoder_; |
144 | 143 |
145 DISALLOW_COPY_AND_ASSIGN(UnicodeCache); | 144 DISALLOW_COPY_AND_ASSIGN(UnicodeCache); |
146 }; | 145 }; |
147 | 146 |
148 | 147 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 190 } |
192 | 191 |
193 int length() { | 192 int length() { |
194 return is_ascii_ ? position_ : (position_ >> 1); | 193 return is_ascii_ ? position_ : (position_ >> 1); |
195 } | 194 } |
196 | 195 |
197 void Reset() { | 196 void Reset() { |
198 position_ = 0; | 197 position_ = 0; |
199 is_ascii_ = true; | 198 is_ascii_ = true; |
200 } | 199 } |
| 200 |
201 private: | 201 private: |
202 static const int kInitialCapacity = 16; | 202 static const int kInitialCapacity = 16; |
203 static const int kGrowthFactory = 4; | 203 static const int kGrowthFactory = 4; |
204 static const int kMinConversionSlack = 256; | 204 static const int kMinConversionSlack = 256; |
205 static const int kMaxGrowth = 1 * MB; | 205 static const int kMaxGrowth = 1 * MB; |
206 inline int NewCapacity(int min_capacity) { | 206 inline int NewCapacity(int min_capacity) { |
207 int capacity = Max(min_capacity, backing_store_.length()); | 207 int capacity = Max(min_capacity, backing_store_.length()); |
208 int new_capacity = Min(capacity * kGrowthFactory, capacity + kMaxGrowth); | 208 int new_capacity = Min(capacity * kGrowthFactory, capacity + kMaxGrowth); |
209 return new_capacity; | 209 return new_capacity; |
210 } | 210 } |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 // line-terminator after the current token, and before the next. | 555 // line-terminator after the current token, and before the next. |
556 bool has_multiline_comment_before_next_; | 556 bool has_multiline_comment_before_next_; |
557 // Whether we scan 'let' as a keyword for harmony block scoped | 557 // Whether we scan 'let' as a keyword for harmony block scoped |
558 // let bindings. | 558 // let bindings. |
559 bool harmony_block_scoping_; | 559 bool harmony_block_scoping_; |
560 }; | 560 }; |
561 | 561 |
562 } } // namespace v8::internal | 562 } } // namespace v8::internal |
563 | 563 |
564 #endif // V8_SCANNER_H_ | 564 #endif // V8_SCANNER_H_ |
OLD | NEW |