Commit f9fbe4fc authored by ulan@chromium.org's avatar ulan@chromium.org

Enable weak embedded objects in optimized code with a fix for heap verifier.

BUG=v8:2073
R=mstarzinger@chromium.org

Review URL: https://chromiumcodereview.appspot.com/25702008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17141 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3228e953
...@@ -511,7 +511,7 @@ DEFINE_bool(collect_maps, true, ...@@ -511,7 +511,7 @@ DEFINE_bool(collect_maps, true,
"garbage collect maps from which no objects can be reached") "garbage collect maps from which no objects can be reached")
DEFINE_bool(weak_embedded_maps_in_optimized_code, true, DEFINE_bool(weak_embedded_maps_in_optimized_code, true,
"make maps embedded in optimized code weak") "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") "make objects embedded in optimized code weak")
DEFINE_bool(flush_code, true, DEFINE_bool(flush_code, true,
"flush code that we expect not to use again (during full gc)") "flush code that we expect not to use again (during full gc)")
......
...@@ -6886,6 +6886,9 @@ MaybeObject* Heap::AddWeakObjectToCodeDependency(Object* obj, ...@@ -6886,6 +6886,9 @@ MaybeObject* Heap::AddWeakObjectToCodeDependency(Object* obj,
WeakHashTable::cast(weak_object_to_code_table_)->Put(obj, dep); WeakHashTable::cast(weak_object_to_code_table_)->Put(obj, dep);
WeakHashTable* table; WeakHashTable* table;
if (!maybe_obj->To(&table)) return maybe_obj; 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); set_weak_object_to_code_table(table);
ASSERT_EQ(dep, WeakHashTable::cast(weak_object_to_code_table_)->Lookup(obj)); ASSERT_EQ(dep, WeakHashTable::cast(weak_object_to_code_table_)->Lookup(obj));
return weak_object_to_code_table_; return weak_object_to_code_table_;
......
...@@ -4001,6 +4001,15 @@ class WeakHashTable: public HashTable<WeakHashTableShape<2>, Object*> { ...@@ -4001,6 +4001,15 @@ class WeakHashTable: public HashTable<WeakHashTableShape<2>, Object*> {
// key to the hole value causes removal of the whole entry. // key to the hole value causes removal of the whole entry.
MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value); 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: private:
friend class MarkCompactCollector; friend class MarkCompactCollector;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment