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 12907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12918 SmartArrayPointer<char> flags = | 12918 SmartArrayPointer<char> flags = |
12919 arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 12919 arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
12920 FlagList::SetFlagsFromString(*flags, StrLength(*flags)); | 12920 FlagList::SetFlagsFromString(*flags, StrLength(*flags)); |
12921 return isolate->heap()->undefined_value(); | 12921 return isolate->heap()->undefined_value(); |
12922 } | 12922 } |
12923 | 12923 |
12924 | 12924 |
12925 // Performs a GC. | 12925 // Performs a GC. |
12926 // Presently, it only does a full GC. | 12926 // Presently, it only does a full GC. |
12927 RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectGarbage) { | 12927 RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectGarbage) { |
12928 isolate->heap()->CollectAllGarbage(true, "%CollectGarbage"); | 12928 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, "%CollectGarbage"); |
12929 return isolate->heap()->undefined_value(); | 12929 return isolate->heap()->undefined_value(); |
12930 } | 12930 } |
12931 | 12931 |
12932 | 12932 |
12933 // Gets the current heap usage. | 12933 // Gets the current heap usage. |
12934 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHeapUsage) { | 12934 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetHeapUsage) { |
12935 int usage = static_cast<int>(isolate->heap()->SizeOfObjects()); | 12935 int usage = static_cast<int>(isolate->heap()->SizeOfObjects()); |
12936 if (!Smi::IsValid(usage)) { | 12936 if (!Smi::IsValid(usage)) { |
12937 return *isolate->factory()->NewNumberFromInt(usage); | 12937 return *isolate->factory()->NewNumberFromInt(usage); |
12938 } | 12938 } |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13645 // Handle last resort GC and make sure to allow future allocations | 13645 // Handle last resort GC and make sure to allow future allocations |
13646 // to grow the heap without causing GCs (if possible). | 13646 // to grow the heap without causing GCs (if possible). |
13647 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13647 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13648 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13648 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13649 "Runtime::PerformGC"); | 13649 "Runtime::PerformGC"); |
13650 } | 13650 } |
13651 } | 13651 } |
13652 | 13652 |
13653 | 13653 |
13654 } } // namespace v8::internal | 13654 } } // namespace v8::internal |
OLD | NEW |