| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 13918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13929 NONE)); | 13929 NONE)); |
| 13930 output->set(i, *result); | 13930 output->set(i, *result); |
| 13931 } | 13931 } |
| 13932 | 13932 |
| 13933 Handle<JSArray> result = isolate->factory()->NewJSArrayWithElements(output); | 13933 Handle<JSArray> result = isolate->factory()->NewJSArrayWithElements(output); |
| 13934 result->set_length(Smi::FromInt(length)); | 13934 result->set_length(Smi::FromInt(length)); |
| 13935 return *result; | 13935 return *result; |
| 13936 } | 13936 } |
| 13937 | 13937 |
| 13938 | 13938 |
| 13939 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObject) { |
| 13940 HandleScope scope(isolate); |
| 13941 |
| 13942 ASSERT(args.length() == 1); |
| 13943 |
| 13944 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
| 13945 |
| 13946 if (!input->IsJSObject()) return isolate->heap()->ToBoolean(false); |
| 13947 Handle<JSObject> obj = Handle<JSObject>::cast(input); |
| 13948 |
| 13949 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); |
| 13950 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate); |
| 13951 return isolate->heap()->ToBoolean(!tag->IsTheHole()); |
| 13952 } |
| 13953 |
| 13954 |
| 13955 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObjectOfType) { |
| 13956 HandleScope scope(isolate); |
| 13957 |
| 13958 ASSERT(args.length() == 2); |
| 13959 |
| 13960 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
| 13961 CONVERT_ARG_HANDLE_CHECKED(String, expected_type, 1); |
| 13962 |
| 13963 if (!input->IsJSObject()) return isolate->heap()->ToBoolean(false); |
| 13964 Handle<JSObject> obj = Handle<JSObject>::cast(input); |
| 13965 |
| 13966 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); |
| 13967 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate); |
| 13968 return isolate->heap()->ToBoolean( |
| 13969 tag->IsString() && String::cast(*tag)->Equals(*expected_type)); |
| 13970 } |
| 13971 |
| 13972 |
| 13973 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkAsInitializedIntlObjectOfType) { |
| 13974 HandleScope scope(isolate); |
| 13975 |
| 13976 ASSERT(args.length() == 3); |
| 13977 |
| 13978 CONVERT_ARG_HANDLE_CHECKED(JSObject, input, 0); |
| 13979 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
| 13980 CONVERT_ARG_HANDLE_CHECKED(JSObject, impl, 2); |
| 13981 |
| 13982 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); |
| 13983 JSObject::SetHiddenProperty(input, marker, type); |
| 13984 |
| 13985 marker = isolate->factory()->intl_impl_object_string(); |
| 13986 JSObject::SetHiddenProperty(input, marker, impl); |
| 13987 |
| 13988 return isolate->heap()->undefined_value(); |
| 13989 } |
| 13990 |
| 13991 |
| 13992 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetImplFromInitializedIntlObject) { |
| 13993 HandleScope scope(isolate); |
| 13994 |
| 13995 ASSERT(args.length() == 1); |
| 13996 |
| 13997 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
| 13998 |
| 13999 if (!input->IsJSObject()) { |
| 14000 Vector< Handle<Object> > arguments = HandleVector(&input, 1); |
| 14001 Handle<Object> type_error = |
| 14002 isolate->factory()->NewTypeError("not_intl_object", arguments); |
| 14003 return isolate->Throw(*type_error); |
| 14004 } |
| 14005 |
| 14006 Handle<JSObject> obj = Handle<JSObject>::cast(input); |
| 14007 |
| 14008 Handle<String> marker = isolate->factory()->intl_impl_object_string(); |
| 14009 Handle<Object> impl(obj->GetHiddenProperty(*marker), isolate); |
| 14010 if (impl->IsTheHole()) { |
| 14011 Vector< Handle<Object> > arguments = HandleVector(&obj, 1); |
| 14012 Handle<Object> type_error = |
| 14013 isolate->factory()->NewTypeError("not_intl_object", arguments); |
| 14014 return isolate->Throw(*type_error); |
| 14015 } |
| 14016 return *impl; |
| 14017 } |
| 14018 |
| 14019 |
| 13939 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateDateTimeFormat) { | 14020 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateDateTimeFormat) { |
| 13940 HandleScope scope(isolate); | 14021 HandleScope scope(isolate); |
| 13941 | 14022 |
| 13942 ASSERT(args.length() == 3); | 14023 ASSERT(args.length() == 3); |
| 13943 | 14024 |
| 13944 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0); | 14025 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0); |
| 13945 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1); | 14026 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1); |
| 13946 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2); | 14027 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2); |
| 13947 | 14028 |
| 13948 Handle<ObjectTemplateInfo> date_format_template = | 14029 Handle<ObjectTemplateInfo> date_format_template = |
| (...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15169 // Handle last resort GC and make sure to allow future allocations | 15250 // Handle last resort GC and make sure to allow future allocations |
| 15170 // to grow the heap without causing GCs (if possible). | 15251 // to grow the heap without causing GCs (if possible). |
| 15171 isolate->counters()->gc_last_resort_from_js()->Increment(); | 15252 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 15172 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 15253 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 15173 "Runtime::PerformGC"); | 15254 "Runtime::PerformGC"); |
| 15174 } | 15255 } |
| 15175 } | 15256 } |
| 15176 | 15257 |
| 15177 | 15258 |
| 15178 } } // namespace v8::internal | 15259 } } // namespace v8::internal |
| OLD | NEW |