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

Side by Side Diff: src/runtime/runtime-date.cc

Issue 984833003: Do not use eternal handles when creating a start-up snapshot. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « src/date.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/date.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698