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

Side by Side Diff: src/objects.cc

Issue 173793002: Check and clear date cache in DateCurrentTime, DateLocalTimezone and getTimezoneOffset. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« src/date.h ('K') | « src/date.js ('k') | src/runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 16306 matching lines...) Expand 10 before | Expand all | Expand 10 after
16317 Object* JSDate::GetUTCField(FieldIndex index, 16317 Object* JSDate::GetUTCField(FieldIndex index,
16318 double value, 16318 double value,
16319 DateCache* date_cache) { 16319 DateCache* date_cache) {
16320 ASSERT(index >= kFirstUTCField); 16320 ASSERT(index >= kFirstUTCField);
16321 16321
16322 if (std::isnan(value)) return GetIsolate()->heap()->nan_value(); 16322 if (std::isnan(value)) return GetIsolate()->heap()->nan_value();
16323 16323
16324 int64_t time_ms = static_cast<int64_t>(value); 16324 int64_t time_ms = static_cast<int64_t>(value);
16325 16325
16326 if (index == kTimezoneOffset) { 16326 if (index == kTimezoneOffset) {
16327 date_cache->CheckTimezone();
16327 return Smi::FromInt(date_cache->TimezoneOffset(time_ms)); 16328 return Smi::FromInt(date_cache->TimezoneOffset(time_ms));
16328 } 16329 }
16329 16330
16330 int days = DateCache::DaysFromTime(time_ms); 16331 int days = DateCache::DaysFromTime(time_ms);
16331 16332
16332 if (index == kWeekdayUTC) return Smi::FromInt(date_cache->Weekday(days)); 16333 if (index == kWeekdayUTC) return Smi::FromInt(date_cache->Weekday(days));
16333 16334
16334 if (index <= kDayUTC) { 16335 if (index <= kDayUTC) {
16335 int year, month, day; 16336 int year, month, day;
16336 date_cache->YearMonthDayFromDays(days, &year, &month, &day); 16337 date_cache->YearMonthDayFromDays(days, &year, &month, &day);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
16480 #define ERROR_MESSAGES_TEXTS(C, T) T, 16481 #define ERROR_MESSAGES_TEXTS(C, T) T,
16481 static const char* error_messages_[] = { 16482 static const char* error_messages_[] = {
16482 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16483 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16483 }; 16484 };
16484 #undef ERROR_MESSAGES_TEXTS 16485 #undef ERROR_MESSAGES_TEXTS
16485 return error_messages_[reason]; 16486 return error_messages_[reason];
16486 } 16487 }
16487 16488
16488 16489
16489 } } // namespace v8::internal 16490 } } // namespace v8::internal
OLDNEW
« src/date.h ('K') | « src/date.js ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698