| 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 13306 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  13317 } |  13317 } | 
|  13318  |  13318  | 
|  13319  |  13319  | 
|  13320 void Runtime::PerformGC(Object* result) { |  13320 void Runtime::PerformGC(Object* result) { | 
|  13321   Isolate* isolate = Isolate::Current(); |  13321   Isolate* isolate = Isolate::Current(); | 
|  13322   Failure* failure = Failure::cast(result); |  13322   Failure* failure = Failure::cast(result); | 
|  13323   if (failure->IsRetryAfterGC()) { |  13323   if (failure->IsRetryAfterGC()) { | 
|  13324     if (isolate->heap()->new_space()->AddFreshPage()) { |  13324     if (isolate->heap()->new_space()->AddFreshPage()) { | 
|  13325       return; |  13325       return; | 
|  13326     } |  13326     } | 
 |  13327  | 
|  13327     // Try to do a garbage collection; ignore it if it fails. The C |  13328     // Try to do a garbage collection; ignore it if it fails. The C | 
|  13328     // entry stub will throw an out-of-memory exception in that case. |  13329     // entry stub will throw an out-of-memory exception in that case. | 
|  13329     isolate->heap()->CollectGarbage(failure->allocation_space(), |  13330     isolate->heap()->CollectGarbage(failure->allocation_space(), | 
|  13330                                     "Runtime::PerformGC"); |  13331                                     "Runtime::PerformGC"); | 
|  13331   } else { |  13332   } else { | 
|  13332     // Handle last resort GC and make sure to allow future allocations |  13333     // Handle last resort GC and make sure to allow future allocations | 
|  13333     // to grow the heap without causing GCs (if possible). |  13334     // to grow the heap without causing GCs (if possible). | 
|  13334     isolate->counters()->gc_last_resort_from_js()->Increment(); |  13335     isolate->counters()->gc_last_resort_from_js()->Increment(); | 
|  13335     isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |  13336     isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 
|  13336                                        "Runtime::PerformGC"); |  13337                                        "Runtime::PerformGC"); | 
|  13337   } |  13338   } | 
|  13338 } |  13339 } | 
|  13339  |  13340  | 
|  13340  |  13341  | 
|  13341 } }  // namespace v8::internal |  13342 } }  // namespace v8::internal | 
| OLD | NEW |