Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1004)

Side by Side Diff: src/heap/objects-visiting-inl.h

Issue 1468933004: Allow in-object properties in JSCollections, JSWeakCollections and JSRegExp. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 StaticVisitor::VisitPointers( 379 StaticVisitor::VisitPointers(
380 heap, object, 380 heap, object,
381 HeapObject::RawField(object, AllocationSite::kPointerFieldsBeginOffset), 381 HeapObject::RawField(object, AllocationSite::kPointerFieldsBeginOffset),
382 HeapObject::RawField(object, AllocationSite::kPointerFieldsEndOffset)); 382 HeapObject::RawField(object, AllocationSite::kPointerFieldsEndOffset));
383 } 383 }
384 384
385 385
386 template <typename StaticVisitor> 386 template <typename StaticVisitor>
387 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCollection( 387 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCollection(
388 Map* map, HeapObject* object) { 388 Map* map, HeapObject* object) {
389 typedef FlexibleBodyVisitor<StaticVisitor,
390 JSWeakCollection::BodyDescriptorWeak,
391 void> JSWeakCollectionBodyVisitor;
389 Heap* heap = map->GetHeap(); 392 Heap* heap = map->GetHeap();
390 JSWeakCollection* weak_collection = 393 JSWeakCollection* weak_collection =
391 reinterpret_cast<JSWeakCollection*>(object); 394 reinterpret_cast<JSWeakCollection*>(object);
392 395
393 // Enqueue weak collection in linked list of encountered weak collections. 396 // Enqueue weak collection in linked list of encountered weak collections.
394 if (weak_collection->next() == heap->undefined_value()) { 397 if (weak_collection->next() == heap->undefined_value()) {
395 weak_collection->set_next(heap->encountered_weak_collections()); 398 weak_collection->set_next(heap->encountered_weak_collections());
396 heap->set_encountered_weak_collections(weak_collection); 399 heap->set_encountered_weak_collections(weak_collection);
397 } 400 }
398 401
399 // Skip visiting the backing hash table containing the mappings and the 402 // Skip visiting the backing hash table containing the mappings and the
400 // pointer to the other enqueued weak collections, both are post-processed. 403 // pointer to the other enqueued weak collections, both are post-processed.
401 StaticVisitor::VisitPointers( 404 JSWeakCollectionBodyVisitor::Visit(map, object);
402 heap, object,
403 HeapObject::RawField(object, JSWeakCollection::kPropertiesOffset),
404 HeapObject::RawField(object, JSWeakCollection::kTableOffset));
405 STATIC_ASSERT(JSWeakCollection::kTableOffset + kPointerSize ==
406 JSWeakCollection::kNextOffset);
407 STATIC_ASSERT(JSWeakCollection::kNextOffset + kPointerSize ==
408 JSWeakCollection::kSize);
409 405
410 // Partially initialized weak collection is enqueued, but table is ignored. 406 // Partially initialized weak collection is enqueued, but table is ignored.
411 if (!weak_collection->table()->IsHashTable()) return; 407 if (!weak_collection->table()->IsHashTable()) return;
412 408
413 // Mark the backing hash table without pushing it on the marking stack. 409 // Mark the backing hash table without pushing it on the marking stack.
414 Object** slot = HeapObject::RawField(object, JSWeakCollection::kTableOffset); 410 Object** slot = HeapObject::RawField(object, JSWeakCollection::kTableOffset);
415 HeapObject* obj = HeapObject::cast(*slot); 411 HeapObject* obj = HeapObject::cast(*slot);
416 heap->mark_compact_collector()->RecordSlot(object, slot, obj); 412 heap->mark_compact_collector()->RecordSlot(object, slot, obj);
417 StaticVisitor::MarkObjectWithoutPush(heap, obj); 413 StaticVisitor::MarkObjectWithoutPush(heap, obj);
418 } 414 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 StaticVisitor::MarkObject(heap, function->shared()->code()); 510 StaticVisitor::MarkObject(heap, function->shared()->code());
515 } 511 }
516 } 512 }
517 VisitJSFunctionStrongCode(map, object); 513 VisitJSFunctionStrongCode(map, object);
518 } 514 }
519 515
520 516
521 template <typename StaticVisitor> 517 template <typename StaticVisitor>
522 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(Map* map, 518 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(Map* map,
523 HeapObject* object) { 519 HeapObject* object) {
524 typedef FlexibleBodyVisitor<StaticVisitor, JSRegExp::BodyDescriptor, void> 520 JSObjectVisitor::Visit(map, object);
525 JSRegExpBodyVisitor;
526 JSRegExpBodyVisitor::Visit(map, object);
527 } 521 }
528 522
529 523
530 template <typename StaticVisitor> 524 template <typename StaticVisitor>
531 void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( 525 void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer(
532 Map* map, HeapObject* object) { 526 Map* map, HeapObject* object) {
533 Heap* heap = map->GetHeap(); 527 Heap* heap = map->GetHeap();
534 528
535 typedef FlexibleBodyVisitor<StaticVisitor, JSArrayBuffer::BodyDescriptor, 529 typedef FlexibleBodyVisitor<StaticVisitor, JSArrayBuffer::BodyDescriptor,
536 void> JSArrayBufferBodyVisitor; 530 void> JSArrayBufferBodyVisitor;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, 808 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode,
815 void> JSFunctionWeakCodeBodyVisitor; 809 void> JSFunctionWeakCodeBodyVisitor;
816 JSFunctionWeakCodeBodyVisitor::Visit(map, object); 810 JSFunctionWeakCodeBodyVisitor::Visit(map, object);
817 } 811 }
818 812
819 813
820 } // namespace internal 814 } // namespace internal
821 } // namespace v8 815 } // namespace v8
822 816
823 #endif // V8_OBJECTS_VISITING_INL_H_ 817 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698