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

Side by Side Diff: src/objects.cc

Issue 1579613002: [builtins] Refactor the remaining Date builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
OLDNEW
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 19283 matching lines...) Expand 10 before | Expand all | Expand 10 after
19294 case kDaysUTC: return Smi::FromInt(days); 19294 case kDaysUTC: return Smi::FromInt(days);
19295 case kTimeInDayUTC: return Smi::FromInt(time_in_day_ms); 19295 case kTimeInDayUTC: return Smi::FromInt(time_in_day_ms);
19296 default: UNREACHABLE(); 19296 default: UNREACHABLE();
19297 } 19297 }
19298 19298
19299 UNREACHABLE(); 19299 UNREACHABLE();
19300 return NULL; 19300 return NULL;
19301 } 19301 }
19302 19302
19303 19303
19304 // static
19305 Handle<Object> JSDate::SetValue(Handle<JSDate> date, double v) {
19306 Isolate* const isolate = date->GetIsolate();
19307 Handle<Object> value = isolate->factory()->NewNumber(v);
19308 bool value_is_nan = std::isnan(v);
19309 date->SetValue(*value, value_is_nan);
19310 return value;
19311 }
19312
19313
19304 void JSDate::SetValue(Object* value, bool is_value_nan) { 19314 void JSDate::SetValue(Object* value, bool is_value_nan) {
19305 set_value(value); 19315 set_value(value);
19306 if (is_value_nan) { 19316 if (is_value_nan) {
19307 HeapNumber* nan = GetIsolate()->heap()->nan_value(); 19317 HeapNumber* nan = GetIsolate()->heap()->nan_value();
19308 set_cache_stamp(nan, SKIP_WRITE_BARRIER); 19318 set_cache_stamp(nan, SKIP_WRITE_BARRIER);
19309 set_year(nan, SKIP_WRITE_BARRIER); 19319 set_year(nan, SKIP_WRITE_BARRIER);
19310 set_month(nan, SKIP_WRITE_BARRIER); 19320 set_month(nan, SKIP_WRITE_BARRIER);
19311 set_day(nan, SKIP_WRITE_BARRIER); 19321 set_day(nan, SKIP_WRITE_BARRIER);
19312 set_hour(nan, SKIP_WRITE_BARRIER); 19322 set_hour(nan, SKIP_WRITE_BARRIER);
19313 set_min(nan, SKIP_WRITE_BARRIER); 19323 set_min(nan, SKIP_WRITE_BARRIER);
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
19608 if (cell->value() != *new_value) { 19618 if (cell->value() != *new_value) {
19609 cell->set_value(*new_value); 19619 cell->set_value(*new_value);
19610 Isolate* isolate = cell->GetIsolate(); 19620 Isolate* isolate = cell->GetIsolate();
19611 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19621 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19612 isolate, DependentCode::kPropertyCellChangedGroup); 19622 isolate, DependentCode::kPropertyCellChangedGroup);
19613 } 19623 }
19614 } 19624 }
19615 19625
19616 } // namespace internal 19626 } // namespace internal
19617 } // namespace v8 19627 } // namespace v8
OLDNEW
« src/js/date.js ('K') | « src/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698