| 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 9931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9942 slow_storage = loop_scope.CloseAndEscape(new_storage); | 9942 slow_storage = loop_scope.CloseAndEscape(new_storage); |
| 9943 } | 9943 } |
| 9944 } | 9944 } |
| 9945 } | 9945 } |
| 9946 clear_storage(); | 9946 clear_storage(); |
| 9947 set_storage(*slow_storage); | 9947 set_storage(*slow_storage); |
| 9948 fast_elements_ = false; | 9948 fast_elements_ = false; |
| 9949 } | 9949 } |
| 9950 | 9950 |
| 9951 inline void clear_storage() { | 9951 inline void clear_storage() { |
| 9952 isolate_->global_handles()->Destroy( | 9952 GlobalHandles::Destroy(Handle<Object>::cast(storage_).location()); |
| 9953 Handle<Object>::cast(storage_).location()); | |
| 9954 } | 9953 } |
| 9955 | 9954 |
| 9956 inline void set_storage(FixedArray* storage) { | 9955 inline void set_storage(FixedArray* storage) { |
| 9957 storage_ = Handle<FixedArray>::cast( | 9956 storage_ = Handle<FixedArray>::cast( |
| 9958 isolate_->global_handles()->Create(storage)); | 9957 isolate_->global_handles()->Create(storage)); |
| 9959 } | 9958 } |
| 9960 | 9959 |
| 9961 Isolate* isolate_; | 9960 Isolate* isolate_; |
| 9962 Handle<FixedArray> storage_; // Always a global handle. | 9961 Handle<FixedArray> storage_; // Always a global handle. |
| 9963 // Index after last seen index. Always less than or equal to | 9962 // Index after last seen index. Always less than or equal to |
| (...skipping 3835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13799 | 13798 |
| 13800 RETURN_IF_EMPTY_HANDLE(isolate, | 13799 RETURN_IF_EMPTY_HANDLE(isolate, |
| 13801 JSObject::SetLocalPropertyIgnoreAttributes( | 13800 JSObject::SetLocalPropertyIgnoreAttributes( |
| 13802 local_object, | 13801 local_object, |
| 13803 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")), | 13802 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")), |
| 13804 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 13803 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
| 13805 NONE)); | 13804 NONE)); |
| 13806 | 13805 |
| 13807 // Make object handle weak so we can delete the data format once GC kicks in. | 13806 // Make object handle weak so we can delete the data format once GC kicks in. |
| 13808 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 13807 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
| 13809 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 13808 GlobalHandles::MakeWeak(wrapper.location(), |
| 13810 NULL, | 13809 reinterpret_cast<void*>(wrapper.location()), |
| 13811 DateFormat::DeleteDateFormat); | 13810 DateFormat::DeleteDateFormat); |
| 13812 return *local_object; | 13811 return *local_object; |
| 13813 } | 13812 } |
| 13814 | 13813 |
| 13815 | 13814 |
| 13816 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) { | 13815 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) { |
| 13817 HandleScope scope(isolate); | 13816 HandleScope scope(isolate); |
| 13818 | 13817 |
| 13819 ASSERT(args.length() == 2); | 13818 ASSERT(args.length() == 2); |
| 13820 | 13819 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13903 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); | 13902 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); |
| 13904 | 13903 |
| 13905 RETURN_IF_EMPTY_HANDLE(isolate, | 13904 RETURN_IF_EMPTY_HANDLE(isolate, |
| 13906 JSObject::SetLocalPropertyIgnoreAttributes( | 13905 JSObject::SetLocalPropertyIgnoreAttributes( |
| 13907 local_object, | 13906 local_object, |
| 13908 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")), | 13907 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")), |
| 13909 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 13908 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
| 13910 NONE)); | 13909 NONE)); |
| 13911 | 13910 |
| 13912 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 13911 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
| 13913 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 13912 GlobalHandles::MakeWeak(wrapper.location(), |
| 13914 NULL, | 13913 reinterpret_cast<void*>(wrapper.location()), |
| 13915 NumberFormat::DeleteNumberFormat); | 13914 NumberFormat::DeleteNumberFormat); |
| 13916 return *local_object; | 13915 return *local_object; |
| 13917 } | 13916 } |
| 13918 | 13917 |
| 13919 | 13918 |
| 13920 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { | 13919 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { |
| 13921 HandleScope scope(isolate); | 13920 HandleScope scope(isolate); |
| 13922 | 13921 |
| 13923 ASSERT(args.length() == 2); | 13922 ASSERT(args.length() == 2); |
| 13924 | 13923 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14015 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); | 14014 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); |
| 14016 | 14015 |
| 14017 RETURN_IF_EMPTY_HANDLE(isolate, | 14016 RETURN_IF_EMPTY_HANDLE(isolate, |
| 14018 JSObject::SetLocalPropertyIgnoreAttributes( | 14017 JSObject::SetLocalPropertyIgnoreAttributes( |
| 14019 local_object, | 14018 local_object, |
| 14020 isolate->factory()->NewStringFromAscii(CStrVector("collator")), | 14019 isolate->factory()->NewStringFromAscii(CStrVector("collator")), |
| 14021 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 14020 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
| 14022 NONE)); | 14021 NONE)); |
| 14023 | 14022 |
| 14024 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14023 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
| 14025 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 14024 GlobalHandles::MakeWeak(wrapper.location(), |
| 14026 NULL, | 14025 reinterpret_cast<void*>(wrapper.location()), |
| 14027 Collator::DeleteCollator); | 14026 Collator::DeleteCollator); |
| 14028 return *local_object; | 14027 return *local_object; |
| 14029 } | 14028 } |
| 14030 | 14029 |
| 14031 | 14030 |
| 14032 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalCompare) { | 14031 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalCompare) { |
| 14033 HandleScope scope(isolate); | 14032 HandleScope scope(isolate); |
| 14034 | 14033 |
| 14035 ASSERT(args.length() == 3); | 14034 ASSERT(args.length() == 3); |
| 14036 | 14035 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14091 RETURN_IF_EMPTY_HANDLE(isolate, | 14090 RETURN_IF_EMPTY_HANDLE(isolate, |
| 14092 JSObject::SetLocalPropertyIgnoreAttributes( | 14091 JSObject::SetLocalPropertyIgnoreAttributes( |
| 14093 local_object, | 14092 local_object, |
| 14094 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")), | 14093 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")), |
| 14095 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 14094 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
| 14096 NONE)); | 14095 NONE)); |
| 14097 | 14096 |
| 14098 // Make object handle weak so we can delete the break iterator once GC kicks | 14097 // Make object handle weak so we can delete the break iterator once GC kicks |
| 14099 // in. | 14098 // in. |
| 14100 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14099 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
| 14101 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 14100 GlobalHandles::MakeWeak(wrapper.location(), |
| 14102 NULL, | 14101 reinterpret_cast<void*>(wrapper.location()), |
| 14103 BreakIterator::DeleteBreakIterator); | 14102 BreakIterator::DeleteBreakIterator); |
| 14104 return *local_object; | 14103 return *local_object; |
| 14105 } | 14104 } |
| 14106 | 14105 |
| 14107 | 14106 |
| 14108 RUNTIME_FUNCTION(MaybeObject*, Runtime_BreakIteratorAdoptText) { | 14107 RUNTIME_FUNCTION(MaybeObject*, Runtime_BreakIteratorAdoptText) { |
| 14109 HandleScope scope(isolate); | 14108 HandleScope scope(isolate); |
| 14110 | 14109 |
| 14111 ASSERT(args.length() == 2); | 14110 ASSERT(args.length() == 2); |
| 14112 | 14111 |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14903 // Handle last resort GC and make sure to allow future allocations | 14902 // Handle last resort GC and make sure to allow future allocations |
| 14904 // to grow the heap without causing GCs (if possible). | 14903 // to grow the heap without causing GCs (if possible). |
| 14905 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14904 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14906 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14905 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14907 "Runtime::PerformGC"); | 14906 "Runtime::PerformGC"); |
| 14908 } | 14907 } |
| 14909 } | 14908 } |
| 14910 | 14909 |
| 14911 | 14910 |
| 14912 } } // namespace v8::internal | 14911 } } // namespace v8::internal |
| OLD | NEW |