Revision: 17141
Author:   [email protected]
Date:     Thu Oct 10 13:14:37 2013 UTC
Log: Enable weak embedded objects in optimized code with a fix for heap verifier.

BUG=v8:2073
[email protected]

Review URL: https://chromiumcodereview.appspot.com/25702008
http://code.google.com/p/v8/source/detail?r=17141

Modified:
 /branches/bleeding_edge/src/flag-definitions.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Fri Oct 4 07:50:36 2013 UTC +++ /branches/bleeding_edge/src/flag-definitions.h Thu Oct 10 13:14:37 2013 UTC
@@ -511,7 +511,7 @@
             "garbage collect maps from which no objects can be reached")
 DEFINE_bool(weak_embedded_maps_in_optimized_code, true,
             "make maps embedded in optimized code weak")
-DEFINE_bool(weak_embedded_objects_in_optimized_code, false,
+DEFINE_bool(weak_embedded_objects_in_optimized_code, true,
             "make objects embedded in optimized code weak")
 DEFINE_bool(flush_code, true,
             "flush code that we expect not to use again (during full gc)")
=======================================
--- /branches/bleeding_edge/src/heap.cc Fri Oct  4 07:25:24 2013 UTC
+++ /branches/bleeding_edge/src/heap.cc Thu Oct 10 13:14:37 2013 UTC
@@ -6886,6 +6886,9 @@
       WeakHashTable::cast(weak_object_to_code_table_)->Put(obj, dep);
   WeakHashTable* table;
   if (!maybe_obj->To(&table)) return maybe_obj;
+  if (ShouldZapGarbage() && weak_object_to_code_table_ != table) {
+    WeakHashTable::cast(weak_object_to_code_table_)->Zap(the_hole_value());
+  }
   set_weak_object_to_code_table(table);
ASSERT_EQ(dep, WeakHashTable::cast(weak_object_to_code_table_)->Lookup(obj));
   return weak_object_to_code_table_;
=======================================
--- /branches/bleeding_edge/src/objects.h       Fri Oct  4 08:17:11 2013 UTC
+++ /branches/bleeding_edge/src/objects.h       Thu Oct 10 13:14:37 2013 UTC
@@ -4000,6 +4000,15 @@
// Adds (or overwrites) the value associated with the given key. Mapping a
   // key to the hole value causes removal of the whole entry.
   MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value);
+
+  // This function is called when heap verification is turned on.
+  void Zap(Object* value) {
+    int capacity = Capacity();
+    for (int i = 0; i < capacity; i++) {
+      set(EntryToIndex(i), value);
+      set(EntryToValueIndex(i), value);
+    }
+  }

  private:
   friend class MarkCompactCollector;

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to