Reviewers: Vitaly,

Message:
Vitaly,

may you have a look?

Description:
Relax verification of JSFunction result caches.

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.

Please review this at http://codereview.chromium.org/6309004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/objects-debug.cc


Index: src/objects-debug.cc
diff --git a/src/objects-debug.cc b/src/objects-debug.cc
index a3552c719ede7a4213539eac55ded174756b1423..7d50bfb6f6ded8baee3b513d2f242314f4d10be3 100644
--- a/src/objects-debug.cc
+++ b/src/objects-debug.cc
@@ -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());
     }
   }
 }


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to