28 #ifndef V8_OBJECTS_VISITING_INL_H_
29 #define V8_OBJECTS_VISITING_INL_H_
35 template<
typename StaticVisitor>
37 table_.Register(kVisitShortcutCandidate,
42 table_.Register(kVisitConsString,
47 table_.Register(kVisitSlicedString,
52 table_.Register(kVisitFixedArray,
57 table_.Register(kVisitFixedDoubleArray, &VisitFixedDoubleArray);
59 table_.Register(kVisitNativeContext,
64 table_.Register(kVisitByteArray, &VisitByteArray);
66 table_.Register(kVisitSharedFunctionInfo,
71 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString);
73 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString);
75 table_.Register(kVisitJSFunction, &VisitJSFunction);
77 table_.Register(kVisitFreeSpace, &VisitFreeSpace);
79 table_.Register(kVisitJSWeakMap, &JSObjectVisitor::Visit);
81 table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit);
83 table_.template RegisterSpecializations<DataObjectVisitor,
85 kVisitDataObjectGeneric>();
89 kVisitJSObjectGeneric>();
92 kVisitStructGeneric>();
96 template<
typename StaticVisitor>
98 table_.Register(kVisitShortcutCandidate,
103 table_.Register(kVisitConsString,
108 table_.Register(kVisitSlicedString,
113 table_.Register(kVisitFixedArray,
118 table_.Register(kVisitFixedDoubleArray, &DataObjectVisitor::Visit);
120 table_.Register(kVisitNativeContext, &VisitNativeContext);
122 table_.Register(kVisitByteArray, &DataObjectVisitor::Visit);
124 table_.Register(kVisitFreeSpace, &DataObjectVisitor::Visit);
126 table_.Register(kVisitSeqAsciiString, &DataObjectVisitor::Visit);
128 table_.Register(kVisitSeqTwoByteString, &DataObjectVisitor::Visit);
130 table_.Register(kVisitJSWeakMap, &StaticVisitor::VisitJSWeakMap);
132 table_.Register(kVisitOddball,
137 table_.Register(kVisitMap, &VisitMap);
139 table_.Register(kVisitCode, &VisitCode);
141 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo);
143 table_.Register(kVisitJSFunction, &VisitJSFunction);
147 table_.Register(kVisitPropertyCell,
154 kVisitDataObjectGeneric>();
158 kVisitJSObjectGeneric>();
162 kVisitStructGeneric>();
166 template<
typename StaticVisitor>
171 StaticVisitor::MarkObject(heap, code);
175 template<
typename StaticVisitor>
177 Heap* heap, RelocInfo* rinfo) {
178 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT);
179 ASSERT(!rinfo->target_object()->IsConsString());
182 StaticVisitor::MarkObject(heap,
object);
186 template<
typename StaticVisitor>
188 Heap* heap, RelocInfo* rinfo) {
189 ASSERT(rinfo->rmode() == RelocInfo::GLOBAL_PROPERTY_CELL);
191 StaticVisitor::MarkObject(heap, cell);
195 template<
typename StaticVisitor>
197 Heap* heap, RelocInfo* rinfo) {
198 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) &&
199 rinfo->IsPatchedReturnSequence()) ||
200 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) &&
201 rinfo->IsPatchedDebugBreakSlotSequence()));
204 StaticVisitor::MarkObject(heap, target);
208 template<
typename StaticVisitor>
210 Heap* heap, RelocInfo* rinfo) {
211 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode()));
223 StaticVisitor::MarkObject(heap, target);
227 template<
typename StaticVisitor>
232 void>::Visit(map,
object);
240 collector->RecordSlot(slot, slot, *slot);
245 template<
typename StaticVisitor>
252 if (FLAG_cleanup_code_caches_at_gc) {
260 if (FLAG_collect_maps &&
262 MarkMapContents(heap, map_object);
264 StaticVisitor::VisitPointers(heap,
271 template<
typename StaticVisitor>
276 if (FLAG_cleanup_code_caches_at_gc) {
283 template<
typename StaticVisitor>
293 if (IsFlushable(heap, shared)) {
302 VisitSharedFunctionInfoWeakCode(heap,
object);
306 VisitSharedFunctionInfoStrongCode(heap,
object);
310 template<
typename StaticVisitor>
317 if (IsFlushable(heap,
function)) {
329 if (StaticVisitor::MarkObjectWithoutPush(heap, shared)) {
330 StaticVisitor::MarkObject(heap, shared->
map());
331 VisitSharedFunctionInfoWeakCode(heap, shared);
334 VisitJSFunctionWeakCode(heap,
object);
338 StaticVisitor::MarkObject(heap, function->shared()->code());
339 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) {
340 MarkInlinedFunctionsCode(heap, function->code());
344 VisitJSFunctionStrongCode(heap,
object);
348 template<
typename StaticVisitor>
351 int last_property_offset =
353 StaticVisitor::VisitPointers(map->
GetHeap(),
359 template<
typename StaticVisitor>
372 if (transitions->IsTransitionArray()) {
373 MarkTransitionArray(heap, transitions);
376 ASSERT(transitions->IsMap() || transitions->IsUndefined());
382 StaticVisitor::VisitPointers(heap,
388 template<
typename StaticVisitor>
391 if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions))
return;
403 StaticVisitor::MarkObjectWithoutPush(heap, obj);
407 StaticVisitor::VisitPointer(heap, transitions->
GetKeySlot(i));
412 template<
typename StaticVisitor>
421 for (
int i = 0, count = data->InlinedFunctionCount()->value();
425 StaticVisitor::MarkObject(heap, inlined->shared()->
code());
430 inline static bool IsValidNonBuiltinContext(
Object* context) {
431 return context->IsContext() &&
436 inline static bool HasSourceCode(Heap* heap, SharedFunctionInfo* info) {
437 Object* undefined = heap->undefined_value();
438 return (info->script() != undefined) &&
439 (reinterpret_cast<Script*>(info->script())->source() != undefined);
443 template<
typename StaticVisitor>
451 if (code_mark.
Get()) {
459 if (!IsValidNonBuiltinContext(function->unchecked_context())) {
464 if (function->code() != shared_info->code()) {
468 return IsFlushable(heap, shared_info);
472 template<
typename StaticVisitor>
478 if (code_mark.
Get()) {
484 if (!(shared_info->
is_compiled() && HasSourceCode(heap, shared_info))) {
489 Object* function_data = shared_info->function_data();
490 if (function_data->IsFunctionTemplateInfo()) {
495 if (shared_info->code()->kind() != Code::FUNCTION) {
500 if (!shared_info->allows_lazy_compilation()) {
505 if (shared_info->is_toplevel()) {
514 static const int kCodeAgeThreshold = 5;
517 if (shared_info->
code_age() < kCodeAgeThreshold) {
526 template<
typename StaticVisitor>
529 StaticVisitor::BeforeVisitingSharedFunctionInfo(
object);
536 StaticVisitor::VisitPointers(heap, start_slot, end_slot);
540 template<
typename StaticVisitor>
543 StaticVisitor::BeforeVisitingSharedFunctionInfo(
object);
546 StaticVisitor::VisitPointer(heap, name_slot);
560 StaticVisitor::VisitPointers(heap, start_slot, end_slot);
564 template<
typename StaticVisitor>
571 StaticVisitor::VisitPointers(heap, start_slot, end_slot);
581 StaticVisitor::VisitPointers(heap, start_slot, end_slot);
585 template<
typename StaticVisitor>
592 StaticVisitor::VisitPointers(heap, start_slot, end_slot);
602 StaticVisitor::VisitPointers(heap, start_slot, end_slot);
607 int mode_mask = RelocInfo::kCodeTargetMask |
608 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
609 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) |
610 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) |
611 RelocInfo::ModeMask(RelocInfo::JS_RETURN) |
612 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) |
624 it.
rinfo()->Visit(v);
629 template<
typename StaticVisitor>
631 int mode_mask = RelocInfo::kCodeTargetMask |
632 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
633 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) |
634 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) |
635 RelocInfo::ModeMask(RelocInfo::JS_RETURN) |
636 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) |
641 StaticVisitor::VisitPointer(
644 StaticVisitor::VisitPointer(
647 StaticVisitor::VisitPointer(
650 StaticVisitor::VisitPointer(
656 it.
rinfo()->template Visit<StaticVisitor>(heap);
663 #endif // V8_OBJECTS_VISITING_INL_H_
static void VisitCodeEntry(Heap *heap, Address entry_address)
void ClearTypeFeedbackCells(Heap *heap)
static void VisitCodeTarget(Heap *heap, RelocInfo *rinfo)
static const int kPointerFieldsEndOffset
static const int kCodeOffset
static const int kCodeEntryOffset
static const int kPrototypeOrInitialMapOffset
int inobject_properties()
static void VisitJSFunction(Map *map, HeapObject *object)
static void VisitJSRegExp(Map *map, HeapObject *object)
static void MarkInlinedFunctionsCode(Heap *heap, Code *code)
void set_code_age(int age)
void IteratePointer(ObjectVisitor *v, int offset)
bool flush_monomorphic_ics()
static Object * GetObjectFromEntryAddress(Address location_of_address)
static const int kOptimizedCodeMapOffset
static HeapObject * cast(Object *obj)
static void MarkMapContents(Heap *heap, Map *map)
static const int kDeoptimizationDataOffset
static void VisitDebugTarget(Heap *heap, RelocInfo *rinfo)
static Map * cast(Object *obj)
CodeFlusher * code_flusher()
static const int kStartOffset
static const int kHandlerTableOffset
#define ASSERT(condition)
static bool IsFlushable(Heap *heap, JSFunction *function)
static Context * cast(Object *context)
void AddCandidate(SharedFunctionInfo *shared_info)
static SharedFunctionInfo * cast(Object *obj)
static void VisitGlobalPropertyCell(Heap *heap, RelocInfo *rinfo)
Object ** GetPrototypeTransitionsSlot()
static Code * cast(Object *obj)
static Object ** RawField(HeapObject *obj, int offset)
TransitionArray * unchecked_transition_array()
void ClearCodeCache(Heap *heap)
static MarkBit MarkBitFrom(Address addr)
GlobalObject * global_object()
STATIC_ASSERT((FixedDoubleArray::kHeaderSize &kDoubleAlignmentMask)==0)
void ResetForNewContext(int new_ic_age)
void CodeIterateBody(ObjectVisitor *v)
bool HasPrototypeTransitions()
static const int kNameOffset
static const int kPropertiesOffset
static void VisitSharedFunctionInfoStrongCode(Heap *heap, HeapObject *object)
static Code * GetCodeFromTargetAddress(Address address)
int number_of_transitions()
bool is_inline_cache_stub()
static void VisitCode(Map *map, HeapObject *object)
InlineCacheState ic_state()
static void VisitSharedFunctionInfoWeakCode(Heap *heap, HeapObject *object)
static const int kTypeFeedbackInfoOffset
static const int kRelocationInfoOffset
static const int kNonWeakFieldsEndOffset
static int OffsetOfElementAt(int index)
void RecordRelocSlot(RelocInfo *rinfo, Object *target)
bool is_code_flushing_enabled() const
bool IsSimpleTransition()
static const int kEndOffset
Object * GetBackPointer()
InstanceType instance_type()
static void VisitSharedFunctionInfo(Map *map, HeapObject *object)
static void VisitJSFunctionWeakCode(Heap *heap, HeapObject *object)
static void VisitMap(Map *map, HeapObject *object)
static void MarkTransitionArray(Heap *heap, TransitionArray *transitions)
#define RUNTIME_ENTRY(name, nargs, ressize)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
static void VisitNativeContext(Map *map, HeapObject *object)
Object ** GetKeySlot(int transition_number)
static void VisitJSFunctionStrongCode(Heap *heap, HeapObject *object)
static void VisitEmbeddedPointer(Heap *heap, RelocInfo *rinfo)
static void Clear(Address address)
MarkCompactCollector * mark_compact_collector()
FixedBodyDescriptor< kHeaderSize, kHeaderSize+FIRST_WEAK_SLOT *kPointerSize, kSize > MarkCompactBodyDescriptor
void RecordCodeEntrySlot(Address slot, Code *target)
static const int kPointerFieldsBeginOffset
static JSFunction * cast(Object *obj)