| 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 14768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14779 } | 14779 } |
| 14780 return NULL; | 14780 return NULL; |
| 14781 } | 14781 } |
| 14782 | 14782 |
| 14783 | 14783 |
| 14784 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 14784 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 14785 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 14785 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 14786 } | 14786 } |
| 14787 | 14787 |
| 14788 | 14788 |
| 14789 void Runtime::PerformGC(Object* result) { | 14789 void Runtime::PerformGC(Object* result, Isolate* isolate) { |
| 14790 Isolate* isolate = Isolate::Current(); | |
| 14791 Failure* failure = Failure::cast(result); | 14790 Failure* failure = Failure::cast(result); |
| 14792 if (failure->IsRetryAfterGC()) { | 14791 if (failure->IsRetryAfterGC()) { |
| 14793 if (isolate->heap()->new_space()->AddFreshPage()) { | 14792 if (isolate->heap()->new_space()->AddFreshPage()) { |
| 14794 return; | 14793 return; |
| 14795 } | 14794 } |
| 14796 | 14795 |
| 14797 // Try to do a garbage collection; ignore it if it fails. The C | 14796 // Try to do a garbage collection; ignore it if it fails. The C |
| 14798 // entry stub will throw an out-of-memory exception in that case. | 14797 // entry stub will throw an out-of-memory exception in that case. |
| 14799 isolate->heap()->CollectGarbage(failure->allocation_space(), | 14798 isolate->heap()->CollectGarbage(failure->allocation_space(), |
| 14800 "Runtime::PerformGC"); | 14799 "Runtime::PerformGC"); |
| 14801 } else { | 14800 } else { |
| 14802 // Handle last resort GC and make sure to allow future allocations | 14801 // Handle last resort GC and make sure to allow future allocations |
| 14803 // to grow the heap without causing GCs (if possible). | 14802 // to grow the heap without causing GCs (if possible). |
| 14804 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14803 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14805 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14804 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14806 "Runtime::PerformGC"); | 14805 "Runtime::PerformGC"); |
| 14807 } | 14806 } |
| 14808 } | 14807 } |
| 14809 | 14808 |
| 14810 | 14809 |
| 14811 } } // namespace v8::internal | 14810 } } // namespace v8::internal |
| OLD | NEW |