| Index: src/heap.cc
|
| diff --git a/src/heap.cc b/src/heap.cc
|
| index eae7241cf1782dc59d175d36c0b35830725771b6..2e67e23741af7c9eab6130ba32a7b75cb20b7eb9 100644
|
| --- a/src/heap.cc
|
| +++ b/src/heap.cc
|
| @@ -1775,6 +1775,18 @@ static Object* VisitWeakList(Heap* heap,
|
| }
|
|
|
|
|
| +template <class T>
|
| +static void ClearWeakList(Heap* heap,
|
| + Object* list) {
|
| + Object* undefined = heap->undefined_value();
|
| + while (list != undefined) {
|
| + T* candidate = reinterpret_cast<T*>(list);
|
| + list = WeakListVisitor<T>::WeakNext(candidate);
|
| + WeakListVisitor<T>::SetWeakNext(candidate, undefined);
|
| + }
|
| +}
|
| +
|
| +
|
| template<>
|
| struct WeakListVisitor<JSFunction> {
|
| static void SetWeakNext(JSFunction* function, Object* next) {
|
| @@ -1868,7 +1880,11 @@ struct WeakListVisitor<Context> {
|
| }
|
| }
|
|
|
| - static void VisitPhantomObject(Heap*, Context*) {
|
| + static void VisitPhantomObject(Heap* heap, Context* context) {
|
| + ClearWeakList<JSFunction>(heap,
|
| + context->get(Context::OPTIMIZED_FUNCTIONS_LIST));
|
| + ClearWeakList<Code>(heap, context->get(Context::OPTIMIZED_CODE_LIST));
|
| + ClearWeakList<Code>(heap, context->get(Context::DEOPTIMIZED_CODE_LIST));
|
| }
|
|
|
| static int WeakNextOffset() {
|
| @@ -4126,6 +4142,7 @@ MaybeObject* Heap::CreateCode(const CodeDesc& desc,
|
| code->set_is_crankshafted(crankshafted);
|
| code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER);
|
| code->set_raw_type_feedback_info(undefined_value());
|
| + code->set_next_code_link(undefined_value());
|
| code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER);
|
| code->set_gc_metadata(Smi::FromInt(0));
|
| code->set_ic_age(global_ic_age_);
|
|
|