OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 #include "src/dateparser-inl.h" | 9 #include "src/dateparser-inl.h" |
10 | 10 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 isolate, string, | 295 isolate, string, |
296 Object::ToString(isolate, args.atOrUndefined(isolate, 1))); | 296 Object::ToString(isolate, args.atOrUndefined(isolate, 1))); |
297 return *isolate->factory()->NewNumber(ParseDateTimeString(string)); | 297 return *isolate->factory()->NewNumber(ParseDateTimeString(string)); |
298 } | 298 } |
299 | 299 |
300 // ES6 section 20.3.3.4 Date.UTC (year,month,date,hours,minutes,seconds,ms) | 300 // ES6 section 20.3.3.4 Date.UTC (year,month,date,hours,minutes,seconds,ms) |
301 BUILTIN(DateUTC) { | 301 BUILTIN(DateUTC) { |
302 HandleScope scope(isolate); | 302 HandleScope scope(isolate); |
303 int const argc = args.length() - 1; | 303 int const argc = args.length() - 1; |
304 double year = std::numeric_limits<double>::quiet_NaN(); | 304 double year = std::numeric_limits<double>::quiet_NaN(); |
305 double month = std::numeric_limits<double>::quiet_NaN(); | 305 double month = 0.0, date = 1.0, hours = 0.0, minutes = 0.0, seconds = 0.0, |
306 double date = 1.0, hours = 0.0, minutes = 0.0, seconds = 0.0, ms = 0.0; | 306 ms = 0.0; |
307 if (argc >= 1) { | 307 if (argc >= 1) { |
308 Handle<Object> year_object; | 308 Handle<Object> year_object; |
309 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, year_object, | 309 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, year_object, |
310 Object::ToNumber(args.at(1))); | 310 Object::ToNumber(args.at(1))); |
311 year = year_object->Number(); | 311 year = year_object->Number(); |
312 if (argc >= 2) { | 312 if (argc >= 2) { |
313 Handle<Object> month_object; | 313 Handle<Object> month_object; |
314 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, month_object, | 314 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, month_object, |
315 Object::ToNumber(args.at(2))); | 315 Object::ToNumber(args.at(2))); |
316 month = month_object->Number(); | 316 month = month_object->Number(); |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 Runtime::kThrowIncompatibleMethodReceiver, context, | 1164 Runtime::kThrowIncompatibleMethodReceiver, context, |
1165 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( | 1165 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( |
1166 "Date.prototype [ @@toPrimitive ]", TENURED)), | 1166 "Date.prototype [ @@toPrimitive ]", TENURED)), |
1167 receiver); | 1167 receiver); |
1168 assembler.Return(result); | 1168 assembler.Return(result); |
1169 } | 1169 } |
1170 } | 1170 } |
1171 | 1171 |
1172 } // namespace internal | 1172 } // namespace internal |
1173 } // namespace v8 | 1173 } // namespace v8 |
OLD | NEW |