Relax verification of JSFunction result caches.
authorantonm@chromium.org <antonm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 17 Jan 2011 07:03:19 +0000 (07:03 +0000)
committerantonm@chromium.org <antonm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 17 Jan 2011 07:03:19 +0000 (07:03 +0000)
As invocation of a functin may trigger GC and hence clear all the caches,
it's hard to ensure previous invariants.

Current invariant is both a key and a value should be the holes or not holes.

Review URL: http://codereview.chromium.org/6309004

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

src/objects-debug.cc

index a3552c7..7d50bfb 100644 (file)
@@ -674,13 +674,12 @@ void JSFunctionResultCache::JSFunctionResultCacheVerify() {
   ASSERT_EQ(0, finger % kEntrySize);
 
   if (FLAG_enable_slow_asserts) {
-    for (int i = kEntriesIndex; i < size; i++) {
-      ASSERT(!get(i)->IsTheHole());
-      get(i)->Verify();
-    }
-    for (int i = size; i < length(); i++) {
-      ASSERT(get(i)->IsTheHole());
+    STATIC_ASSERT(2 == kEntrySize);
+    for (int i = kEntriesIndex; i < length(); i += kEntrySize) {
       get(i)->Verify();
+      get(i + 1)->Verify();
+      // Key and value must be either both the holes, or not.
+      ASSERT(get(i)->IsTheHole() == get(i + 1)->IsTheHole());
     }
   }
 }