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 9921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9932 slow_storage = loop_scope.CloseAndEscape(new_storage); | 9932 slow_storage = loop_scope.CloseAndEscape(new_storage); |
9933 } | 9933 } |
9934 } | 9934 } |
9935 } | 9935 } |
9936 clear_storage(); | 9936 clear_storage(); |
9937 set_storage(*slow_storage); | 9937 set_storage(*slow_storage); |
9938 fast_elements_ = false; | 9938 fast_elements_ = false; |
9939 } | 9939 } |
9940 | 9940 |
9941 inline void clear_storage() { | 9941 inline void clear_storage() { |
9942 isolate_->global_handles()->Destroy( | 9942 GlobalHandles::Destroy(Handle<Object>::cast(storage_).location()); |
9943 Handle<Object>::cast(storage_).location()); | |
9944 } | 9943 } |
9945 | 9944 |
9946 inline void set_storage(FixedArray* storage) { | 9945 inline void set_storage(FixedArray* storage) { |
9947 storage_ = Handle<FixedArray>::cast( | 9946 storage_ = Handle<FixedArray>::cast( |
9948 isolate_->global_handles()->Create(storage)); | 9947 isolate_->global_handles()->Create(storage)); |
9949 } | 9948 } |
9950 | 9949 |
9951 Isolate* isolate_; | 9950 Isolate* isolate_; |
9952 Handle<FixedArray> storage_; // Always a global handle. | 9951 Handle<FixedArray> storage_; // Always a global handle. |
9953 // Index after last seen index. Always less than or equal to | 9952 // Index after last seen index. Always less than or equal to |
(...skipping 3835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13789 | 13788 |
13790 RETURN_IF_EMPTY_HANDLE(isolate, | 13789 RETURN_IF_EMPTY_HANDLE(isolate, |
13791 JSObject::SetLocalPropertyIgnoreAttributes( | 13790 JSObject::SetLocalPropertyIgnoreAttributes( |
13792 local_object, | 13791 local_object, |
13793 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")), | 13792 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")), |
13794 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 13793 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
13795 NONE)); | 13794 NONE)); |
13796 | 13795 |
13797 // Make object handle weak so we can delete the data format once GC kicks in. | 13796 // Make object handle weak so we can delete the data format once GC kicks in. |
13798 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 13797 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
13799 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 13798 GlobalHandles::MakeWeak(wrapper.location(), |
13800 NULL, | 13799 reinterpret_cast<void*>(wrapper.location()), |
13801 DateFormat::DeleteDateFormat); | 13800 DateFormat::DeleteDateFormat); |
13802 return *local_object; | 13801 return *local_object; |
13803 } | 13802 } |
13804 | 13803 |
13805 | 13804 |
13806 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) { | 13805 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) { |
13807 HandleScope scope(isolate); | 13806 HandleScope scope(isolate); |
13808 | 13807 |
13809 ASSERT(args.length() == 2); | 13808 ASSERT(args.length() == 2); |
13810 | 13809 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13893 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); | 13892 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); |
13894 | 13893 |
13895 RETURN_IF_EMPTY_HANDLE(isolate, | 13894 RETURN_IF_EMPTY_HANDLE(isolate, |
13896 JSObject::SetLocalPropertyIgnoreAttributes( | 13895 JSObject::SetLocalPropertyIgnoreAttributes( |
13897 local_object, | 13896 local_object, |
13898 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")), | 13897 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")), |
13899 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 13898 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
13900 NONE)); | 13899 NONE)); |
13901 | 13900 |
13902 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 13901 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
13903 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 13902 GlobalHandles::MakeWeak(wrapper.location(), |
13904 NULL, | 13903 reinterpret_cast<void*>(wrapper.location()), |
13905 NumberFormat::DeleteNumberFormat); | 13904 NumberFormat::DeleteNumberFormat); |
13906 return *local_object; | 13905 return *local_object; |
13907 } | 13906 } |
13908 | 13907 |
13909 | 13908 |
13910 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { | 13909 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { |
13911 HandleScope scope(isolate); | 13910 HandleScope scope(isolate); |
13912 | 13911 |
13913 ASSERT(args.length() == 2); | 13912 ASSERT(args.length() == 2); |
13914 | 13913 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14005 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); | 14004 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); |
14006 | 14005 |
14007 RETURN_IF_EMPTY_HANDLE(isolate, | 14006 RETURN_IF_EMPTY_HANDLE(isolate, |
14008 JSObject::SetLocalPropertyIgnoreAttributes( | 14007 JSObject::SetLocalPropertyIgnoreAttributes( |
14009 local_object, | 14008 local_object, |
14010 isolate->factory()->NewStringFromAscii(CStrVector("collator")), | 14009 isolate->factory()->NewStringFromAscii(CStrVector("collator")), |
14011 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 14010 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
14012 NONE)); | 14011 NONE)); |
14013 | 14012 |
14014 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14013 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
14015 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 14014 GlobalHandles::MakeWeak(wrapper.location(), |
14016 NULL, | 14015 reinterpret_cast<void*>(wrapper.location()), |
14017 Collator::DeleteCollator); | 14016 Collator::DeleteCollator); |
14018 return *local_object; | 14017 return *local_object; |
14019 } | 14018 } |
14020 | 14019 |
14021 | 14020 |
14022 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalCompare) { | 14021 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalCompare) { |
14023 HandleScope scope(isolate); | 14022 HandleScope scope(isolate); |
14024 | 14023 |
14025 ASSERT(args.length() == 3); | 14024 ASSERT(args.length() == 3); |
14026 | 14025 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14081 RETURN_IF_EMPTY_HANDLE(isolate, | 14080 RETURN_IF_EMPTY_HANDLE(isolate, |
14082 JSObject::SetLocalPropertyIgnoreAttributes( | 14081 JSObject::SetLocalPropertyIgnoreAttributes( |
14083 local_object, | 14082 local_object, |
14084 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")), | 14083 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")), |
14085 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 14084 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
14086 NONE)); | 14085 NONE)); |
14087 | 14086 |
14088 // Make object handle weak so we can delete the break iterator once GC kicks | 14087 // Make object handle weak so we can delete the break iterator once GC kicks |
14089 // in. | 14088 // in. |
14090 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14089 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
14091 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 14090 GlobalHandles::MakeWeak(wrapper.location(), |
14092 NULL, | 14091 reinterpret_cast<void*>(wrapper.location()), |
14093 BreakIterator::DeleteBreakIterator); | 14092 BreakIterator::DeleteBreakIterator); |
14094 return *local_object; | 14093 return *local_object; |
14095 } | 14094 } |
14096 | 14095 |
14097 | 14096 |
14098 RUNTIME_FUNCTION(MaybeObject*, Runtime_BreakIteratorAdoptText) { | 14097 RUNTIME_FUNCTION(MaybeObject*, Runtime_BreakIteratorAdoptText) { |
14099 HandleScope scope(isolate); | 14098 HandleScope scope(isolate); |
14100 | 14099 |
14101 ASSERT(args.length() == 2); | 14100 ASSERT(args.length() == 2); |
14102 | 14101 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14893 // Handle last resort GC and make sure to allow future allocations | 14892 // Handle last resort GC and make sure to allow future allocations |
14894 // to grow the heap without causing GCs (if possible). | 14893 // to grow the heap without causing GCs (if possible). |
14895 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14894 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14896 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14895 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14897 "Runtime::PerformGC"); | 14896 "Runtime::PerformGC"); |
14898 } | 14897 } |
14899 } | 14898 } |
14900 | 14899 |
14901 | 14900 |
14902 } } // namespace v8::internal | 14901 } } // namespace v8::internal |
OLD | NEW |