| OLD | NEW | 
|    1 // Copyright 2012 the V8 project authors. All rights reserved. |    1 // Copyright 2012 the V8 project authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #ifndef V8_OBJECTS_VISITING_INL_H_ |    5 #ifndef V8_OBJECTS_VISITING_INL_H_ | 
|    6 #define V8_OBJECTS_VISITING_INL_H_ |    6 #define V8_OBJECTS_VISITING_INL_H_ | 
|    7  |    7  | 
|    8 #include "src/heap/array-buffer-tracker.h" |    8 #include "src/heap/array-buffer-tracker.h" | 
|    9 #include "src/heap/objects-visiting.h" |    9 #include "src/heap/objects-visiting.h" | 
|   10 #include "src/ic/ic-state.h" |   10 #include "src/ic/ic-state.h" | 
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   87   table_.template RegisterSpecializations<JSObjectVisitor, kVisitJSObject, |   87   table_.template RegisterSpecializations<JSObjectVisitor, kVisitJSObject, | 
|   88                                           kVisitJSObjectGeneric>(); |   88                                           kVisitJSObjectGeneric>(); | 
|   89   table_.template RegisterSpecializations<StructVisitor, kVisitStruct, |   89   table_.template RegisterSpecializations<StructVisitor, kVisitStruct, | 
|   90                                           kVisitStructGeneric>(); |   90                                           kVisitStructGeneric>(); | 
|   91 } |   91 } | 
|   92  |   92  | 
|   93  |   93  | 
|   94 template <typename StaticVisitor> |   94 template <typename StaticVisitor> | 
|   95 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSArrayBuffer( |   95 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSArrayBuffer( | 
|   96     Map* map, HeapObject* object) { |   96     Map* map, HeapObject* object) { | 
|   97   Heap* heap = map->GetHeap(); |   97   typedef FlexibleBodyVisitor<StaticVisitor, JSArrayBuffer::BodyDescriptor, int> | 
 |   98       JSArrayBufferBodyVisitor; | 
|   98  |   99  | 
|   99   JSArrayBuffer::JSArrayBufferIterateBody< |  | 
|  100       StaticNewSpaceVisitor<StaticVisitor> >(heap, object); |  | 
|  101   if (!JSArrayBuffer::cast(object)->is_external()) { |  100   if (!JSArrayBuffer::cast(object)->is_external()) { | 
 |  101     Heap* heap = map->GetHeap(); | 
|  102     heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); |  102     heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); | 
|  103   } |  103   } | 
|  104   return JSArrayBuffer::kSizeWithInternalFields; |  104   return JSArrayBufferBodyVisitor::Visit(map, object); | 
|  105 } |  105 } | 
|  106  |  106  | 
|  107  |  107  | 
|  108 template <typename StaticVisitor> |  108 template <typename StaticVisitor> | 
|  109 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSTypedArray( |  109 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSTypedArray( | 
|  110     Map* map, HeapObject* object) { |  110     Map* map, HeapObject* object) { | 
|  111   VisitPointers( |  111   VisitPointers( | 
|  112       map->GetHeap(), object, |  112       map->GetHeap(), object, | 
|  113       HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), |  113       HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), | 
|  114       HeapObject::RawField(object, JSTypedArray::kSizeWithInternalFields)); |  114       HeapObject::RawField(object, JSTypedArray::kSizeWithInternalFields)); | 
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  518       StaticVisitor::MarkObject(heap, function->shared()->code()); |  518       StaticVisitor::MarkObject(heap, function->shared()->code()); | 
|  519     } |  519     } | 
|  520   } |  520   } | 
|  521   VisitJSFunctionStrongCode(map, object); |  521   VisitJSFunctionStrongCode(map, object); | 
|  522 } |  522 } | 
|  523  |  523  | 
|  524  |  524  | 
|  525 template <typename StaticVisitor> |  525 template <typename StaticVisitor> | 
|  526 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(Map* map, |  526 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(Map* map, | 
|  527                                                         HeapObject* object) { |  527                                                         HeapObject* object) { | 
|  528   int last_property_offset = |  528   typedef FlexibleBodyVisitor<StaticVisitor, JSRegExp::BodyDescriptor, void> | 
|  529       JSRegExp::kSize + kPointerSize * map->GetInObjectProperties(); |  529       JSRegExpBodyVisitor; | 
|  530   StaticVisitor::VisitPointers( |  530   JSRegExpBodyVisitor::Visit(map, object); | 
|  531       map->GetHeap(), object, |  | 
|  532       HeapObject::RawField(object, JSRegExp::kPropertiesOffset), |  | 
|  533       HeapObject::RawField(object, last_property_offset)); |  | 
|  534 } |  531 } | 
|  535  |  532  | 
|  536  |  533  | 
|  537 template <typename StaticVisitor> |  534 template <typename StaticVisitor> | 
|  538 void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( |  535 void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( | 
|  539     Map* map, HeapObject* object) { |  536     Map* map, HeapObject* object) { | 
|  540   Heap* heap = map->GetHeap(); |  537   Heap* heap = map->GetHeap(); | 
|  541  |  538  | 
|  542   JSArrayBuffer::JSArrayBufferIterateBody<StaticVisitor>(heap, object); |  539   typedef FlexibleBodyVisitor<StaticVisitor, JSArrayBuffer::BodyDescriptor, | 
 |  540                               void> JSArrayBufferBodyVisitor; | 
 |  541  | 
 |  542   JSArrayBufferBodyVisitor::Visit(map, object); | 
 |  543  | 
|  543   if (!JSArrayBuffer::cast(object)->is_external() && |  544   if (!JSArrayBuffer::cast(object)->is_external() && | 
|  544       !heap->InNewSpace(object)) { |  545       !heap->InNewSpace(object)) { | 
|  545     heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); |  546     heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); | 
|  546   } |  547   } | 
|  547 } |  548 } | 
|  548  |  549  | 
|  549  |  550  | 
|  550 template <typename StaticVisitor> |  551 template <typename StaticVisitor> | 
|  551 void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray( |  552 void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray( | 
|  552     Map* map, HeapObject* object) { |  553     Map* map, HeapObject* object) { | 
|  553   StaticVisitor::VisitPointers( |  554   typedef FlexibleBodyVisitor<StaticVisitor, JSTypedArray::BodyDescriptor, void> | 
|  554       map->GetHeap(), object, |  555       JSTypedArrayBodyVisitor; | 
|  555       HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), |  556   JSTypedArrayBodyVisitor::Visit(map, object); | 
|  556       HeapObject::RawField(object, JSTypedArray::kSizeWithInternalFields)); |  | 
|  557 } |  557 } | 
|  558  |  558  | 
|  559  |  559  | 
|  560 template <typename StaticVisitor> |  560 template <typename StaticVisitor> | 
|  561 void StaticMarkingVisitor<StaticVisitor>::VisitJSDataView(Map* map, |  561 void StaticMarkingVisitor<StaticVisitor>::VisitJSDataView(Map* map, | 
|  562                                                           HeapObject* object) { |  562                                                           HeapObject* object) { | 
|  563   StaticVisitor::VisitPointers( |  563   typedef FlexibleBodyVisitor<StaticVisitor, JSDataView::BodyDescriptor, void> | 
|  564       map->GetHeap(), object, |  564       JSDataViewBodyVisitor; | 
|  565       HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset), |  565   JSDataViewBodyVisitor::Visit(map, object); | 
|  566       HeapObject::RawField(object, JSDataView::kSizeWithInternalFields)); |  | 
|  567 } |  566 } | 
|  568  |  567  | 
|  569  |  568  | 
|  570 template <typename StaticVisitor> |  569 template <typename StaticVisitor> | 
|  571 void StaticMarkingVisitor<StaticVisitor>::VisitBytecodeArray( |  570 void StaticMarkingVisitor<StaticVisitor>::VisitBytecodeArray( | 
|  572     Map* map, HeapObject* object) { |  571     Map* map, HeapObject* object) { | 
|  573   StaticVisitor::VisitPointers( |  572   StaticVisitor::VisitPointers( | 
|  574       map->GetHeap(), object, |  573       map->GetHeap(), object, | 
|  575       HeapObject::RawField(object, BytecodeArray::kConstantPoolOffset), |  574       HeapObject::RawField(object, BytecodeArray::kConstantPoolOffset), | 
|  576       HeapObject::RawField(object, BytecodeArray::kHeaderSize)); |  575       HeapObject::RawField(object, BytecodeArray::kHeaderSize)); | 
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  879  |  878  | 
|  880   RelocIterator it(this, mode_mask); |  879   RelocIterator it(this, mode_mask); | 
|  881   for (; !it.done(); it.next()) { |  880   for (; !it.done(); it.next()) { | 
|  882     it.rinfo()->template Visit<StaticVisitor>(heap); |  881     it.rinfo()->template Visit<StaticVisitor>(heap); | 
|  883   } |  882   } | 
|  884 } |  883 } | 
|  885 }  // namespace internal |  884 }  // namespace internal | 
|  886 }  // namespace v8 |  885 }  // namespace v8 | 
|  887  |  886  | 
|  888 #endif  // V8_OBJECTS_VISITING_INL_H_ |  887 #endif  // V8_OBJECTS_VISITING_INL_H_ | 
| OLD | NEW |