Treat links that organize weak objects weakly.

BUG=

Review URL: https://codereview.chromium.org/1158423002

Cr-Commit-Position: refs/heads/master@{#28693}
This commit is contained in:
hpayer 2015-05-29 01:06:19 -07:00 committed by Commit bot
parent b749a19570
commit 3e2fec75d2
6 changed files with 17 additions and 11 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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) {

View File

@ -332,7 +332,8 @@ void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map,
// We can ignore weak cells with cleared values because they will always
// contain smi zero.
if (weak_cell->next() == undefined && !weak_cell->cleared()) {
weak_cell->set_next(heap->encountered_weak_cells());
weak_cell->set_next(heap->encountered_weak_cells(),
UPDATE_WEAK_WRITE_BARRIER);
heap->set_encountered_weak_cells(weak_cell);
}
}

View File

@ -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(); }