OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/date.h" | 8 #include "src/date.h" |
9 #include "src/dateparser-inl.h" | 9 #include "src/dateparser-inl.h" |
10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 x <= DateCache::kMaxTimeBeforeUTCInMs); | 145 x <= DateCache::kMaxTimeBeforeUTCInMs); |
146 int64_t time = isolate->date_cache()->ToUTC(static_cast<int64_t>(x)); | 146 int64_t time = isolate->date_cache()->ToUTC(static_cast<int64_t>(x)); |
147 | 147 |
148 return *isolate->factory()->NewNumber(static_cast<double>(time)); | 148 return *isolate->factory()->NewNumber(static_cast<double>(time)); |
149 } | 149 } |
150 | 150 |
151 | 151 |
152 RUNTIME_FUNCTION(Runtime_DateCacheVersion) { | 152 RUNTIME_FUNCTION(Runtime_DateCacheVersion) { |
153 HandleScope hs(isolate); | 153 HandleScope hs(isolate); |
154 DCHECK(args.length() == 0); | 154 DCHECK(args.length() == 0); |
| 155 if (isolate->serializer_enabled()) return isolate->heap()->undefined_value(); |
155 if (!isolate->eternal_handles()->Exists(EternalHandles::DATE_CACHE_VERSION)) { | 156 if (!isolate->eternal_handles()->Exists(EternalHandles::DATE_CACHE_VERSION)) { |
156 Handle<FixedArray> date_cache_version = | 157 Handle<FixedArray> date_cache_version = |
157 isolate->factory()->NewFixedArray(1, TENURED); | 158 isolate->factory()->NewFixedArray(1, TENURED); |
158 date_cache_version->set(0, Smi::FromInt(0)); | 159 date_cache_version->set(0, Smi::FromInt(0)); |
159 isolate->eternal_handles()->CreateSingleton( | 160 isolate->eternal_handles()->CreateSingleton( |
160 isolate, *date_cache_version, EternalHandles::DATE_CACHE_VERSION); | 161 isolate, *date_cache_version, EternalHandles::DATE_CACHE_VERSION); |
161 } | 162 } |
162 Handle<FixedArray> date_cache_version = | 163 Handle<FixedArray> date_cache_version = |
163 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton( | 164 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton( |
164 EternalHandles::DATE_CACHE_VERSION)); | 165 EternalHandles::DATE_CACHE_VERSION)); |
(...skipping 15 matching lines...) Expand all Loading... |
180 THROW_NEW_ERROR_RETURN_FAILURE( | 181 THROW_NEW_ERROR_RETURN_FAILURE( |
181 isolate, | 182 isolate, |
182 NewTypeError("not_date_object", HandleVector<Object>(NULL, 0))); | 183 NewTypeError("not_date_object", HandleVector<Object>(NULL, 0))); |
183 } | 184 } |
184 JSDate* date = JSDate::cast(obj); | 185 JSDate* date = JSDate::cast(obj); |
185 if (index == 0) return date->value(); | 186 if (index == 0) return date->value(); |
186 return JSDate::GetField(date, Smi::FromInt(index)); | 187 return JSDate::GetField(date, Smi::FromInt(index)); |
187 } | 188 } |
188 } | 189 } |
189 } // namespace v8::internal | 190 } // namespace v8::internal |
OLD | NEW |