| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton( | 163 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton( |
| 164 EternalHandles::DATE_CACHE_VERSION)); | 164 EternalHandles::DATE_CACHE_VERSION)); |
| 165 // Return result as a JS array. | 165 // Return result as a JS array. |
| 166 Handle<JSObject> result = | 166 Handle<JSObject> result = |
| 167 isolate->factory()->NewJSObject(isolate->array_function()); | 167 isolate->factory()->NewJSObject(isolate->array_function()); |
| 168 JSArray::SetContent(Handle<JSArray>::cast(result), date_cache_version); | 168 JSArray::SetContent(Handle<JSArray>::cast(result), date_cache_version); |
| 169 return *result; | 169 return *result; |
| 170 } | 170 } |
| 171 | 171 |
| 172 | 172 |
| 173 RUNTIME_FUNCTION(RuntimeReference_DateField) { | 173 RUNTIME_FUNCTION(Runtime_DateField) { |
| 174 SealHandleScope shs(isolate); | 174 SealHandleScope shs(isolate); |
| 175 DCHECK(args.length() == 2); | 175 DCHECK(args.length() == 2); |
| 176 CONVERT_ARG_CHECKED(Object, obj, 0); | 176 CONVERT_ARG_CHECKED(Object, obj, 0); |
| 177 CONVERT_SMI_ARG_CHECKED(index, 1); | 177 CONVERT_SMI_ARG_CHECKED(index, 1); |
| 178 if (!obj->IsJSDate()) { | 178 if (!obj->IsJSDate()) { |
| 179 HandleScope scope(isolate); | 179 HandleScope scope(isolate); |
| 180 THROW_NEW_ERROR_RETURN_FAILURE( | 180 THROW_NEW_ERROR_RETURN_FAILURE( |
| 181 isolate, | 181 isolate, |
| 182 NewTypeError("not_date_object", HandleVector<Object>(NULL, 0))); | 182 NewTypeError("not_date_object", HandleVector<Object>(NULL, 0))); |
| 183 } | 183 } |
| 184 JSDate* date = JSDate::cast(obj); | 184 JSDate* date = JSDate::cast(obj); |
| 185 if (index == 0) return date->value(); | 185 if (index == 0) return date->value(); |
| 186 return JSDate::GetField(date, Smi::FromInt(index)); | 186 return JSDate::GetField(date, Smi::FromInt(index)); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 } // namespace v8::internal | 189 } // namespace v8::internal |
| OLD | NEW |