| 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 13736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13747 NONE)); | 13747 NONE)); |
| 13748 output->set(i, *result); | 13748 output->set(i, *result); |
| 13749 } | 13749 } |
| 13750 | 13750 |
| 13751 Handle<JSArray> result = isolate->factory()->NewJSArrayWithElements(output); | 13751 Handle<JSArray> result = isolate->factory()->NewJSArrayWithElements(output); |
| 13752 result->set_length(Smi::FromInt(length)); | 13752 result->set_length(Smi::FromInt(length)); |
| 13753 return *result; | 13753 return *result; |
| 13754 } | 13754 } |
| 13755 | 13755 |
| 13756 | 13756 |
| 13757 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObject) { |
| 13758 HandleScope scope(isolate); |
| 13759 |
| 13760 ASSERT(args.length() == 1); |
| 13761 |
| 13762 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
| 13763 |
| 13764 if (!input->IsJSObject()) return isolate->heap()->ToBoolean(false); |
| 13765 Handle<JSObject> obj = Handle<JSObject>::cast(input); |
| 13766 |
| 13767 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); |
| 13768 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate); |
| 13769 return isolate->heap()->ToBoolean(!tag->IsTheHole()); |
| 13770 } |
| 13771 |
| 13772 |
| 13773 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInitializedIntlObjectOfType) { |
| 13774 HandleScope scope(isolate); |
| 13775 |
| 13776 ASSERT(args.length() == 2); |
| 13777 |
| 13778 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
| 13779 CONVERT_ARG_HANDLE_CHECKED(String, expected_type, 1); |
| 13780 |
| 13781 if (!input->IsJSObject()) return isolate->heap()->ToBoolean(false); |
| 13782 Handle<JSObject> obj = Handle<JSObject>::cast(input); |
| 13783 |
| 13784 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); |
| 13785 Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate); |
| 13786 return isolate->heap()->ToBoolean( |
| 13787 tag->IsString() && String::cast(*tag)->Equals(*expected_type)); |
| 13788 } |
| 13789 |
| 13790 |
| 13791 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkAsInitializedIntlObjectOfType) { |
| 13792 HandleScope scope(isolate); |
| 13793 |
| 13794 ASSERT(args.length() == 3); |
| 13795 |
| 13796 CONVERT_ARG_HANDLE_CHECKED(JSObject, input, 0); |
| 13797 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
| 13798 CONVERT_ARG_HANDLE_CHECKED(JSObject, impl, 2); |
| 13799 |
| 13800 Handle<String> marker = isolate->factory()->intl_initialized_marker_string(); |
| 13801 JSObject::SetHiddenProperty(input, marker, type); |
| 13802 |
| 13803 marker = isolate->factory()->intl_impl_object_string(); |
| 13804 JSObject::SetHiddenProperty(input, marker, impl); |
| 13805 |
| 13806 return isolate->heap()->undefined_value(); |
| 13807 } |
| 13808 |
| 13809 |
| 13810 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetImplFromInitializedIntlObject) { |
| 13811 HandleScope scope(isolate); |
| 13812 |
| 13813 ASSERT(args.length() == 1); |
| 13814 |
| 13815 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
| 13816 |
| 13817 if (!input->IsJSObject()) { |
| 13818 Vector< Handle<Object> > arguments = HandleVector(&input, 1); |
| 13819 Handle<Object> type_error = |
| 13820 isolate->factory()->NewTypeError("not_intl_object", arguments); |
| 13821 return isolate->Throw(*type_error); |
| 13822 } |
| 13823 |
| 13824 Handle<JSObject> obj = Handle<JSObject>::cast(input); |
| 13825 |
| 13826 Handle<String> marker = isolate->factory()->intl_impl_object_string(); |
| 13827 Handle<Object> impl(obj->GetHiddenProperty(*marker), isolate); |
| 13828 if (impl->IsTheHole()) { |
| 13829 Vector< Handle<Object> > arguments = HandleVector(&obj, 1); |
| 13830 Handle<Object> type_error = |
| 13831 isolate->factory()->NewTypeError("not_intl_object", arguments); |
| 13832 return isolate->Throw(*type_error); |
| 13833 } |
| 13834 return *impl; |
| 13835 } |
| 13836 |
| 13837 |
| 13757 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateDateTimeFormat) { | 13838 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateDateTimeFormat) { |
| 13758 HandleScope scope(isolate); | 13839 HandleScope scope(isolate); |
| 13759 | 13840 |
| 13760 ASSERT(args.length() == 3); | 13841 ASSERT(args.length() == 3); |
| 13761 | 13842 |
| 13762 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0); | 13843 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0); |
| 13763 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1); | 13844 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1); |
| 13764 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2); | 13845 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2); |
| 13765 | 13846 |
| 13766 Handle<ObjectTemplateInfo> date_format_template = | 13847 Handle<ObjectTemplateInfo> date_format_template = |
| (...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14923 // Handle last resort GC and make sure to allow future allocations | 15004 // Handle last resort GC and make sure to allow future allocations |
| 14924 // to grow the heap without causing GCs (if possible). | 15005 // to grow the heap without causing GCs (if possible). |
| 14925 isolate->counters()->gc_last_resort_from_js()->Increment(); | 15006 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14926 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 15007 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14927 "Runtime::PerformGC"); | 15008 "Runtime::PerformGC"); |
| 14928 } | 15009 } |
| 14929 } | 15010 } |
| 14930 | 15011 |
| 14931 | 15012 |
| 14932 } } // namespace v8::internal | 15013 } } // namespace v8::internal |
| OLD | NEW |