Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(810)

Side by Side Diff: src/parsing/scanner.cc

Issue 2485423002: Adding smi cache (Closed)
Patch Set: Changed signature to uint Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/scanner.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/parsing/scanner.h" 7 #include "src/parsing/scanner.h"
8 8
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 while (IsDecimalDigit(c0_)) { 1146 while (IsDecimalDigit(c0_)) {
1147 value = 10 * value + (c0_ - '0'); 1147 value = 10 * value + (c0_ - '0');
1148 1148
1149 uc32 first_char = c0_; 1149 uc32 first_char = c0_;
1150 Advance<false, false>(); 1150 Advance<false, false>();
1151 AddLiteralChar(first_char); 1151 AddLiteralChar(first_char);
1152 } 1152 }
1153 1153
1154 if (next_.literal_chars->one_byte_literal().length() <= 10 && 1154 if (next_.literal_chars->one_byte_literal().length() <= 10 &&
1155 value <= Smi::kMaxValue && c0_ != '.' && c0_ != 'e' && c0_ != 'E') { 1155 value <= Smi::kMaxValue && c0_ != '.' && c0_ != 'e' && c0_ != 'E') {
1156 next_.smi_value_ = static_cast<int>(value); 1156 next_.smi_value_ = static_cast<uint32_t>(value);
1157 literal.Complete(); 1157 literal.Complete();
1158 HandleLeadSurrogate(); 1158 HandleLeadSurrogate();
1159 1159
1160 if (kind == DECIMAL_WITH_LEADING_ZERO) 1160 if (kind == DECIMAL_WITH_LEADING_ZERO)
1161 decimal_with_leading_zero_pos_ = Location(start_pos, source_pos()); 1161 decimal_with_leading_zero_pos_ = Location(start_pos, source_pos());
1162 return Token::SMI; 1162 return Token::SMI;
1163 } 1163 }
1164 HandleLeadSurrogate(); 1164 HandleLeadSurrogate();
1165 } 1165 }
1166 1166
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 // 2, reset the source to the desired position, 1636 // 2, reset the source to the desired position,
1637 source_->Seek(position); 1637 source_->Seek(position);
1638 // 3, re-scan, by scanning the look-ahead char + 1 token (next_). 1638 // 3, re-scan, by scanning the look-ahead char + 1 token (next_).
1639 c0_ = source_->Advance(); 1639 c0_ = source_->Advance();
1640 Next(); 1640 Next();
1641 DCHECK_EQ(next_.location.beg_pos, position); 1641 DCHECK_EQ(next_.location.beg_pos, position);
1642 } 1642 }
1643 1643
1644 } // namespace internal 1644 } // namespace internal
1645 } // namespace v8 1645 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/scanner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698