| 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.h" | 5 #include "src/builtins/builtins.h" |
| 6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
| 7 | 7 |
| 8 #include "src/dateparser-inl.h" | 8 #include "src/dateparser-inl.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 char buffer[128]; | 196 char buffer[128]; |
| 197 ToDateString(time_val, ArrayVector(buffer), isolate->date_cache()); | 197 ToDateString(time_val, ArrayVector(buffer), isolate->date_cache()); |
| 198 RETURN_RESULT_OR_FAILURE( | 198 RETURN_RESULT_OR_FAILURE( |
| 199 isolate, isolate->factory()->NewStringFromUtf8(CStrVector(buffer))); | 199 isolate, isolate->factory()->NewStringFromUtf8(CStrVector(buffer))); |
| 200 } | 200 } |
| 201 | 201 |
| 202 // ES6 section 20.3.2 The Date Constructor for the [[Construct]] case. | 202 // ES6 section 20.3.2 The Date Constructor for the [[Construct]] case. |
| 203 BUILTIN(DateConstructor_ConstructStub) { | 203 BUILTIN(DateConstructor_ConstructStub) { |
| 204 HandleScope scope(isolate); | 204 HandleScope scope(isolate); |
| 205 int const argc = args.length() - 1; | 205 int const argc = args.length() - 1; |
| 206 Handle<JSFunction> target = args.target<JSFunction>(); | 206 Handle<JSFunction> target = args.target(); |
| 207 Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target()); | 207 Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target()); |
| 208 double time_val; | 208 double time_val; |
| 209 if (argc == 0) { | 209 if (argc == 0) { |
| 210 time_val = JSDate::CurrentTimeValue(isolate); | 210 time_val = JSDate::CurrentTimeValue(isolate); |
| 211 } else if (argc == 1) { | 211 } else if (argc == 1) { |
| 212 Handle<Object> value = args.at<Object>(1); | 212 Handle<Object> value = args.at<Object>(1); |
| 213 if (value->IsJSDate()) { | 213 if (value->IsJSDate()) { |
| 214 time_val = Handle<JSDate>::cast(value)->value()->Number(); | 214 time_val = Handle<JSDate>::cast(value)->value()->Number(); |
| 215 } else { | 215 } else { |
| 216 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, | 216 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 // static | 1058 // static |
| 1059 void Builtins::Generate_DatePrototypeGetUTCSeconds( | 1059 void Builtins::Generate_DatePrototypeGetUTCSeconds( |
| 1060 CodeStubAssembler* assembler) { | 1060 CodeStubAssembler* assembler) { |
| 1061 Generate_DatePrototype_GetField(assembler, JSDate::kSecondUTC); | 1061 Generate_DatePrototype_GetField(assembler, JSDate::kSecondUTC); |
| 1062 } | 1062 } |
| 1063 | 1063 |
| 1064 } // namespace internal | 1064 } // namespace internal |
| 1065 } // namespace v8 | 1065 } // namespace v8 |
| OLD | NEW |