Commit 67c04c87 authored by sandholm@chromium.org's avatar sandholm@chromium.org

One element cache for localtime.

Review URL: http://codereview.chromium.org/2023005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4628 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b9df5aa2
......@@ -238,7 +238,15 @@ function LocalTime(time) {
return time + DaylightSavingsOffset(time) + local_time_offset;
}
var ltcache = {
key: null,
val: null
};
function LocalTimeNoCheck(time) {
var ltc = ltcache;
if (%_ObjectEquals(time, ltc.key)) return ltc.val;
if (time < -MAX_TIME_MS || time > MAX_TIME_MS) {
return $NaN;
}
......@@ -252,7 +260,8 @@ function LocalTimeNoCheck(time) {
} else {
var dst_offset = DaylightSavingsOffset(time);
}
return time + local_time_offset + dst_offset;
ltc.key = time;
return (ltc.val = time + local_time_offset + dst_offset);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment