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 19315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19326 case kDaysUTC: return Smi::FromInt(days); | 19326 case kDaysUTC: return Smi::FromInt(days); |
19327 case kTimeInDayUTC: return Smi::FromInt(time_in_day_ms); | 19327 case kTimeInDayUTC: return Smi::FromInt(time_in_day_ms); |
19328 default: UNREACHABLE(); | 19328 default: UNREACHABLE(); |
19329 } | 19329 } |
19330 | 19330 |
19331 UNREACHABLE(); | 19331 UNREACHABLE(); |
19332 return NULL; | 19332 return NULL; |
19333 } | 19333 } |
19334 | 19334 |
19335 | 19335 |
| 19336 // static |
| 19337 Handle<Object> JSDate::SetValue(Handle<JSDate> date, double v) { |
| 19338 Isolate* const isolate = date->GetIsolate(); |
| 19339 Handle<Object> value = isolate->factory()->NewNumber(v); |
| 19340 bool value_is_nan = std::isnan(v); |
| 19341 date->SetValue(*value, value_is_nan); |
| 19342 return value; |
| 19343 } |
| 19344 |
| 19345 |
19336 void JSDate::SetValue(Object* value, bool is_value_nan) { | 19346 void JSDate::SetValue(Object* value, bool is_value_nan) { |
19337 set_value(value); | 19347 set_value(value); |
19338 if (is_value_nan) { | 19348 if (is_value_nan) { |
19339 HeapNumber* nan = GetIsolate()->heap()->nan_value(); | 19349 HeapNumber* nan = GetIsolate()->heap()->nan_value(); |
19340 set_cache_stamp(nan, SKIP_WRITE_BARRIER); | 19350 set_cache_stamp(nan, SKIP_WRITE_BARRIER); |
19341 set_year(nan, SKIP_WRITE_BARRIER); | 19351 set_year(nan, SKIP_WRITE_BARRIER); |
19342 set_month(nan, SKIP_WRITE_BARRIER); | 19352 set_month(nan, SKIP_WRITE_BARRIER); |
19343 set_day(nan, SKIP_WRITE_BARRIER); | 19353 set_day(nan, SKIP_WRITE_BARRIER); |
19344 set_hour(nan, SKIP_WRITE_BARRIER); | 19354 set_hour(nan, SKIP_WRITE_BARRIER); |
19345 set_min(nan, SKIP_WRITE_BARRIER); | 19355 set_min(nan, SKIP_WRITE_BARRIER); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19640 if (cell->value() != *new_value) { | 19650 if (cell->value() != *new_value) { |
19641 cell->set_value(*new_value); | 19651 cell->set_value(*new_value); |
19642 Isolate* isolate = cell->GetIsolate(); | 19652 Isolate* isolate = cell->GetIsolate(); |
19643 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19653 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19644 isolate, DependentCode::kPropertyCellChangedGroup); | 19654 isolate, DependentCode::kPropertyCellChangedGroup); |
19645 } | 19655 } |
19646 } | 19656 } |
19647 | 19657 |
19648 } // namespace internal | 19658 } // namespace internal |
19649 } // namespace v8 | 19659 } // namespace v8 |
OLD | NEW |