Reviewers: ulan,
Description:
Treat links that organize weak objects weakly.
BUG=
Please review this at https://codereview.chromium.org/1158423002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+15, -10 lines):
M src/contexts.cc
M src/deoptimizer.cc
M src/factory.cc
M src/heap/mark-compact.h
M src/heap/objects-visiting.cc
Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index
b7617f746761e7edbeadde1c938febda64f71ed4..76f5225ce225ca174ae5a9a0c19b87db76b1cf1a
100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -394,7 +394,8 @@ void Context::AddOptimizedFunction(JSFunction*
function) {
DCHECK(function->next_function_link()->IsUndefined());
- function->set_next_function_link(get(OPTIMIZED_FUNCTIONS_LIST));
+ function->set_next_function_link(get(OPTIMIZED_FUNCTIONS_LIST),
+ UPDATE_WEAK_WRITE_BARRIER);
set(OPTIMIZED_FUNCTIONS_LIST, function, UPDATE_WEAK_WRITE_BARRIER);
}
@@ -412,9 +413,11 @@ void Context::RemoveOptimizedFunction(JSFunction*
function) {
set(OPTIMIZED_FUNCTIONS_LIST,
element_function->next_function_link(),
UPDATE_WEAK_WRITE_BARRIER);
} else {
-
prev->set_next_function_link(element_function->next_function_link());
+
prev->set_next_function_link(element_function->next_function_link(),
+ UPDATE_WEAK_WRITE_BARRIER);
}
-
element_function->set_next_function_link(GetHeap()->undefined_value());
+
element_function->set_next_function_link(GetHeap()->undefined_value(),
+ UPDATE_WEAK_WRITE_BARRIER);
return;
}
prev = element_function;
Index: src/deoptimizer.cc
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
index
2a03c74c416e6aaedfdfee5bce9ff92d21d892b5..4440d9fab7eb5d017d398d21b00421443dff4d24
100644
--- a/src/deoptimizer.cc
+++ b/src/deoptimizer.cc
@@ -260,7 +260,7 @@ void Deoptimizer::VisitAllOptimizedFunctionsForContext(
// changed the code to which it refers to no longer be optimized
code.
// Remove the function from this list.
if (prev != NULL) {
- prev->set_next_function_link(next);
+ prev->set_next_function_link(next, UPDATE_WEAK_WRITE_BARRIER);
} else {
context->SetOptimizedFunctionsListHead(next);
}
@@ -268,7 +268,8 @@ void Deoptimizer::VisitAllOptimizedFunctionsForContext(
CHECK_EQ(function->next_function_link(), next);
// Set the next function link to undefined to indicate it is no
longer
// in the optimized functions list.
-
function->set_next_function_link(context->GetHeap()->undefined_value());
+
function->set_next_function_link(context->GetHeap()->undefined_value(),
+ SKIP_WRITE_BARRIER);
} else {
// The visitor should not alter the link directly.
CHECK_EQ(function->next_function_link(), next);
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index
e5ee73b30f9c667f9f9bb8c7c4cca44698def134..f4b609a7f94fd882faacfe89847d8c495cf58456
100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1257,7 +1257,7 @@ void Factory::InitializeFunction(Handle<JSFunction>
function,
function->set_context(*context);
function->set_prototype_or_initial_map(*the_hole_value());
function->set_literals_or_bindings(*empty_fixed_array());
- function->set_next_function_link(*undefined_value());
+ function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER);
}
Index: src/heap/mark-compact.h
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h
index
05b0d0e048ce697d2cc1a0aad1c62e998237fa47..015ac31154498343064d55c9347c1a9bdb109a0f
100644
--- a/src/heap/mark-compact.h
+++ b/src/heap/mark-compact.h
@@ -516,7 +516,8 @@ class CodeFlusher {
static void SetNextCandidate(JSFunction* candidate,
JSFunction* next_candidate) {
- candidate->set_next_function_link(next_candidate);
+ candidate->set_next_function_link(next_candidate,
+ UPDATE_WEAK_WRITE_BARRIER);
}
static void ClearNextCandidate(JSFunction* candidate, Object* undefined)
{
Index: src/heap/objects-visiting.cc
diff --git a/src/heap/objects-visiting.cc b/src/heap/objects-visiting.cc
index
4adf2a5c85f1d66e65acedee31c804fb4462af3d..e3f7da280e5d0ba46fa6df8fe71a72972c119be8
100644
--- a/src/heap/objects-visiting.cc
+++ b/src/heap/objects-visiting.cc
@@ -253,7 +253,7 @@ static void ClearWeakList(Heap* heap, Object* list) {
template <>
struct WeakListVisitor<JSFunction> {
static void SetWeakNext(JSFunction* function, Object* next) {
- function->set_next_function_link(next);
+ function->set_next_function_link(next, UPDATE_WEAK_WRITE_BARRIER);
}
static Object* WeakNext(JSFunction* function) {
@@ -271,7 +271,7 @@ struct WeakListVisitor<JSFunction> {
template <>
struct WeakListVisitor<Code> {
static void SetWeakNext(Code* code, Object* next) {
- code->set_next_code_link(next);
+ code->set_next_code_link(next, UPDATE_WEAK_WRITE_BARRIER);
}
static Object* WeakNext(Code* code) { return code->next_code_link(); }
@@ -342,7 +342,7 @@ struct WeakListVisitor<Context> {
template <>
struct WeakListVisitor<AllocationSite> {
static void SetWeakNext(AllocationSite* obj, Object* next) {
- obj->set_weak_next(next);
+ obj->set_weak_next(next, UPDATE_WEAK_WRITE_BARRIER);
}
static Object* WeakNext(AllocationSite* obj) { return obj->weak_next(); }
--
--
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/d/optout.