Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: src/debug.cc

Issue 6639024: Get rid of distinction between below- and above-watermark in page allocation.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 Handle<JSObject>(Debug::debug_context()->global()), 1868 Handle<JSObject>(Debug::debug_context()->global()),
1869 0, NULL, &caught_exception); 1869 0, NULL, &caught_exception);
1870 } 1870 }
1871 1871
1872 1872
1873 void Debug::CreateScriptCache() { 1873 void Debug::CreateScriptCache() {
1874 HandleScope scope; 1874 HandleScope scope;
1875 1875
1876 // Perform two GCs to get rid of all unreferenced scripts. The first GC gets 1876 // Perform two GCs to get rid of all unreferenced scripts. The first GC gets
1877 // rid of all the cached script wrappers and the second gets rid of the 1877 // rid of all the cached script wrappers and the second gets rid of the
1878 // scripts which are no longer referenced. 1878 // scripts which are no longer referenced. The second also sweeps precisely,
1879 Heap::CollectAllGarbage(false); 1879 // which saves us doing yet another GC to make the heap iterable.
1880 Heap::CollectAllGarbage(false); 1880 Heap::CollectAllGarbage(Heap::kNoGCFlags);
1881 Heap::CollectAllGarbage(Heap::kMakeHeapIterableMask);
1881 1882
1882 ASSERT(script_cache_ == NULL); 1883 ASSERT(script_cache_ == NULL);
1883 script_cache_ = new ScriptCache(); 1884 script_cache_ = new ScriptCache();
1884 1885
1885 // Scan heap for Script objects. 1886 // Scan heap for Script objects.
1886 int count = 0; 1887 int count = 0;
1887 HeapIterator iterator; 1888 HeapIterator iterator;
1888 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1889 for (HeapObject* obj = iterator.Next(); obj != NULL; obj = iterator.Next()) {
1889 if (obj->IsScript() && Script::cast(obj)->HasValidSource()) { 1890 if (obj->IsScript() && Script::cast(obj)->HasValidSource()) {
1890 script_cache_->Add(Handle<Script>(Script::cast(obj))); 1891 script_cache_->Add(Handle<Script>(Script::cast(obj)));
1891 count++; 1892 count++;
1892 } 1893 }
1893 } 1894 }
1894 } 1895 }
1895 1896
1896 1897
1897 void Debug::DestroyScriptCache() { 1898 void Debug::DestroyScriptCache() {
1898 // Get rid of the script cache if it was created. 1899 // Get rid of the script cache if it was created.
(...skipping 19 matching lines...) Expand all
1918 } 1919 }
1919 1920
1920 // If the script cache is not active just return an empty array. 1921 // If the script cache is not active just return an empty array.
1921 ASSERT(script_cache_ != NULL); 1922 ASSERT(script_cache_ != NULL);
1922 if (script_cache_ == NULL) { 1923 if (script_cache_ == NULL) {
1923 Factory::NewFixedArray(0); 1924 Factory::NewFixedArray(0);
1924 } 1925 }
1925 1926
1926 // Perform GC to get unreferenced scripts evicted from the cache before 1927 // Perform GC to get unreferenced scripts evicted from the cache before
1927 // returning the content. 1928 // returning the content.
1928 Heap::CollectAllGarbage(false); 1929 Heap::CollectAllGarbage(Heap::kNoGCFlags);
1929 1930
1930 // Get the scripts from the cache. 1931 // Get the scripts from the cache.
1931 return script_cache_->GetScripts(); 1932 return script_cache_->GetScripts();
1932 } 1933 }
1933 1934
1934 1935
1935 void Debug::AfterGarbageCollection() { 1936 void Debug::AfterGarbageCollection() {
1936 // Generate events for collected scripts. 1937 // Generate events for collected scripts.
1937 if (script_cache_ != NULL) { 1938 if (script_cache_ != NULL) {
1938 script_cache_->ProcessCollectedScripts(); 1939 script_cache_->ProcessCollectedScripts();
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
3077 { 3078 {
3078 Locker locker; 3079 Locker locker;
3079 Debugger::CallMessageDispatchHandler(); 3080 Debugger::CallMessageDispatchHandler();
3080 } 3081 }
3081 } 3082 }
3082 } 3083 }
3083 3084
3084 #endif // ENABLE_DEBUGGER_SUPPORT 3085 #endif // ENABLE_DEBUGGER_SUPPORT
3085 3086
3086 } } // namespace v8::internal 3087 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/extensions/gc-extension.cc » ('j') | src/spaces-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698