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

Side by Side Diff: src/dateparser.h

Issue 50004: * Made Date string parser reuse the same output array each time. (Closed)
Patch Set: Created 11 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/date-delay.js ('k') | src/dateparser-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 30 matching lines...) Expand all
41 // [1]: month (0 = Jan, 1 = Feb, ...) 41 // [1]: month (0 = Jan, 1 = Feb, ...)
42 // [2]: day 42 // [2]: day
43 // [3]: hour 43 // [3]: hour
44 // [4]: minute 44 // [4]: minute
45 // [5]: second 45 // [5]: second
46 // [6]: UTC offset in seconds, or null value if no timezone specified 46 // [6]: UTC offset in seconds, or null value if no timezone specified
47 // If parsing fails, return false (content of output array is not defined). 47 // If parsing fails, return false (content of output array is not defined).
48 template <typename Char> 48 template <typename Char>
49 static bool Parse(Vector<Char> str, FixedArray* output); 49 static bool Parse(Vector<Char> str, FixedArray* output);
50 50
51 enum {YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, UTC_OFFSET, OUTPUT_SIZE}; 51 enum {
52 YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, UTC_OFFSET, OUTPUT_SIZE
53 };
52 54
53 private: 55 private:
54 // Range testing 56 // Range testing
55 static inline bool Between(int x, int lo, int hi) { 57 static inline bool Between(int x, int lo, int hi) {
56 return static_cast<unsigned>(x - lo) <= static_cast<unsigned>(hi - lo); 58 return static_cast<unsigned>(x - lo) <= static_cast<unsigned>(hi - lo);
57 } 59 }
58 // Indicates a missing value. 60 // Indicates a missing value.
59 static const int kNone = kMaxInt; 61 static const int kNone = kMaxInt;
60 62
61 // InputReader provides basic string parsing and character classification. 63 // InputReader provides basic string parsing and character classification.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 int comp_[kSize]; 230 int comp_[kSize];
229 int index_; 231 int index_;
230 int named_month_; 232 int named_month_;
231 }; 233 };
232 }; 234 };
233 235
234 236
235 } } // namespace v8::internal 237 } } // namespace v8::internal
236 238
237 #endif // V8_DATEPARSER_H_ 239 #endif // V8_DATEPARSER_H_
OLDNEW
« no previous file with comments | « src/date-delay.js ('k') | src/dateparser-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698