Optimize JS date implementation for smi-only arrays

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9848 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0766a138
......@@ -294,8 +294,8 @@ function TimeInYear(year) {
}
var ymd_from_time_cache = [$NaN, $NaN, $NaN];
var ymd_from_time_cached_time = $NaN;
var ymd_from_time_cache = [1970, 0, 1];
var ymd_from_time_cached_time = 0;
function YearFromTime(t) {
if (t !== ymd_from_time_cached_time) {
......
......@@ -7875,19 +7875,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DateYMDFromTime) {
FixedArrayBase* elms_base = FixedArrayBase::cast(res_array->elements());
RUNTIME_ASSERT(elms_base->length() == 3);
RUNTIME_ASSERT(res_array->GetElementsKind() <= FAST_DOUBLE_ELEMENTS);
RUNTIME_ASSERT(res_array->HasFastTypeElements());
if (res_array->HasFastDoubleElements()) {
FixedDoubleArray* elms = FixedDoubleArray::cast(res_array->elements());
elms->set(0, year);
elms->set(1, month);
elms->set(2, day);
} else {
MaybeObject* maybe = res_array->EnsureWritableFastElements();
if (maybe->IsFailure()) return maybe;
FixedArray* elms = FixedArray::cast(res_array->elements());
elms->set(0, Smi::FromInt(year));
elms->set(1, Smi::FromInt(month));
elms->set(2, Smi::FromInt(day));
}
return isolate->heap()->undefined_value();
}
......
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