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 13603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13614 | 13614 |
13615 local_object->SetInternalField(0, reinterpret_cast<Smi*>(date_format)); | 13615 local_object->SetInternalField(0, reinterpret_cast<Smi*>(date_format)); |
13616 | 13616 |
13617 RETURN_IF_EMPTY_HANDLE(isolate, | 13617 RETURN_IF_EMPTY_HANDLE(isolate, |
13618 JSObject::SetLocalPropertyIgnoreAttributes( | 13618 JSObject::SetLocalPropertyIgnoreAttributes( |
13619 local_object, | 13619 local_object, |
13620 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")), | 13620 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")), |
13621 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 13621 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
13622 NONE)); | 13622 NONE)); |
13623 | 13623 |
13624 Persistent<v8::Object> wrapper(reinterpret_cast<v8::Isolate*>(isolate), | |
13625 v8::Utils::ToLocal(local_object)); | |
13626 // Make object handle weak so we can delete the data format once GC kicks in. | 13624 // Make object handle weak so we can delete the data format once GC kicks in. |
13627 wrapper.MakeWeak<void>(NULL, &DateFormat::DeleteDateFormat); | 13625 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
13628 wrapper.ClearAndLeak(); | 13626 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), |
| 13627 NULL, |
| 13628 DateFormat::DeleteDateFormat); |
13629 return *local_object; | 13629 return *local_object; |
13630 } | 13630 } |
13631 | 13631 |
13632 | 13632 |
13633 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) { | 13633 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalDateFormat) { |
13634 HandleScope scope(isolate); | 13634 HandleScope scope(isolate); |
13635 | 13635 |
13636 ASSERT(args.length() == 2); | 13636 ASSERT(args.length() == 2); |
13637 | 13637 |
13638 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0); | 13638 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13717 | 13717 |
13718 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); | 13718 local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format)); |
13719 | 13719 |
13720 RETURN_IF_EMPTY_HANDLE(isolate, | 13720 RETURN_IF_EMPTY_HANDLE(isolate, |
13721 JSObject::SetLocalPropertyIgnoreAttributes( | 13721 JSObject::SetLocalPropertyIgnoreAttributes( |
13722 local_object, | 13722 local_object, |
13723 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")), | 13723 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")), |
13724 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 13724 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
13725 NONE)); | 13725 NONE)); |
13726 | 13726 |
13727 Persistent<v8::Object> wrapper(reinterpret_cast<v8::Isolate*>(isolate), | 13727 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
13728 v8::Utils::ToLocal(local_object)); | 13728 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), |
13729 // Make object handle weak so we can delete the number format once GC kicks | 13729 NULL, |
13730 // in. | 13730 NumberFormat::DeleteNumberFormat); |
13731 wrapper.MakeWeak<void>(NULL, &NumberFormat::DeleteNumberFormat); | |
13732 wrapper.ClearAndLeak(); | |
13733 return *local_object; | 13731 return *local_object; |
13734 } | 13732 } |
13735 | 13733 |
13736 | 13734 |
13737 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { | 13735 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalNumberFormat) { |
13738 HandleScope scope(isolate); | 13736 HandleScope scope(isolate); |
13739 | 13737 |
13740 ASSERT(args.length() == 2); | 13738 ASSERT(args.length() == 2); |
13741 | 13739 |
13742 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0); | 13740 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13830 | 13828 |
13831 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); | 13829 local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator)); |
13832 | 13830 |
13833 RETURN_IF_EMPTY_HANDLE(isolate, | 13831 RETURN_IF_EMPTY_HANDLE(isolate, |
13834 JSObject::SetLocalPropertyIgnoreAttributes( | 13832 JSObject::SetLocalPropertyIgnoreAttributes( |
13835 local_object, | 13833 local_object, |
13836 isolate->factory()->NewStringFromAscii(CStrVector("collator")), | 13834 isolate->factory()->NewStringFromAscii(CStrVector("collator")), |
13837 isolate->factory()->NewStringFromAscii(CStrVector("valid")), | 13835 isolate->factory()->NewStringFromAscii(CStrVector("valid")), |
13838 NONE)); | 13836 NONE)); |
13839 | 13837 |
13840 Persistent<v8::Object> wrapper(reinterpret_cast<v8::Isolate*>(isolate), | 13838 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
13841 v8::Utils::ToLocal(local_object)); | 13839 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(wrapper.location()), |
13842 // Make object handle weak so we can delete the collator once GC kicks in. | 13840 NULL, |
13843 wrapper.MakeWeak<void>(NULL, &Collator::DeleteCollator); | 13841 Collator::DeleteCollator); |
13844 wrapper.ClearAndLeak(); | |
13845 return *local_object; | 13842 return *local_object; |
13846 } | 13843 } |
13847 | 13844 |
13848 | 13845 |
13849 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalCompare) { | 13846 RUNTIME_FUNCTION(MaybeObject*, Runtime_InternalCompare) { |
13850 HandleScope scope(isolate); | 13847 HandleScope scope(isolate); |
13851 | 13848 |
13852 ASSERT(args.length() == 3); | 13849 ASSERT(args.length() == 3); |
13853 | 13850 |
13854 CONVERT_ARG_HANDLE_CHECKED(JSObject, collator_holder, 0); | 13851 CONVERT_ARG_HANDLE_CHECKED(JSObject, collator_holder, 0); |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14481 // Handle last resort GC and make sure to allow future allocations | 14478 // Handle last resort GC and make sure to allow future allocations |
14482 // to grow the heap without causing GCs (if possible). | 14479 // to grow the heap without causing GCs (if possible). |
14483 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14480 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14484 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14481 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14485 "Runtime::PerformGC"); | 14482 "Runtime::PerformGC"); |
14486 } | 14483 } |
14487 } | 14484 } |
14488 | 14485 |
14489 | 14486 |
14490 } } // namespace v8::internal | 14487 } } // namespace v8::internal |
OLD | NEW |