| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 12234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12245 | 12245 |
| 12246 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 12246 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 12247 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 12247 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 12248 } | 12248 } |
| 12249 | 12249 |
| 12250 | 12250 |
| 12251 void Runtime::PerformGC(Object* result) { | 12251 void Runtime::PerformGC(Object* result) { |
| 12252 Isolate* isolate = Isolate::Current(); | 12252 Isolate* isolate = Isolate::Current(); |
| 12253 Failure* failure = Failure::cast(result); | 12253 Failure* failure = Failure::cast(result); |
| 12254 if (failure->IsRetryAfterGC()) { | 12254 if (failure->IsRetryAfterGC()) { |
| 12255 if (isolate->heap()->new_space()->AddFreshPage()) { |
| 12256 return; |
| 12257 } |
| 12255 // Try to do a garbage collection; ignore it if it fails. The C | 12258 // Try to do a garbage collection; ignore it if it fails. The C |
| 12256 // entry stub will throw an out-of-memory exception in that case. | 12259 // entry stub will throw an out-of-memory exception in that case. |
| 12257 isolate->heap()->CollectGarbage(failure->allocation_space()); | 12260 isolate->heap()->CollectGarbage(failure->allocation_space()); |
| 12258 } else { | 12261 } else { |
| 12259 // Handle last resort GC and make sure to allow future allocations | 12262 // Handle last resort GC and make sure to allow future allocations |
| 12260 // to grow the heap without causing GCs (if possible). | 12263 // to grow the heap without causing GCs (if possible). |
| 12261 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12264 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 12262 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 12265 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
| 12263 } | 12266 } |
| 12264 } | 12267 } |
| 12265 | 12268 |
| 12266 | 12269 |
| 12267 } } // namespace v8::internal | 12270 } } // namespace v8::internal |
| OLD | NEW |