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

Unified Diff: src/dateparser-inl.h

Issue 2080183003: Only count legacy parser usage if legacy parser had effect. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add test Created 4 years, 6 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 | « no previous file | test/cctest/test-date.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/dateparser-inl.h
diff --git a/src/dateparser-inl.h b/src/dateparser-inl.h
index 57e4fa5e6789dd2ee9540d42ea808c6e0e4d1ea9..47a7c6e7ff1e8c8f1b574ad8478574ad80be3d49 100644
--- a/src/dateparser-inl.h
+++ b/src/dateparser-inl.h
@@ -75,11 +75,12 @@ bool DateParser::Parse(Isolate* isolate, Vector<Char> str, FixedArray* out) {
if (next_unhandled_token.IsInvalid()) return false;
bool has_read_number = !day.IsEmpty();
// If there's anything left, continue with the legacy parser.
- bool legacy_parser = !next_unhandled_token.IsEndOfInput();
+ bool legacy_parser = false;
for (DateToken token = next_unhandled_token;
!token.IsEndOfInput();
token = scanner.Next()) {
if (token.IsNumber()) {
+ legacy_parser = true;
has_read_number = true;
int n = token.number();
if (scanner.SkipSymbol(':')) {
@@ -115,6 +116,7 @@ bool DateParser::Parse(Isolate* isolate, Vector<Char> str, FixedArray* out) {
scanner.SkipSymbol('-');
}
} else if (token.IsKeyword()) {
+ legacy_parser = true;
// Parse a "word" (sequence of chars. >= 'A').
KeywordType type = token.keyword_type();
int value = token.keyword_value();
@@ -133,6 +135,7 @@ bool DateParser::Parse(Isolate* isolate, Vector<Char> str, FixedArray* out) {
if (scanner.Peek().IsNumber()) return false;
}
} else if (token.IsAsciiSign() && (tz.IsUTC() || !time.IsEmpty())) {
+ legacy_parser = true;
// Parse UTC offset (only after UTC or time).
tz.SetSign(token.ascii_sign());
// The following number may be empty.
« no previous file with comments | « no previous file | test/cctest/test-date.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698