Do not call memset() to initialize StubCache.
authorulan@chromium.org <ulan@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 28 Feb 2012 18:26:04 +0000 (18:26 +0000)
committerulan@chromium.org <ulan@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 28 Feb 2012 18:26:04 +0000 (18:26 +0000)
Review URL: https://chromiumcodereview.appspot.com/9464054
Patch from Iliyan Malchev <malchev@google.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10861 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/isolate.cc
src/stub-cache.cc
src/stub-cache.h

index 128136faa0b83d47ba0ed90fa972cf04282e1d2f..93742bd7cde1e77e5ff83b13d836b72b7f645a6d 100644 (file)
@@ -1836,13 +1836,12 @@ bool Isolate::Init(Deserializer* des) {
 #ifdef ENABLE_DEBUGGER_SUPPORT
   debug_->SetUp(create_heap_objects);
 #endif
-  stub_cache_->Initialize(create_heap_objects);
 
   // If we are deserializing, read the state into the now-empty heap.
   if (des != NULL) {
     des->Deserialize();
-    stub_cache_->Initialize(true);
   }
+  stub_cache_->Initialize();
 
   // Finish initialization of ThreadLocal after deserialization is done.
   clear_pending_exception();
index 4bbfe176875852072578e068ef96663b56a4ce83..650422c14cf47ab2e1a80cc394ceed1c37cb33ac 100644 (file)
@@ -45,26 +45,13 @@ namespace internal {
 
 StubCache::StubCache(Isolate* isolate) : isolate_(isolate) {
   ASSERT(isolate == Isolate::Current());
-  memset(primary_, 0, sizeof(primary_[0]) * StubCache::kPrimaryTableSize);
-  memset(secondary_, 0, sizeof(secondary_[0]) * StubCache::kSecondaryTableSize);
 }
 
 
-void StubCache::Initialize(bool create_heap_objects) {
+void StubCache::Initialize() {
   ASSERT(IsPowerOf2(kPrimaryTableSize));
   ASSERT(IsPowerOf2(kSecondaryTableSize));
-  if (create_heap_objects) {
-    HandleScope scope;
-    Code* empty = isolate_->builtins()->builtin(Builtins::kIllegal);
-    for (int i = 0; i < kPrimaryTableSize; i++) {
-      primary_[i].key = heap()->empty_string();
-      primary_[i].value = empty;
-    }
-    for (int j = 0; j < kSecondaryTableSize; j++) {
-      secondary_[j].key = heap()->empty_string();
-      secondary_[j].value = empty;
-    }
-  }
+  Clear();
 }
 
 
index fdd8a12da6bd87a2100dbe02a344f0932730cc34..5522bb242a6bdb67a844ef13e1e7f27b87557806 100644 (file)
@@ -71,7 +71,7 @@ class StubCache {
     Code* value;
   };
 
-  void Initialize(bool create_heap_objects);
+  void Initialize();
 
 
   // Computes the right stub matching. Inserts the result in the