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 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 // scripts which is no longer referenced. | 1688 // scripts which is no longer referenced. |
1689 Heap::CollectAllGarbage(false); | 1689 Heap::CollectAllGarbage(false); |
1690 Heap::CollectAllGarbage(false); | 1690 Heap::CollectAllGarbage(false); |
1691 | 1691 |
1692 ASSERT(script_cache_ == NULL); | 1692 ASSERT(script_cache_ == NULL); |
1693 script_cache_ = new ScriptCache(); | 1693 script_cache_ = new ScriptCache(); |
1694 | 1694 |
1695 // Scan heap for Script objects. | 1695 // Scan heap for Script objects. |
1696 int count = 0; | 1696 int count = 0; |
1697 HeapIterator iterator; | 1697 HeapIterator iterator; |
1698 while (iterator.has_next()) { | 1698 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1699 HeapObject* obj = iterator.next(); | |
1700 ASSERT(obj != NULL); | |
1701 if (obj->IsScript() && Script::cast(obj)->HasValidSource()) { | 1699 if (obj->IsScript() && Script::cast(obj)->HasValidSource()) { |
1702 script_cache_->Add(Handle<Script>(Script::cast(obj))); | 1700 script_cache_->Add(Handle<Script>(Script::cast(obj))); |
1703 count++; | 1701 count++; |
1704 } | 1702 } |
1705 } | 1703 } |
1706 } | 1704 } |
1707 | 1705 |
1708 | 1706 |
1709 void Debug::DestroyScriptCache() { | 1707 void Debug::DestroyScriptCache() { |
1710 // Get rid of the script cache if it was created. | 1708 // Get rid of the script cache if it was created. |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2807 { | 2805 { |
2808 Locker locker; | 2806 Locker locker; |
2809 Debugger::CallMessageDispatchHandler(); | 2807 Debugger::CallMessageDispatchHandler(); |
2810 } | 2808 } |
2811 } | 2809 } |
2812 } | 2810 } |
2813 | 2811 |
2814 #endif // ENABLE_DEBUGGER_SUPPORT | 2812 #endif // ENABLE_DEBUGGER_SUPPORT |
2815 | 2813 |
2816 } } // namespace v8::internal | 2814 } } // namespace v8::internal |
OLD | NEW |