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

Side by Side Diff: test/cctest/test-api.cc

Issue 7650010: Avoid some crashes when running without snapshots. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 4 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 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 9846 matching lines...) Expand 10 before | Expand all | Expand 10 after
9857 "})();"); 9857 "})();");
9858 CHECK_EQ(42, script->Run()->Int32Value()); 9858 CHECK_EQ(42, script->Run()->Int32Value());
9859 } 9859 }
9860 } 9860 }
9861 9861
9862 9862
9863 static int GetGlobalObjectsCount() { 9863 static int GetGlobalObjectsCount() {
9864 i::Isolate::Current()->heap()->EnsureHeapIsIterable(); 9864 i::Isolate::Current()->heap()->EnsureHeapIsIterable();
9865 int count = 0; 9865 int count = 0;
9866 i::HeapIterator it; 9866 i::HeapIterator it;
9867 for (i::HeapObject* object = it.Next(); object != NULL; object = it.Next()) 9867 for (i::HeapObject* object = it.next(); object != NULL; object = it.next())
9868 if (object->IsJSGlobalObject()) count++; 9868 if (object->IsJSGlobalObject()) count++;
9869 return count; 9869 return count;
9870 } 9870 }
9871 9871
9872 9872
9873 static void CheckSurvivingGlobalObjectsCount(int expected) { 9873 static void CheckSurvivingGlobalObjectsCount(int expected) {
9874 // We need to collect all garbage twice to be sure that everything 9874 // We need to collect all garbage twice to be sure that everything
9875 // has been collected. This is because inline caches are cleared in 9875 // has been collected. This is because inline caches are cleared in
9876 // the first garbage collection but some of the maps have already 9876 // the first garbage collection but some of the maps have already
9877 // been marked at that point. Therefore some of the maps are not 9877 // been marked at that point. Therefore some of the maps are not
(...skipping 4954 matching lines...) Expand 10 before | Expand all | Expand 10 after
14832 } 14832 }
14833 14833
14834 i::Isolate::Current()->heap()->CollectAllGarbage(true); 14834 i::Isolate::Current()->heap()->CollectAllGarbage(true);
14835 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); 14835 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache();
14836 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { 14836 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) {
14837 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); 14837 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache);
14838 CHECK_GT(elements, map_cache->NumberOfElements()); 14838 CHECK_GT(elements, map_cache->NumberOfElements());
14839 } 14839 }
14840 } 14840 }
14841 } 14841 }
OLDNEW
« src/runtime.cc ('K') | « src/spaces.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698