| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 5700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5711 if (has_pending_exception) return Failure::Exception(); | 5711 if (has_pending_exception) return Failure::Exception(); |
| 5712 return *result; | 5712 return *result; |
| 5713 } | 5713 } |
| 5714 | 5714 |
| 5715 | 5715 |
| 5716 // Helper function used by Runtime_DebugGetLoadedScripts below. | 5716 // Helper function used by Runtime_DebugGetLoadedScripts below. |
| 5717 static int DebugGetLoadedScripts(FixedArray* instances, int instances_size) { | 5717 static int DebugGetLoadedScripts(FixedArray* instances, int instances_size) { |
| 5718 NoHandleAllocation ha; | 5718 NoHandleAllocation ha; |
| 5719 AssertNoAllocation no_alloc; | 5719 AssertNoAllocation no_alloc; |
| 5720 | 5720 |
| 5721 // Get hold of the current empty script. | |
| 5722 Context* context = Top::context()->global_context(); | |
| 5723 Script* empty = context->empty_script(); | |
| 5724 | |
| 5725 // Scan heap for Script objects. | 5721 // Scan heap for Script objects. |
| 5726 int count = 0; | 5722 int count = 0; |
| 5727 HeapIterator iterator; | 5723 HeapIterator iterator; |
| 5728 while (iterator.has_next()) { | 5724 while (iterator.has_next()) { |
| 5729 HeapObject* obj = iterator.next(); | 5725 HeapObject* obj = iterator.next(); |
| 5730 ASSERT(obj != NULL); | 5726 ASSERT(obj != NULL); |
| 5731 if (obj->IsScript() && obj != empty) { | 5727 if (obj->IsScript()) { |
| 5732 if (instances != NULL && count < instances_size) { | 5728 if (instances != NULL && count < instances_size) { |
| 5733 instances->set(count, obj); | 5729 instances->set(count, obj); |
| 5734 } | 5730 } |
| 5735 count++; | 5731 count++; |
| 5736 } | 5732 } |
| 5737 } | 5733 } |
| 5738 | 5734 |
| 5739 return count; | 5735 return count; |
| 5740 } | 5736 } |
| 5741 | 5737 |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6136 } else { | 6132 } else { |
| 6137 // Handle last resort GC and make sure to allow future allocations | 6133 // Handle last resort GC and make sure to allow future allocations |
| 6138 // to grow the heap without causing GCs (if possible). | 6134 // to grow the heap without causing GCs (if possible). |
| 6139 Counters::gc_last_resort_from_js.Increment(); | 6135 Counters::gc_last_resort_from_js.Increment(); |
| 6140 Heap::CollectAllGarbage(); | 6136 Heap::CollectAllGarbage(); |
| 6141 } | 6137 } |
| 6142 } | 6138 } |
| 6143 | 6139 |
| 6144 | 6140 |
| 6145 } } // namespace v8::internal | 6141 } } // namespace v8::internal |
| OLD | NEW |