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

Unified Diff: src/date-delay.js

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/dateparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/date-delay.js
diff --git a/src/date-delay.js b/src/date-delay.js
index d9b2421cc8e6f3ecb55b7c2ccdb123fc36b1ec58..2421e5baecc94c2602e9d6fafd4e500da2de0d1b 100644
--- a/src/date-delay.js
+++ b/src/date-delay.js
@@ -228,7 +228,6 @@ function TimeInYear(year) {
// Compute modified Julian day from year, month, date.
-// The missing days in 1582 are ignored for JavaScript compatibility.
function ToJulianDay(year, month, date) {
var jy = (month > 1) ? year : year - 1;
var jm = (month > 1) ? month + 2 : month + 14;
@@ -568,10 +567,12 @@ function DatePrintString(time) {
// -------------------------------------------------------------------
+// Reused output buffer.
+var parse_buffer = $Array(7);
// ECMA 262 - 15.9.4.2
function DateParse(string) {
- var arr = %DateParseString(ToString(string));
+ var arr = %DateParseString(ToString(string), parse_buffer);
if (IS_NULL(arr)) return $NaN;
var day = MakeDay(arr[0], arr[1], arr[2]);
« no previous file with comments | « no previous file | src/dateparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698