OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 19313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19324 case kDaysUTC: return Smi::FromInt(days); | 19324 case kDaysUTC: return Smi::FromInt(days); |
19325 case kTimeInDayUTC: return Smi::FromInt(time_in_day_ms); | 19325 case kTimeInDayUTC: return Smi::FromInt(time_in_day_ms); |
19326 default: UNREACHABLE(); | 19326 default: UNREACHABLE(); |
19327 } | 19327 } |
19328 | 19328 |
19329 UNREACHABLE(); | 19329 UNREACHABLE(); |
19330 return NULL; | 19330 return NULL; |
19331 } | 19331 } |
19332 | 19332 |
19333 | 19333 |
19334 // static | |
19335 Handle<Object> JSDate::SetValue(Handle<JSDate> date, double v) { | |
19336 Isolate* const isolate = date->GetIsolate(); | |
19337 Handle<Object> value = isolate->factory()->NewNumber(v); | |
19338 bool value_is_nan = std::isnan(v); | |
19339 date->SetValue(*value, value_is_nan); | |
19340 return value; | |
19341 } | |
19342 | |
19343 | |
19344 void JSDate::SetValue(Object* value, bool is_value_nan) { | 19334 void JSDate::SetValue(Object* value, bool is_value_nan) { |
19345 set_value(value); | 19335 set_value(value); |
19346 if (is_value_nan) { | 19336 if (is_value_nan) { |
19347 HeapNumber* nan = GetIsolate()->heap()->nan_value(); | 19337 HeapNumber* nan = GetIsolate()->heap()->nan_value(); |
19348 set_cache_stamp(nan, SKIP_WRITE_BARRIER); | 19338 set_cache_stamp(nan, SKIP_WRITE_BARRIER); |
19349 set_year(nan, SKIP_WRITE_BARRIER); | 19339 set_year(nan, SKIP_WRITE_BARRIER); |
19350 set_month(nan, SKIP_WRITE_BARRIER); | 19340 set_month(nan, SKIP_WRITE_BARRIER); |
19351 set_day(nan, SKIP_WRITE_BARRIER); | 19341 set_day(nan, SKIP_WRITE_BARRIER); |
19352 set_hour(nan, SKIP_WRITE_BARRIER); | 19342 set_hour(nan, SKIP_WRITE_BARRIER); |
19353 set_min(nan, SKIP_WRITE_BARRIER); | 19343 set_min(nan, SKIP_WRITE_BARRIER); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19648 if (cell->value() != *new_value) { | 19638 if (cell->value() != *new_value) { |
19649 cell->set_value(*new_value); | 19639 cell->set_value(*new_value); |
19650 Isolate* isolate = cell->GetIsolate(); | 19640 Isolate* isolate = cell->GetIsolate(); |
19651 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19641 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19652 isolate, DependentCode::kPropertyCellChangedGroup); | 19642 isolate, DependentCode::kPropertyCellChangedGroup); |
19653 } | 19643 } |
19654 } | 19644 } |
19655 | 19645 |
19656 } // namespace internal | 19646 } // namespace internal |
19657 } // namespace v8 | 19647 } // namespace v8 |
OLD | NEW |