diff options
Diffstat (limited to 'deps/v8/src/objects-visiting-inl.h')
-rw-r--r-- | deps/v8/src/objects-visiting-inl.h | 108 |
1 files changed, 78 insertions, 30 deletions
diff --git a/deps/v8/src/objects-visiting-inl.h b/deps/v8/src/objects-visiting-inl.h index 829eab809f..cfb7d4461f 100644 --- a/deps/v8/src/objects-visiting-inl.h +++ b/deps/v8/src/objects-visiting-inl.h @@ -83,6 +83,8 @@ void StaticNewSpaceVisitor<StaticVisitor>::Initialize() { table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); + table_.Register(kVisitJSDataView, &VisitJSDataView); + table_.Register(kVisitFreeSpace, &VisitFreeSpace); table_.Register(kVisitJSWeakMap, &JSObjectVisitor::Visit); @@ -108,7 +110,7 @@ int StaticNewSpaceVisitor<StaticVisitor>::VisitJSArrayBuffer( Heap* heap = map->GetHeap(); STATIC_ASSERT( - JSArrayBuffer::kWeakFirstArrayOffset == + JSArrayBuffer::kWeakFirstViewOffset == JSArrayBuffer::kWeakNextOffset + kPointerSize); VisitPointers( heap, @@ -140,6 +142,22 @@ int StaticNewSpaceVisitor<StaticVisitor>::VisitJSTypedArray( template<typename StaticVisitor> +int StaticNewSpaceVisitor<StaticVisitor>::VisitJSDataView( + Map* map, HeapObject* object) { + VisitPointers( + map->GetHeap(), + HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset), + HeapObject::RawField(object, JSDataView::kWeakNextOffset)); + VisitPointers( + map->GetHeap(), + HeapObject::RawField(object, + JSDataView::kWeakNextOffset + kPointerSize), + HeapObject::RawField(object, JSDataView::kSize)); + return JSDataView::kSize; +} + + +template<typename StaticVisitor> void StaticMarkingVisitor<StaticVisitor>::Initialize() { table_.Register(kVisitShortcutCandidate, &FixedBodyVisitor<StaticVisitor, @@ -194,13 +212,17 @@ void StaticMarkingVisitor<StaticVisitor>::Initialize() { table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); + table_.Register(kVisitJSDataView, &VisitJSDataView); + // Registration for kVisitJSRegExp is done by StaticVisitor. - table_.Register(kVisitPropertyCell, + table_.Register(kVisitCell, &FixedBodyVisitor<StaticVisitor, - JSGlobalPropertyCell::BodyDescriptor, + Cell::BodyDescriptor, void>::Visit); + table_.Register(kVisitPropertyCell, &VisitPropertyCell); + table_.template RegisterSpecializations<DataObjectVisitor, kVisitDataObject, kVisitDataObjectGeneric>(); @@ -240,10 +262,10 @@ void StaticMarkingVisitor<StaticVisitor>::VisitEmbeddedPointer( template<typename StaticVisitor> -void StaticMarkingVisitor<StaticVisitor>::VisitGlobalPropertyCell( +void StaticMarkingVisitor<StaticVisitor>::VisitCell( Heap* heap, RelocInfo* rinfo) { - ASSERT(rinfo->rmode() == RelocInfo::GLOBAL_PROPERTY_CELL); - JSGlobalPropertyCell* cell = rinfo->target_cell(); + ASSERT(rinfo->rmode() == RelocInfo::CELL); + Cell* cell = rinfo->target_cell(); StaticVisitor::MarkObject(heap, cell); } @@ -334,6 +356,30 @@ void StaticMarkingVisitor<StaticVisitor>::VisitMap( template<typename StaticVisitor> +void StaticMarkingVisitor<StaticVisitor>::VisitPropertyCell( + Map* map, HeapObject* object) { + Heap* heap = map->GetHeap(); + + Object** slot = + HeapObject::RawField(object, PropertyCell::kDependentCodeOffset); + if (FLAG_collect_maps) { + // Mark property cell dependent codes array but do not push it onto marking + // stack, this will make references from it weak. We will clean dead + // codes when we iterate over property cells in ClearNonLiveReferences. + HeapObject* obj = HeapObject::cast(*slot); + heap->mark_compact_collector()->RecordSlot(slot, slot, obj); + StaticVisitor::MarkObjectWithoutPush(heap, obj); + } else { + StaticVisitor::VisitPointer(heap, slot); + } + + StaticVisitor::VisitPointers(heap, + HeapObject::RawField(object, PropertyCell::kPointerFieldsBeginOffset), + HeapObject::RawField(object, PropertyCell::kPointerFieldsEndOffset)); +} + + +template<typename StaticVisitor> void StaticMarkingVisitor<StaticVisitor>::VisitCode( Map* map, HeapObject* object) { Heap* heap = map->GetHeap(); @@ -414,7 +460,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction( // Visit shared function info immediately to avoid double checking // of its flushability later. This is just an optimization because // the shared function info would eventually be visited. - SharedFunctionInfo* shared = function->unchecked_shared(); + SharedFunctionInfo* shared = function->shared(); if (StaticVisitor::MarkObjectWithoutPush(heap, shared)) { StaticVisitor::MarkObject(heap, shared->map()); VisitSharedFunctionInfoWeakCode(heap, shared); @@ -451,7 +497,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( Heap* heap = map->GetHeap(); STATIC_ASSERT( - JSArrayBuffer::kWeakFirstArrayOffset == + JSArrayBuffer::kWeakFirstViewOffset == JSArrayBuffer::kWeakNextOffset + kPointerSize); StaticVisitor::VisitPointers( heap, @@ -481,6 +527,21 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray( template<typename StaticVisitor> +void StaticMarkingVisitor<StaticVisitor>::VisitJSDataView( + Map* map, HeapObject* object) { + StaticVisitor::VisitPointers( + map->GetHeap(), + HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset), + HeapObject::RawField(object, JSDataView::kWeakNextOffset)); + StaticVisitor::VisitPointers( + map->GetHeap(), + HeapObject::RawField(object, + JSDataView::kWeakNextOffset + kPointerSize), + HeapObject::RawField(object, JSDataView::kSize)); +} + + +template<typename StaticVisitor> void StaticMarkingVisitor<StaticVisitor>::MarkMapContents( Heap* heap, Map* map) { // Make sure that the back pointer stored either in the map itself or @@ -595,22 +656,17 @@ inline static bool HasSourceCode(Heap* heap, SharedFunctionInfo* info) { template<typename StaticVisitor> bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( Heap* heap, JSFunction* function) { - SharedFunctionInfo* shared_info = function->unchecked_shared(); + SharedFunctionInfo* shared_info = function->shared(); // Code is either on stack, in compilation cache or referenced // by optimized version of function. MarkBit code_mark = Marking::MarkBitFrom(function->code()); if (code_mark.Get()) { - if (!FLAG_age_code) { - if (!Marking::MarkBitFrom(shared_info).Get()) { - shared_info->set_code_age(0); - } - } return false; } // The function must have a valid context and not be a builtin. - if (!IsValidNonBuiltinContext(function->unchecked_context())) { + if (!IsValidNonBuiltinContext(function->context())) { return false; } @@ -677,20 +733,12 @@ bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( return false; } - if (FLAG_age_code) { - return shared_info->code()->IsOld(); - } else { - // How many collections newly compiled code object will survive before being - // flushed. - static const int kCodeAgeThreshold = 5; - - // Age this shared function info. - if (shared_info->code_age() < kCodeAgeThreshold) { - shared_info->set_code_age(shared_info->code_age() + 1); - return false; - } - return true; + // Check age of code. If code aging is disabled we never flush. + if (!FLAG_age_code || !shared_info->code()->IsOld()) { + return false; } + + return true; } @@ -777,7 +825,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitJSFunctionWeakCode( void Code::CodeIterateBody(ObjectVisitor* v) { int mode_mask = RelocInfo::kCodeTargetMask | RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | - RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | + RelocInfo::ModeMask(RelocInfo::CELL) | RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | RelocInfo::ModeMask(RelocInfo::JS_RETURN) | RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | @@ -801,7 +849,7 @@ template<typename StaticVisitor> void Code::CodeIterateBody(Heap* heap) { int mode_mask = RelocInfo::kCodeTargetMask | RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | - RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | + RelocInfo::ModeMask(RelocInfo::CELL) | RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | RelocInfo::ModeMask(RelocInfo::JS_RETURN) | RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |