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

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

Issue 1226783002: Always mark entire prototype descriptor arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment Created 5 years, 5 months 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 | « no previous file | no next file » | 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/objects-visiting.h" 8 #include "src/heap/objects-visiting.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 536
537 template <typename StaticVisitor> 537 template <typename StaticVisitor>
538 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(Heap* heap, 538 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(Heap* heap,
539 Map* map) { 539 Map* map) {
540 Object* raw_transitions = map->raw_transitions(); 540 Object* raw_transitions = map->raw_transitions();
541 if (TransitionArray::IsFullTransitionArray(raw_transitions)) { 541 if (TransitionArray::IsFullTransitionArray(raw_transitions)) {
542 MarkTransitionArray(heap, TransitionArray::cast(raw_transitions)); 542 MarkTransitionArray(heap, TransitionArray::cast(raw_transitions));
543 } 543 }
544 544
545 // Since descriptor arrays are potentially shared, ensure that only the 545 // Since descriptor arrays are potentially shared, ensure that only the
546 // descriptors that belong to this map are marked. The first time a 546 // descriptors that belong to this map are marked. The first time a non-empty
547 // non-empty descriptor array is marked, its header is also visited. The slot 547 // descriptor array is marked, its header is also visited. The slot holding
548 // holding the descriptor array will be implicitly recorded when the pointer 548 // the descriptor array will be implicitly recorded when the pointer fields of
549 // fields of this map are visited. 549 // this map are visited. Prototype maps don't keep track of transitions, so
550 DescriptorArray* descriptors = map->instance_descriptors(); 550 // just mark the entire descriptor array.
551 if (StaticVisitor::MarkObjectWithoutPush(heap, descriptors) && 551 if (!map->is_prototype_map()) {
552 descriptors->length() > 0) { 552 DescriptorArray* descriptors = map->instance_descriptors();
553 StaticVisitor::VisitPointers(heap, descriptors->GetFirstElementAddress(), 553 if (StaticVisitor::MarkObjectWithoutPush(heap, descriptors) &&
554 descriptors->GetDescriptorEndSlot(0)); 554 descriptors->length() > 0) {
555 } 555 StaticVisitor::VisitPointers(heap, descriptors->GetFirstElementAddress(),
556 int start = 0; 556 descriptors->GetDescriptorEndSlot(0));
557 int end = map->NumberOfOwnDescriptors(); 557 }
558 if (start < end) { 558 int start = 0;
559 StaticVisitor::VisitPointers(heap, 559 int end = map->NumberOfOwnDescriptors();
560 descriptors->GetDescriptorStartSlot(start), 560 if (start < end) {
561 descriptors->GetDescriptorEndSlot(end)); 561 StaticVisitor::VisitPointers(heap,
562 descriptors->GetDescriptorStartSlot(start),
563 descriptors->GetDescriptorEndSlot(end));
564 }
562 } 565 }
563 566
564 // Mark the pointer fields of the Map. Since the transitions array has 567 // Mark the pointer fields of the Map. Since the transitions array has
565 // been marked already, it is fine that one of these fields contains a 568 // been marked already, it is fine that one of these fields contains a
566 // pointer to it. 569 // pointer to it.
567 StaticVisitor::VisitPointers( 570 StaticVisitor::VisitPointers(
568 heap, HeapObject::RawField(map, Map::kPointerFieldsBeginOffset), 571 heap, HeapObject::RawField(map, Map::kPointerFieldsBeginOffset),
569 HeapObject::RawField(map, Map::kPointerFieldsEndOffset)); 572 HeapObject::RawField(map, Map::kPointerFieldsEndOffset));
570 } 573 }
571 574
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 839
837 RelocIterator it(this, mode_mask); 840 RelocIterator it(this, mode_mask);
838 for (; !it.done(); it.next()) { 841 for (; !it.done(); it.next()) {
839 it.rinfo()->template Visit<StaticVisitor>(heap); 842 it.rinfo()->template Visit<StaticVisitor>(heap);
840 } 843 }
841 } 844 }
842 } 845 }
843 } // namespace v8::internal 846 } // namespace v8::internal
844 847
845 #endif // V8_OBJECTS_VISITING_INL_H_ 848 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698