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

Unified Diff: src/scanner.h

Issue 969353003: Speed up identifier, keyword and smi parsing (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use char predicates Created 5 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/char-predicates-inl.h ('k') | src/scanner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.h
diff --git a/src/scanner.h b/src/scanner.h
index 0e3013f4b8f7d6a910dcb9e26042b40238c1aaa2..94f9102c042cddbbffe03865e7c533128017179b 100644
--- a/src/scanner.h
+++ b/src/scanner.h
@@ -565,12 +565,16 @@ class Scanner {
}
// Low-level scanning support.
- template <bool capture_raw = false>
+ template <bool capture_raw = false, bool check_surrogate = true>
void Advance() {
if (capture_raw) {
AddRawLiteralChar(c0_);
}
c0_ = source_->Advance();
+ if (check_surrogate) HandleLeadSurrugate();
+ }
+
+ void HandleLeadSurrugate() {
if (unibrow::Utf16::IsLeadSurrogate(c0_)) {
uc32 c1 = source_->Advance();
if (!unibrow::Utf16::IsTrailSurrogate(c1)) {
« no previous file with comments | « src/char-predicates-inl.h ('k') | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698