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

Side by Side Diff: src/builtins.cc

Issue 2050733004: Add UseCounter for Date.parse's legacy parse heuristics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/builtins.h" 5 #include "src/builtins.h"
6 6
7 #include "src/api-arguments.h" 7 #include "src/api-arguments.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 3273 matching lines...) Expand 10 before | Expand all | Expand 10 after
3284 double ParseDateTimeString(Handle<String> str) { 3284 double ParseDateTimeString(Handle<String> str) {
3285 Isolate* const isolate = str->GetIsolate(); 3285 Isolate* const isolate = str->GetIsolate();
3286 str = String::Flatten(str); 3286 str = String::Flatten(str);
3287 // TODO(bmeurer): Change DateParser to not use the FixedArray. 3287 // TODO(bmeurer): Change DateParser to not use the FixedArray.
3288 Handle<FixedArray> tmp = 3288 Handle<FixedArray> tmp =
3289 isolate->factory()->NewFixedArray(DateParser::OUTPUT_SIZE); 3289 isolate->factory()->NewFixedArray(DateParser::OUTPUT_SIZE);
3290 DisallowHeapAllocation no_gc; 3290 DisallowHeapAllocation no_gc;
3291 String::FlatContent str_content = str->GetFlatContent(); 3291 String::FlatContent str_content = str->GetFlatContent();
3292 bool result; 3292 bool result;
3293 if (str_content.IsOneByte()) { 3293 if (str_content.IsOneByte()) {
3294 result = DateParser::Parse(str_content.ToOneByteVector(), *tmp, 3294 result = DateParser::Parse(isolate, str_content.ToOneByteVector(), *tmp);
3295 isolate->unicode_cache());
3296 } else { 3295 } else {
3297 result = DateParser::Parse(str_content.ToUC16Vector(), *tmp, 3296 result = DateParser::Parse(isolate, str_content.ToUC16Vector(), *tmp);
3298 isolate->unicode_cache());
3299 } 3297 }
3300 if (!result) return std::numeric_limits<double>::quiet_NaN(); 3298 if (!result) return std::numeric_limits<double>::quiet_NaN();
3301 double const day = MakeDay(tmp->get(0)->Number(), tmp->get(1)->Number(), 3299 double const day = MakeDay(tmp->get(0)->Number(), tmp->get(1)->Number(),
3302 tmp->get(2)->Number()); 3300 tmp->get(2)->Number());
3303 double const time = MakeTime(tmp->get(3)->Number(), tmp->get(4)->Number(), 3301 double const time = MakeTime(tmp->get(3)->Number(), tmp->get(4)->Number(),
3304 tmp->get(5)->Number(), tmp->get(6)->Number()); 3302 tmp->get(5)->Number(), tmp->get(6)->Number());
3305 double date = MakeDate(day, time); 3303 double date = MakeDate(day, time);
3306 if (tmp->get(7)->IsNull()) { 3304 if (tmp->get(7)->IsNull()) {
3307 if (!std::isnan(date)) { 3305 if (!std::isnan(date)) {
3308 date = isolate->date_cache()->ToUTC(static_cast<int64_t>(date)); 3306 date = isolate->date_cache()->ToUTC(static_cast<int64_t>(date));
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
5933 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 5931 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
5934 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 5932 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
5935 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 5933 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
5936 #undef DEFINE_BUILTIN_ACCESSOR_C 5934 #undef DEFINE_BUILTIN_ACCESSOR_C
5937 #undef DEFINE_BUILTIN_ACCESSOR_A 5935 #undef DEFINE_BUILTIN_ACCESSOR_A
5938 #undef DEFINE_BUILTIN_ACCESSOR_T 5936 #undef DEFINE_BUILTIN_ACCESSOR_T
5939 #undef DEFINE_BUILTIN_ACCESSOR_H 5937 #undef DEFINE_BUILTIN_ACCESSOR_H
5940 5938
5941 } // namespace internal 5939 } // namespace internal
5942 } // namespace v8 5940 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/dateparser.h » ('j') | src/dateparser-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698