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

Side by Side Diff: sdk/lib/io/http_date.dart

Issue 209443005: Add optimized _OneByteString.toLowerCase. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Optimize toLowerCase. Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * Utility functions for working with dates with HTTP specific date 8 * Utility functions for working with dates with HTTP specific date
9 * formats. 9 * formats.
10 */ 10 */
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 int index = 0; 254 int index = 0;
255 for (; index < s.length && isDigit(s[index]); index++); 255 for (; index < s.length && isDigit(s[index]); index++);
256 return int.parse(s.substring(0, index)); 256 return int.parse(s.substring(0, index));
257 } 257 }
258 258
259 var tokens = []; 259 var tokens = [];
260 while (!isEnd()) { 260 while (!isEnd()) {
261 while (!isEnd() && isDelimiter(date[position])) position++; 261 while (!isEnd() && isDelimiter(date[position])) position++;
262 int start = position; 262 int start = position;
263 while (!isEnd() && isNonDelimiter(date[position])) position++; 263 while (!isEnd() && isNonDelimiter(date[position])) position++;
264 tokens.add(date.substring(start, position).toLowerCase()); 264 tokens.add(_ASCII.toLowerCase(date.substring(start, position)));
265 while (!isEnd() && isDelimiter(date[position])) position++; 265 while (!isEnd() && isDelimiter(date[position])) position++;
266 } 266 }
267 267
268 String timeStr; 268 String timeStr;
269 String dayOfMonthStr; 269 String dayOfMonthStr;
270 String monthStr; 270 String monthStr;
271 String yearStr; 271 String yearStr;
272 272
273 for (var token in tokens) { 273 for (var token in tokens) {
274 if (token.length < 1) continue; 274 if (token.length < 1) continue;
(...skipping 30 matching lines...) Expand all
305 int hour = toInt(timeList[0]); 305 int hour = toInt(timeList[0]);
306 int minute = toInt(timeList[1]); 306 int minute = toInt(timeList[1]);
307 int second = toInt(timeList[2]); 307 int second = toInt(timeList[2]);
308 if (hour > 23) error(); 308 if (hour > 23) error();
309 if (minute > 59) error(); 309 if (minute > 59) error();
310 if (second > 59) error(); 310 if (second > 59) error();
311 311
312 return new DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0); 312 return new DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0);
313 } 313 }
314 } 314 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698