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 9913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9924 slow_storage = loop_scope.CloseAndEscape(new_storage); | 9924 slow_storage = loop_scope.CloseAndEscape(new_storage); |
9925 } | 9925 } |
9926 } | 9926 } |
9927 } | 9927 } |
9928 clear_storage(); | 9928 clear_storage(); |
9929 set_storage(*slow_storage); | 9929 set_storage(*slow_storage); |
9930 fast_elements_ = false; | 9930 fast_elements_ = false; |
9931 } | 9931 } |
9932 | 9932 |
9933 inline void clear_storage() { | 9933 inline void clear_storage() { |
9934 isolate_->global_handles()->Destroy( | 9934 GlobalHandles::Destroy(Handle<Object>::cast(storage_).location()); |
9935 Handle<Object>::cast(storage_).location()); | |
9936 } | 9935 } |
9937 | 9936 |
9938 inline void set_storage(FixedArray* storage) { | 9937 inline void set_storage(FixedArray* storage) { |
9939 storage_ = Handle<FixedArray>::cast( | 9938 storage_ = Handle<FixedArray>::cast( |
9940 isolate_->global_handles()->Create(storage)); | 9939 isolate_->global_handles()->Create(storage)); |
9941 } | 9940 } |
9942 | 9941 |
9943 Isolate* isolate_; | 9942 Isolate* isolate_; |
9944 Handle<FixedArray> storage_; // Always a global handle. | 9943 Handle<FixedArray> storage_; // Always a global handle. |
9945 // Index after last seen index. Always less than or equal to | 9944 // Index after last seen index. Always less than or equal to |
(...skipping 3835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13781 | 13780 |
13782 RETURN_IF_EMPTY_HANDLE(isolate, | 13781 RETURN_IF_EMPTY_HANDLE(isolate, |
13783 JSObject::SetLocalPropertyIgnoreAttributes( | 13782 JSObject::SetLocalPropertyIgnoreAttributes( |
13784 local_object, | 13783 local_object, |
13785 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")), | 13784 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")), |
13786 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 13785 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
13787 NONE)); | 13786 NONE)); |
13788 | 13787 |
13789 // Make object handle weak so we can delete the data format once GC kicks in. | 13788 // Make object handle weak so we can delete the data format once GC kicks in. |
13790 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 13789 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
13791 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 13790 GlobalHandles::MakeWeak(wrapper.location(), |
13792 NULL, | 13791 reinterpret_cast<void*>(wrapper.location()), |
13793 DateFormat::DeleteDateFormat); | 13792 DateFormat::DeleteDateFormat); |
13794 return *local_object; | 13793 return *local_object; |
13795 } | 13794 } |
13796 | 13795 |
13797 | 13796 |
13798 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) { | 13797 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) { |
13799 HandleScope scope(isolate); | 13798 HandleScope scope(isolate); |
13800 | 13799 |
13801 ASSERT(args.length() == 2); | 13800 ASSERT(args.length() == 2); |
13802 | 13801 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13885 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); | 13884 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); |
13886 | 13885 |
13887 RETURN_IF_EMPTY_HANDLE(isolate, | 13886 RETURN_IF_EMPTY_HANDLE(isolate, |
13888 JSObject::SetLocalPropertyIgnoreAttributes( | 13887 JSObject::SetLocalPropertyIgnoreAttributes( |
13889 local_object, | 13888 local_object, |
13890 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")), | 13889 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")), |
13891 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 13890 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
13892 NONE)); | 13891 NONE)); |
13893 | 13892 |
13894 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 13893 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
13895 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 13894 GlobalHandles::MakeWeak(wrapper.location(), |
13896 NULL, | 13895 reinterpret_cast<void*>(wrapper.location()), |
13897 NumberFormat::DeleteNumberFormat); | 13896 NumberFormat::DeleteNumberFormat); |
13898 return *local_object; | 13897 return *local_object; |
13899 } | 13898 } |
13900 | 13899 |
13901 | 13900 |
13902 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { | 13901 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { |
13903 HandleScope scope(isolate); | 13902 HandleScope scope(isolate); |
13904 | 13903 |
13905 ASSERT(args.length() == 2); | 13904 ASSERT(args.length() == 2); |
13906 | 13905 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13997 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); | 13996 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); |
13998 | 13997 |
13999 RETURN_IF_EMPTY_HANDLE(isolate, | 13998 RETURN_IF_EMPTY_HANDLE(isolate, |
14000 JSObject::SetLocalPropertyIgnoreAttributes( | 13999 JSObject::SetLocalPropertyIgnoreAttributes( |
14001 local_object, | 14000 local_object, |
14002 isolate->factory()->NewStringFromAscii(CStrVector("collator")), | 14001 isolate->factory()->NewStringFromAscii(CStrVector("collator")), |
14003 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 14002 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
14004 NONE)); | 14003 NONE)); |
14005 | 14004 |
14006 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14005 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
14007 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 14006 GlobalHandles::MakeWeak(wrapper.location(), |
14008 NULL, | 14007 reinterpret_cast<void*>(wrapper.location()), |
14009 Collator::DeleteCollator); | 14008 Collator::DeleteCollator); |
14010 return *local_object; | 14009 return *local_object; |
14011 } | 14010 } |
14012 | 14011 |
14013 | 14012 |
14014 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalCompare) { | 14013 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalCompare) { |
14015 HandleScope scope(isolate); | 14014 HandleScope scope(isolate); |
14016 | 14015 |
14017 ASSERT(args.length() == 3); | 14016 ASSERT(args.length() == 3); |
14018 | 14017 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14073 RETURN_IF_EMPTY_HANDLE(isolate, | 14072 RETURN_IF_EMPTY_HANDLE(isolate, |
14074 JSObject::SetLocalPropertyIgnoreAttributes( | 14073 JSObject::SetLocalPropertyIgnoreAttributes( |
14075 local_object, | 14074 local_object, |
14076 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")), | 14075 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")), |
14077 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 14076 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
14078 NONE)); | 14077 NONE)); |
14079 | 14078 |
14080 // Make object handle weak so we can delete the break iterator once GC kicks | 14079 // Make object handle weak so we can delete the break iterator once GC kicks |
14081 // in. | 14080 // in. |
14082 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 14081 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
14083 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), | 14082 GlobalHandles::MakeWeak(wrapper.location(), |
14084 NULL, | 14083 reinterpret_cast<void*>(wrapper.location()), |
14085 BreakIterator::DeleteBreakIterator); | 14084 BreakIterator::DeleteBreakIterator); |
14086 return *local_object; | 14085 return *local_object; |
14087 } | 14086 } |
14088 | 14087 |
14089 | 14088 |
14090 RUNTIME_FUNCTION(MaybeObject*, Runtime_BreakIteratorAdoptText) { | 14089 RUNTIME_FUNCTION(MaybeObject*, Runtime_BreakIteratorAdoptText) { |
14091 HandleScope scope(isolate); | 14090 HandleScope scope(isolate); |
14092 | 14091 |
14093 ASSERT(args.length() == 2); | 14092 ASSERT(args.length() == 2); |
14094 | 14093 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14885 // Handle last resort GC and make sure to allow future allocations | 14884 // Handle last resort GC and make sure to allow future allocations |
14886 // to grow the heap without causing GCs (if possible). | 14885 // to grow the heap without causing GCs (if possible). |
14887 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14886 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14888 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14887 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14889 "Runtime::PerformGC"); | 14888 "Runtime::PerformGC"); |
14890 } | 14889 } |
14891 } | 14890 } |
14892 | 14891 |
14893 | 14892 |
14894 } } // namespace v8::internal | 14893 } } // namespace v8::internal |
OLD | NEW |