2014-04-24 11:44:22 +00:00
|
|
|
// Copyright 2011 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2014-04-24 11:44:22 +00:00
|
|
|
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/v8.h"
|
2010-08-11 14:30:14 +00:00
|
|
|
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/ic-inl.h"
|
|
|
|
#include "src/objects-visiting.h"
|
2014-04-24 11:32:48 +00:00
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
|
|
|
|
StaticVisitorBase::VisitorId StaticVisitorBase::GetVisitorId(
|
|
|
|
int instance_type,
|
|
|
|
int instance_size) {
|
|
|
|
if (instance_type < FIRST_NONSTRING_TYPE) {
|
|
|
|
switch (instance_type & kStringRepresentationMask) {
|
|
|
|
case kSeqStringTag:
|
2012-11-08 12:14:29 +00:00
|
|
|
if ((instance_type & kStringEncodingMask) == kOneByteStringTag) {
|
2012-11-15 13:31:27 +00:00
|
|
|
return kVisitSeqOneByteString;
|
2010-08-11 14:30:14 +00:00
|
|
|
} else {
|
|
|
|
return kVisitSeqTwoByteString;
|
|
|
|
}
|
|
|
|
|
|
|
|
case kConsStringTag:
|
|
|
|
if (IsShortcutCandidate(instance_type)) {
|
|
|
|
return kVisitShortcutCandidate;
|
|
|
|
} else {
|
|
|
|
return kVisitConsString;
|
|
|
|
}
|
|
|
|
|
2011-08-26 13:03:30 +00:00
|
|
|
case kSlicedStringTag:
|
|
|
|
return kVisitSlicedString;
|
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
case kExternalStringTag:
|
|
|
|
return GetVisitorIdForSize(kVisitDataObject,
|
|
|
|
kVisitDataObjectGeneric,
|
2011-11-23 13:08:28 +00:00
|
|
|
instance_size);
|
2010-08-11 14:30:14 +00:00
|
|
|
}
|
|
|
|
UNREACHABLE();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (instance_type) {
|
|
|
|
case BYTE_ARRAY_TYPE:
|
|
|
|
return kVisitByteArray;
|
|
|
|
|
2011-09-19 18:36:47 +00:00
|
|
|
case FREE_SPACE_TYPE:
|
|
|
|
return kVisitFreeSpace;
|
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
case FIXED_ARRAY_TYPE:
|
|
|
|
return kVisitFixedArray;
|
|
|
|
|
2011-06-09 10:03:35 +00:00
|
|
|
case FIXED_DOUBLE_ARRAY_TYPE:
|
|
|
|
return kVisitFixedDoubleArray;
|
|
|
|
|
2013-10-14 13:35:06 +00:00
|
|
|
case CONSTANT_POOL_ARRAY_TYPE:
|
|
|
|
return kVisitConstantPoolArray;
|
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
case ODDBALL_TYPE:
|
|
|
|
return kVisitOddball;
|
|
|
|
|
|
|
|
case MAP_TYPE:
|
|
|
|
return kVisitMap;
|
|
|
|
|
|
|
|
case CODE_TYPE:
|
|
|
|
return kVisitCode;
|
|
|
|
|
2013-06-12 15:03:44 +00:00
|
|
|
case CELL_TYPE:
|
|
|
|
return kVisitCell;
|
|
|
|
|
|
|
|
case PROPERTY_CELL_TYPE:
|
2010-08-11 14:30:14 +00:00
|
|
|
return kVisitPropertyCell;
|
|
|
|
|
2011-10-25 14:14:56 +00:00
|
|
|
case JS_SET_TYPE:
|
|
|
|
return GetVisitorIdForSize(kVisitStruct,
|
|
|
|
kVisitStructGeneric,
|
|
|
|
JSSet::kSize);
|
|
|
|
|
|
|
|
case JS_MAP_TYPE:
|
|
|
|
return GetVisitorIdForSize(kVisitStruct,
|
|
|
|
kVisitStructGeneric,
|
|
|
|
JSMap::kSize);
|
|
|
|
|
2011-08-03 12:48:30 +00:00
|
|
|
case JS_WEAK_MAP_TYPE:
|
2013-07-22 08:32:24 +00:00
|
|
|
case JS_WEAK_SET_TYPE:
|
2014-05-28 08:35:16 +00:00
|
|
|
return kVisitJSWeakCollection;
|
2013-07-22 08:32:24 +00:00
|
|
|
|
2011-07-05 06:19:53 +00:00
|
|
|
case JS_REGEXP_TYPE:
|
|
|
|
return kVisitJSRegExp;
|
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
case SHARED_FUNCTION_INFO_TYPE:
|
|
|
|
return kVisitSharedFunctionInfo;
|
|
|
|
|
2011-05-13 10:58:25 +00:00
|
|
|
case JS_PROXY_TYPE:
|
2011-05-23 09:11:24 +00:00
|
|
|
return GetVisitorIdForSize(kVisitStruct,
|
|
|
|
kVisitStructGeneric,
|
2011-05-13 10:58:25 +00:00
|
|
|
JSProxy::kSize);
|
|
|
|
|
2011-09-13 11:42:57 +00:00
|
|
|
case JS_FUNCTION_PROXY_TYPE:
|
|
|
|
return GetVisitorIdForSize(kVisitStruct,
|
|
|
|
kVisitStructGeneric,
|
|
|
|
JSFunctionProxy::kSize);
|
|
|
|
|
2011-05-19 11:47:34 +00:00
|
|
|
case FOREIGN_TYPE:
|
2010-08-11 14:30:14 +00:00
|
|
|
return GetVisitorIdForSize(kVisitDataObject,
|
|
|
|
kVisitDataObjectGeneric,
|
2011-05-19 11:47:34 +00:00
|
|
|
Foreign::kSize);
|
2010-08-11 14:30:14 +00:00
|
|
|
|
2013-03-01 10:34:31 +00:00
|
|
|
case SYMBOL_TYPE:
|
2013-03-22 16:51:28 +00:00
|
|
|
return kVisitSymbol;
|
2013-03-01 10:34:31 +00:00
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
case FILLER_TYPE:
|
|
|
|
return kVisitDataObjectGeneric;
|
|
|
|
|
2013-06-07 10:52:11 +00:00
|
|
|
case JS_ARRAY_BUFFER_TYPE:
|
|
|
|
return kVisitJSArrayBuffer;
|
|
|
|
|
|
|
|
case JS_TYPED_ARRAY_TYPE:
|
|
|
|
return kVisitJSTypedArray;
|
|
|
|
|
2013-06-21 13:02:38 +00:00
|
|
|
case JS_DATA_VIEW_TYPE:
|
|
|
|
return kVisitJSDataView;
|
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
case JS_OBJECT_TYPE:
|
|
|
|
case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
|
2013-04-15 12:29:44 +00:00
|
|
|
case JS_GENERATOR_OBJECT_TYPE:
|
2012-04-16 14:43:27 +00:00
|
|
|
case JS_MODULE_TYPE:
|
2010-08-11 14:30:14 +00:00
|
|
|
case JS_VALUE_TYPE:
|
2012-03-09 11:11:55 +00:00
|
|
|
case JS_DATE_TYPE:
|
2010-08-11 14:30:14 +00:00
|
|
|
case JS_ARRAY_TYPE:
|
|
|
|
case JS_GLOBAL_PROXY_TYPE:
|
|
|
|
case JS_GLOBAL_OBJECT_TYPE:
|
|
|
|
case JS_BUILTINS_OBJECT_TYPE:
|
2011-02-02 13:31:52 +00:00
|
|
|
case JS_MESSAGE_OBJECT_TYPE:
|
2014-04-17 17:45:32 +00:00
|
|
|
case JS_SET_ITERATOR_TYPE:
|
|
|
|
case JS_MAP_ITERATOR_TYPE:
|
2010-08-11 14:30:14 +00:00
|
|
|
return GetVisitorIdForSize(kVisitJSObject,
|
|
|
|
kVisitJSObjectGeneric,
|
|
|
|
instance_size);
|
|
|
|
|
2010-08-17 11:44:01 +00:00
|
|
|
case JS_FUNCTION_TYPE:
|
|
|
|
return kVisitJSFunction;
|
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
case HEAP_NUMBER_TYPE:
|
2014-07-01 15:02:31 +00:00
|
|
|
case MUTABLE_HEAP_NUMBER_TYPE:
|
2014-01-24 16:01:15 +00:00
|
|
|
#define EXTERNAL_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
|
|
|
case EXTERNAL_##TYPE##_ARRAY_TYPE:
|
|
|
|
|
|
|
|
TYPED_ARRAYS(EXTERNAL_ARRAY_CASE)
|
2010-08-11 14:30:14 +00:00
|
|
|
return GetVisitorIdForSize(kVisitDataObject,
|
|
|
|
kVisitDataObjectGeneric,
|
|
|
|
instance_size);
|
2014-01-24 16:01:15 +00:00
|
|
|
#undef EXTERNAL_ARRAY_CASE
|
2010-08-11 14:30:14 +00:00
|
|
|
|
2014-01-16 17:08:45 +00:00
|
|
|
case FIXED_UINT8_ARRAY_TYPE:
|
|
|
|
case FIXED_INT8_ARRAY_TYPE:
|
|
|
|
case FIXED_UINT16_ARRAY_TYPE:
|
|
|
|
case FIXED_INT16_ARRAY_TYPE:
|
|
|
|
case FIXED_UINT32_ARRAY_TYPE:
|
|
|
|
case FIXED_INT32_ARRAY_TYPE:
|
|
|
|
case FIXED_FLOAT32_ARRAY_TYPE:
|
|
|
|
case FIXED_UINT8_CLAMPED_ARRAY_TYPE:
|
|
|
|
return kVisitFixedTypedArray;
|
|
|
|
|
|
|
|
case FIXED_FLOAT64_ARRAY_TYPE:
|
|
|
|
return kVisitFixedFloat64Array;
|
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
#define MAKE_STRUCT_CASE(NAME, Name, name) \
|
|
|
|
case NAME##_TYPE:
|
|
|
|
STRUCT_LIST(MAKE_STRUCT_CASE)
|
|
|
|
#undef MAKE_STRUCT_CASE
|
2013-07-17 11:50:24 +00:00
|
|
|
if (instance_type == ALLOCATION_SITE_TYPE) {
|
|
|
|
return kVisitAllocationSite;
|
|
|
|
}
|
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
return GetVisitorIdForSize(kVisitStruct,
|
|
|
|
kVisitStructGeneric,
|
|
|
|
instance_size);
|
|
|
|
|
|
|
|
default:
|
|
|
|
UNREACHABLE();
|
|
|
|
return kVisitorIdCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-11 10:36:09 +00:00
|
|
|
|
2014-05-13 06:22:49 +00:00
|
|
|
// We don't record weak slots during marking or scavenges. Instead we do it
|
|
|
|
// once when we complete mark-compact cycle. Note that write barrier has no
|
|
|
|
// effect if we are already in the middle of compacting mark-sweep cycle and we
|
|
|
|
// have to record slots manually.
|
|
|
|
static bool MustRecordSlots(Heap* heap) {
|
|
|
|
return heap->gc_state() == Heap::MARK_COMPACT &&
|
|
|
|
heap->mark_compact_collector()->is_compacting();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-11 10:36:09 +00:00
|
|
|
template <class T>
|
|
|
|
struct WeakListVisitor;
|
|
|
|
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
Object* VisitWeakList(Heap* heap,
|
|
|
|
Object* list,
|
2014-05-13 06:22:49 +00:00
|
|
|
WeakObjectRetainer* retainer) {
|
2014-04-11 10:36:09 +00:00
|
|
|
Object* undefined = heap->undefined_value();
|
|
|
|
Object* head = undefined;
|
|
|
|
T* tail = NULL;
|
|
|
|
MarkCompactCollector* collector = heap->mark_compact_collector();
|
2014-05-13 06:22:49 +00:00
|
|
|
bool record_slots = MustRecordSlots(heap);
|
2014-04-11 10:36:09 +00:00
|
|
|
while (list != undefined) {
|
|
|
|
// Check whether to keep the candidate in the list.
|
|
|
|
T* candidate = reinterpret_cast<T*>(list);
|
|
|
|
Object* retained = retainer->RetainAs(list);
|
|
|
|
if (retained != NULL) {
|
|
|
|
if (head == undefined) {
|
|
|
|
// First element in the list.
|
|
|
|
head = retained;
|
|
|
|
} else {
|
|
|
|
// Subsequent elements in the list.
|
|
|
|
ASSERT(tail != NULL);
|
|
|
|
WeakListVisitor<T>::SetWeakNext(tail, retained);
|
|
|
|
if (record_slots) {
|
|
|
|
Object** next_slot =
|
|
|
|
HeapObject::RawField(tail, WeakListVisitor<T>::WeakNextOffset());
|
|
|
|
collector->RecordSlot(next_slot, next_slot, retained);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Retained object is new tail.
|
|
|
|
ASSERT(!retained->IsUndefined());
|
|
|
|
candidate = reinterpret_cast<T*>(retained);
|
|
|
|
tail = candidate;
|
|
|
|
|
|
|
|
|
|
|
|
// tail is a live object, visit it.
|
2014-05-13 06:22:49 +00:00
|
|
|
WeakListVisitor<T>::VisitLiveObject(heap, tail, retainer);
|
2014-04-11 10:36:09 +00:00
|
|
|
} else {
|
|
|
|
WeakListVisitor<T>::VisitPhantomObject(heap, candidate);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Move to next element in the list.
|
|
|
|
list = WeakListVisitor<T>::WeakNext(candidate);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Terminate the list if there is one or more elements.
|
|
|
|
if (tail != NULL) {
|
|
|
|
WeakListVisitor<T>::SetWeakNext(tail, undefined);
|
|
|
|
}
|
|
|
|
return head;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
function->set_next_function_link(next);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Object* WeakNext(JSFunction* function) {
|
|
|
|
return function->next_function_link();
|
|
|
|
}
|
|
|
|
|
|
|
|
static int WeakNextOffset() {
|
|
|
|
return JSFunction::kNextFunctionLinkOffset;
|
|
|
|
}
|
|
|
|
|
2014-05-13 06:22:49 +00:00
|
|
|
static void VisitLiveObject(Heap*, JSFunction*, WeakObjectRetainer*) {}
|
2014-04-11 10:36:09 +00:00
|
|
|
|
2014-05-13 06:22:49 +00:00
|
|
|
static void VisitPhantomObject(Heap*, JSFunction*) {}
|
2014-04-11 10:36:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct WeakListVisitor<Code> {
|
|
|
|
static void SetWeakNext(Code* code, Object* next) {
|
|
|
|
code->set_next_code_link(next);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Object* WeakNext(Code* code) {
|
|
|
|
return code->next_code_link();
|
|
|
|
}
|
|
|
|
|
|
|
|
static int WeakNextOffset() {
|
|
|
|
return Code::kNextCodeLinkOffset;
|
|
|
|
}
|
|
|
|
|
2014-05-13 06:22:49 +00:00
|
|
|
static void VisitLiveObject(Heap*, Code*, WeakObjectRetainer*) {}
|
2014-04-11 10:36:09 +00:00
|
|
|
|
2014-05-13 06:22:49 +00:00
|
|
|
static void VisitPhantomObject(Heap*, Code*) {}
|
2014-04-11 10:36:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct WeakListVisitor<Context> {
|
|
|
|
static void SetWeakNext(Context* context, Object* next) {
|
|
|
|
context->set(Context::NEXT_CONTEXT_LINK,
|
|
|
|
next,
|
|
|
|
UPDATE_WRITE_BARRIER);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Object* WeakNext(Context* context) {
|
|
|
|
return context->get(Context::NEXT_CONTEXT_LINK);
|
|
|
|
}
|
|
|
|
|
2014-05-13 06:22:49 +00:00
|
|
|
static int WeakNextOffset() {
|
|
|
|
return FixedArray::SizeFor(Context::NEXT_CONTEXT_LINK);
|
|
|
|
}
|
|
|
|
|
2014-04-11 10:36:09 +00:00
|
|
|
static void VisitLiveObject(Heap* heap,
|
|
|
|
Context* context,
|
2014-05-13 06:22:49 +00:00
|
|
|
WeakObjectRetainer* retainer) {
|
2014-04-11 10:36:09 +00:00
|
|
|
// Process the three weak lists linked off the context.
|
2014-05-13 06:22:49 +00:00
|
|
|
DoWeakList<JSFunction>(heap, context, retainer,
|
2014-04-11 10:36:09 +00:00
|
|
|
Context::OPTIMIZED_FUNCTIONS_LIST);
|
2014-05-13 06:22:49 +00:00
|
|
|
DoWeakList<Code>(heap, context, retainer, Context::OPTIMIZED_CODE_LIST);
|
|
|
|
DoWeakList<Code>(heap, context, retainer, Context::DEOPTIMIZED_CODE_LIST);
|
2014-04-11 10:36:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
static void DoWeakList(Heap* heap,
|
|
|
|
Context* context,
|
|
|
|
WeakObjectRetainer* retainer,
|
|
|
|
int index) {
|
|
|
|
// Visit the weak list, removing dead intermediate elements.
|
2014-05-13 06:22:49 +00:00
|
|
|
Object* list_head = VisitWeakList<T>(heap, context->get(index), retainer);
|
2014-04-11 10:36:09 +00:00
|
|
|
|
|
|
|
// Update the list head.
|
|
|
|
context->set(index, list_head, UPDATE_WRITE_BARRIER);
|
|
|
|
|
2014-05-13 06:22:49 +00:00
|
|
|
if (MustRecordSlots(heap)) {
|
2014-04-11 10:36:09 +00:00
|
|
|
// Record the updated slot if necessary.
|
|
|
|
Object** head_slot = HeapObject::RawField(
|
|
|
|
context, FixedArray::SizeFor(index));
|
|
|
|
heap->mark_compact_collector()->RecordSlot(
|
|
|
|
head_slot, head_slot, list_head);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct WeakListVisitor<JSArrayBufferView> {
|
|
|
|
static void SetWeakNext(JSArrayBufferView* obj, Object* next) {
|
|
|
|
obj->set_weak_next(next);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Object* WeakNext(JSArrayBufferView* obj) {
|
|
|
|
return obj->weak_next();
|
|
|
|
}
|
|
|
|
|
|
|
|
static int WeakNextOffset() {
|
|
|
|
return JSArrayBufferView::kWeakNextOffset;
|
|
|
|
}
|
2014-05-13 06:22:49 +00:00
|
|
|
|
|
|
|
static void VisitLiveObject(Heap*, JSArrayBufferView*, WeakObjectRetainer*) {}
|
|
|
|
|
|
|
|
static void VisitPhantomObject(Heap*, JSArrayBufferView*) {}
|
2014-04-11 10:36:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct WeakListVisitor<JSArrayBuffer> {
|
|
|
|
static void SetWeakNext(JSArrayBuffer* obj, Object* next) {
|
|
|
|
obj->set_weak_next(next);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Object* WeakNext(JSArrayBuffer* obj) {
|
|
|
|
return obj->weak_next();
|
|
|
|
}
|
|
|
|
|
2014-05-13 06:22:49 +00:00
|
|
|
static int WeakNextOffset() {
|
|
|
|
return JSArrayBuffer::kWeakNextOffset;
|
|
|
|
}
|
|
|
|
|
2014-04-11 10:36:09 +00:00
|
|
|
static void VisitLiveObject(Heap* heap,
|
|
|
|
JSArrayBuffer* array_buffer,
|
2014-05-13 06:22:49 +00:00
|
|
|
WeakObjectRetainer* retainer) {
|
2014-04-11 10:36:09 +00:00
|
|
|
Object* typed_array_obj =
|
|
|
|
VisitWeakList<JSArrayBufferView>(
|
|
|
|
heap,
|
|
|
|
array_buffer->weak_first_view(),
|
2014-05-13 06:22:49 +00:00
|
|
|
retainer);
|
2014-04-11 10:36:09 +00:00
|
|
|
array_buffer->set_weak_first_view(typed_array_obj);
|
2014-05-13 06:22:49 +00:00
|
|
|
if (typed_array_obj != heap->undefined_value() && MustRecordSlots(heap)) {
|
2014-04-11 10:36:09 +00:00
|
|
|
Object** slot = HeapObject::RawField(
|
|
|
|
array_buffer, JSArrayBuffer::kWeakFirstViewOffset);
|
|
|
|
heap->mark_compact_collector()->RecordSlot(slot, slot, typed_array_obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void VisitPhantomObject(Heap* heap, JSArrayBuffer* phantom) {
|
|
|
|
Runtime::FreeArrayBuffer(heap->isolate(), phantom);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct WeakListVisitor<AllocationSite> {
|
|
|
|
static void SetWeakNext(AllocationSite* obj, Object* next) {
|
|
|
|
obj->set_weak_next(next);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Object* WeakNext(AllocationSite* obj) {
|
|
|
|
return obj->weak_next();
|
|
|
|
}
|
|
|
|
|
|
|
|
static int WeakNextOffset() {
|
|
|
|
return AllocationSite::kWeakNextOffset;
|
|
|
|
}
|
2014-05-13 06:22:49 +00:00
|
|
|
|
|
|
|
static void VisitLiveObject(Heap*, AllocationSite*, WeakObjectRetainer*) {}
|
|
|
|
|
|
|
|
static void VisitPhantomObject(Heap*, AllocationSite*) {}
|
2014-04-11 10:36:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template Object* VisitWeakList<Code>(
|
2014-05-13 06:22:49 +00:00
|
|
|
Heap* heap, Object* list, WeakObjectRetainer* retainer);
|
2014-04-11 10:36:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
template Object* VisitWeakList<JSFunction>(
|
2014-05-13 06:22:49 +00:00
|
|
|
Heap* heap, Object* list, WeakObjectRetainer* retainer);
|
2014-04-11 10:36:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
template Object* VisitWeakList<Context>(
|
2014-05-13 06:22:49 +00:00
|
|
|
Heap* heap, Object* list, WeakObjectRetainer* retainer);
|
2014-04-11 10:36:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
template Object* VisitWeakList<JSArrayBuffer>(
|
2014-05-13 06:22:49 +00:00
|
|
|
Heap* heap, Object* list, WeakObjectRetainer* retainer);
|
2014-04-11 10:36:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
template Object* VisitWeakList<AllocationSite>(
|
2014-05-13 06:22:49 +00:00
|
|
|
Heap* heap, Object* list, WeakObjectRetainer* retainer);
|
2014-04-11 10:36:09 +00:00
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
} } // namespace v8::internal
|