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

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

Issue 142813003: A64: Synchronize with r15358. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-visiting.cc ('k') | src/optimizing-compiler-thread.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 table_.Register(kVisitSeqOneByteString, &VisitSeqOneByteString); 76 table_.Register(kVisitSeqOneByteString, &VisitSeqOneByteString);
77 77
78 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); 78 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString);
79 79
80 table_.Register(kVisitJSFunction, &VisitJSFunction); 80 table_.Register(kVisitJSFunction, &VisitJSFunction);
81 81
82 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); 82 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer);
83 83
84 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); 84 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray);
85 85
86 table_.Register(kVisitJSDataView, &VisitJSDataView);
87
86 table_.Register(kVisitFreeSpace, &VisitFreeSpace); 88 table_.Register(kVisitFreeSpace, &VisitFreeSpace);
87 89
88 table_.Register(kVisitJSWeakMap, &JSObjectVisitor::Visit); 90 table_.Register(kVisitJSWeakMap, &JSObjectVisitor::Visit);
89 91
90 table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit); 92 table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit);
91 93
92 table_.template RegisterSpecializations<DataObjectVisitor, 94 table_.template RegisterSpecializations<DataObjectVisitor,
93 kVisitDataObject, 95 kVisitDataObject,
94 kVisitDataObjectGeneric>(); 96 kVisitDataObjectGeneric>();
95 97
96 table_.template RegisterSpecializations<JSObjectVisitor, 98 table_.template RegisterSpecializations<JSObjectVisitor,
97 kVisitJSObject, 99 kVisitJSObject,
98 kVisitJSObjectGeneric>(); 100 kVisitJSObjectGeneric>();
99 table_.template RegisterSpecializations<StructVisitor, 101 table_.template RegisterSpecializations<StructVisitor,
100 kVisitStruct, 102 kVisitStruct,
101 kVisitStructGeneric>(); 103 kVisitStructGeneric>();
102 } 104 }
103 105
104 106
105 template<typename StaticVisitor> 107 template<typename StaticVisitor>
106 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSArrayBuffer( 108 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSArrayBuffer(
107 Map* map, HeapObject* object) { 109 Map* map, HeapObject* object) {
108 Heap* heap = map->GetHeap(); 110 Heap* heap = map->GetHeap();
109 111
110 STATIC_ASSERT( 112 STATIC_ASSERT(
111 JSArrayBuffer::kWeakFirstArrayOffset == 113 JSArrayBuffer::kWeakFirstViewOffset ==
112 JSArrayBuffer::kWeakNextOffset + kPointerSize); 114 JSArrayBuffer::kWeakNextOffset + kPointerSize);
113 VisitPointers( 115 VisitPointers(
114 heap, 116 heap,
115 HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset), 117 HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset),
116 HeapObject::RawField(object, JSArrayBuffer::kWeakNextOffset)); 118 HeapObject::RawField(object, JSArrayBuffer::kWeakNextOffset));
117 VisitPointers( 119 VisitPointers(
118 heap, 120 heap,
119 HeapObject::RawField(object, 121 HeapObject::RawField(object,
120 JSArrayBuffer::kWeakNextOffset + 2 * kPointerSize), 122 JSArrayBuffer::kWeakNextOffset + 2 * kPointerSize),
121 HeapObject::RawField(object, JSArrayBuffer::kSizeWithInternalFields)); 123 HeapObject::RawField(object, JSArrayBuffer::kSizeWithInternalFields));
(...skipping 11 matching lines...) Expand all
133 VisitPointers( 135 VisitPointers(
134 map->GetHeap(), 136 map->GetHeap(),
135 HeapObject::RawField(object, 137 HeapObject::RawField(object,
136 JSTypedArray::kWeakNextOffset + kPointerSize), 138 JSTypedArray::kWeakNextOffset + kPointerSize),
137 HeapObject::RawField(object, JSTypedArray::kSize)); 139 HeapObject::RawField(object, JSTypedArray::kSize));
138 return JSTypedArray::kSize; 140 return JSTypedArray::kSize;
139 } 141 }
140 142
141 143
142 template<typename StaticVisitor> 144 template<typename StaticVisitor>
145 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSDataView(
146 Map* map, HeapObject* object) {
147 VisitPointers(
148 map->GetHeap(),
149 HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset),
150 HeapObject::RawField(object, JSDataView::kWeakNextOffset));
151 VisitPointers(
152 map->GetHeap(),
153 HeapObject::RawField(object,
154 JSDataView::kWeakNextOffset + kPointerSize),
155 HeapObject::RawField(object, JSDataView::kSize));
156 return JSDataView::kSize;
157 }
158
159
160 template<typename StaticVisitor>
143 void StaticMarkingVisitor<StaticVisitor>::Initialize() { 161 void StaticMarkingVisitor<StaticVisitor>::Initialize() {
144 table_.Register(kVisitShortcutCandidate, 162 table_.Register(kVisitShortcutCandidate,
145 &FixedBodyVisitor<StaticVisitor, 163 &FixedBodyVisitor<StaticVisitor,
146 ConsString::BodyDescriptor, 164 ConsString::BodyDescriptor,
147 void>::Visit); 165 void>::Visit);
148 166
149 table_.Register(kVisitConsString, 167 table_.Register(kVisitConsString,
150 &FixedBodyVisitor<StaticVisitor, 168 &FixedBodyVisitor<StaticVisitor,
151 ConsString::BodyDescriptor, 169 ConsString::BodyDescriptor,
152 void>::Visit); 170 void>::Visit);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 table_.Register(kVisitCode, &VisitCode); 205 table_.Register(kVisitCode, &VisitCode);
188 206
189 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); 207 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo);
190 208
191 table_.Register(kVisitJSFunction, &VisitJSFunction); 209 table_.Register(kVisitJSFunction, &VisitJSFunction);
192 210
193 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); 211 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer);
194 212
195 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); 213 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray);
196 214
215 table_.Register(kVisitJSDataView, &VisitJSDataView);
216
197 // Registration for kVisitJSRegExp is done by StaticVisitor. 217 // Registration for kVisitJSRegExp is done by StaticVisitor.
198 218
199 table_.Register(kVisitCell, 219 table_.Register(kVisitCell,
200 &FixedBodyVisitor<StaticVisitor, 220 &FixedBodyVisitor<StaticVisitor,
201 Cell::BodyDescriptor, 221 Cell::BodyDescriptor,
202 void>::Visit); 222 void>::Visit);
203 223
204 table_.Register(kVisitPropertyCell, 224 table_.Register(kVisitPropertyCell, &VisitPropertyCell);
205 &FixedBodyVisitor<StaticVisitor,
206 PropertyCell::BodyDescriptor,
207 void>::Visit);
208 225
209 table_.template RegisterSpecializations<DataObjectVisitor, 226 table_.template RegisterSpecializations<DataObjectVisitor,
210 kVisitDataObject, 227 kVisitDataObject,
211 kVisitDataObjectGeneric>(); 228 kVisitDataObjectGeneric>();
212 229
213 table_.template RegisterSpecializations<JSObjectVisitor, 230 table_.template RegisterSpecializations<JSObjectVisitor,
214 kVisitJSObject, 231 kVisitJSObject,
215 kVisitJSObjectGeneric>(); 232 kVisitJSObjectGeneric>();
216 233
217 table_.template RegisterSpecializations<StructObjectVisitor, 234 table_.template RegisterSpecializations<StructObjectVisitor,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 MarkMapContents(heap, map_object); 349 MarkMapContents(heap, map_object);
333 } else { 350 } else {
334 StaticVisitor::VisitPointers(heap, 351 StaticVisitor::VisitPointers(heap,
335 HeapObject::RawField(object, Map::kPointerFieldsBeginOffset), 352 HeapObject::RawField(object, Map::kPointerFieldsBeginOffset),
336 HeapObject::RawField(object, Map::kPointerFieldsEndOffset)); 353 HeapObject::RawField(object, Map::kPointerFieldsEndOffset));
337 } 354 }
338 } 355 }
339 356
340 357
341 template<typename StaticVisitor> 358 template<typename StaticVisitor>
359 void StaticMarkingVisitor<StaticVisitor>::VisitPropertyCell(
360 Map* map, HeapObject* object) {
361 Heap* heap = map->GetHeap();
362
363 Object** slot =
364 HeapObject::RawField(object, PropertyCell::kDependentCodeOffset);
365 if (FLAG_collect_maps) {
366 // Mark property cell dependent codes array but do not push it onto marking
367 // stack, this will make references from it weak. We will clean dead
368 // codes when we iterate over property cells in ClearNonLiveReferences.
369 HeapObject* obj = HeapObject::cast(*slot);
370 heap->mark_compact_collector()->RecordSlot(slot, slot, obj);
371 StaticVisitor::MarkObjectWithoutPush(heap, obj);
372 } else {
373 StaticVisitor::VisitPointer(heap, slot);
374 }
375
376 StaticVisitor::VisitPointers(heap,
377 HeapObject::RawField(object, PropertyCell::kPointerFieldsBeginOffset),
378 HeapObject::RawField(object, PropertyCell::kPointerFieldsEndOffset));
379 }
380
381
382 template<typename StaticVisitor>
342 void StaticMarkingVisitor<StaticVisitor>::VisitCode( 383 void StaticMarkingVisitor<StaticVisitor>::VisitCode(
343 Map* map, HeapObject* object) { 384 Map* map, HeapObject* object) {
344 Heap* heap = map->GetHeap(); 385 Heap* heap = map->GetHeap();
345 Code* code = Code::cast(object); 386 Code* code = Code::cast(object);
346 if (FLAG_cleanup_code_caches_at_gc) { 387 if (FLAG_cleanup_code_caches_at_gc) {
347 code->ClearTypeFeedbackCells(heap); 388 code->ClearTypeFeedbackCells(heap);
348 } 389 }
349 if (FLAG_age_code && !Serializer::enabled()) { 390 if (FLAG_age_code && !Serializer::enabled()) {
350 code->MakeOlder(heap->mark_compact_collector()->marking_parity()); 391 code->MakeOlder(heap->mark_compact_collector()->marking_parity());
351 } 392 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 HeapObject::RawField(object, last_property_offset)); 490 HeapObject::RawField(object, last_property_offset));
450 } 491 }
451 492
452 493
453 template<typename StaticVisitor> 494 template<typename StaticVisitor>
454 void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( 495 void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer(
455 Map* map, HeapObject* object) { 496 Map* map, HeapObject* object) {
456 Heap* heap = map->GetHeap(); 497 Heap* heap = map->GetHeap();
457 498
458 STATIC_ASSERT( 499 STATIC_ASSERT(
459 JSArrayBuffer::kWeakFirstArrayOffset == 500 JSArrayBuffer::kWeakFirstViewOffset ==
460 JSArrayBuffer::kWeakNextOffset + kPointerSize); 501 JSArrayBuffer::kWeakNextOffset + kPointerSize);
461 StaticVisitor::VisitPointers( 502 StaticVisitor::VisitPointers(
462 heap, 503 heap,
463 HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset), 504 HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset),
464 HeapObject::RawField(object, JSArrayBuffer::kWeakNextOffset)); 505 HeapObject::RawField(object, JSArrayBuffer::kWeakNextOffset));
465 StaticVisitor::VisitPointers( 506 StaticVisitor::VisitPointers(
466 heap, 507 heap,
467 HeapObject::RawField(object, 508 HeapObject::RawField(object,
468 JSArrayBuffer::kWeakNextOffset + 2 * kPointerSize), 509 JSArrayBuffer::kWeakNextOffset + 2 * kPointerSize),
469 HeapObject::RawField(object, JSArrayBuffer::kSizeWithInternalFields)); 510 HeapObject::RawField(object, JSArrayBuffer::kSizeWithInternalFields));
470 } 511 }
471 512
472 513
473 template<typename StaticVisitor> 514 template<typename StaticVisitor>
474 void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray( 515 void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray(
475 Map* map, HeapObject* object) { 516 Map* map, HeapObject* object) {
476 StaticVisitor::VisitPointers( 517 StaticVisitor::VisitPointers(
477 map->GetHeap(), 518 map->GetHeap(),
478 HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), 519 HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset),
479 HeapObject::RawField(object, JSTypedArray::kWeakNextOffset)); 520 HeapObject::RawField(object, JSTypedArray::kWeakNextOffset));
480 StaticVisitor::VisitPointers( 521 StaticVisitor::VisitPointers(
481 map->GetHeap(), 522 map->GetHeap(),
482 HeapObject::RawField(object, 523 HeapObject::RawField(object,
483 JSTypedArray::kWeakNextOffset + kPointerSize), 524 JSTypedArray::kWeakNextOffset + kPointerSize),
484 HeapObject::RawField(object, JSTypedArray::kSize)); 525 HeapObject::RawField(object, JSTypedArray::kSize));
485 } 526 }
486 527
487 528
488 template<typename StaticVisitor> 529 template<typename StaticVisitor>
530 void StaticMarkingVisitor<StaticVisitor>::VisitJSDataView(
531 Map* map, HeapObject* object) {
532 StaticVisitor::VisitPointers(
533 map->GetHeap(),
534 HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset),
535 HeapObject::RawField(object, JSDataView::kWeakNextOffset));
536 StaticVisitor::VisitPointers(
537 map->GetHeap(),
538 HeapObject::RawField(object,
539 JSDataView::kWeakNextOffset + kPointerSize),
540 HeapObject::RawField(object, JSDataView::kSize));
541 }
542
543
544 template<typename StaticVisitor>
489 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents( 545 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(
490 Heap* heap, Map* map) { 546 Heap* heap, Map* map) {
491 // Make sure that the back pointer stored either in the map itself or 547 // Make sure that the back pointer stored either in the map itself or
492 // inside its transitions array is marked. Skip recording the back 548 // inside its transitions array is marked. Skip recording the back
493 // pointer slot since map space is not compacted. 549 // pointer slot since map space is not compacted.
494 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer())); 550 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer()));
495 551
496 // Treat pointers in the transitions array as weak and also mark that 552 // Treat pointers in the transitions array as weak and also mark that
497 // array to prevent visiting it later. Skip recording the transition 553 // array to prevent visiting it later. Skip recording the transition
498 // array slot, since it will be implicitly recorded when the pointer 554 // array slot, since it will be implicitly recorded when the pointer
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 655
600 template<typename StaticVisitor> 656 template<typename StaticVisitor>
601 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( 657 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
602 Heap* heap, JSFunction* function) { 658 Heap* heap, JSFunction* function) {
603 SharedFunctionInfo* shared_info = function->shared(); 659 SharedFunctionInfo* shared_info = function->shared();
604 660
605 // Code is either on stack, in compilation cache or referenced 661 // Code is either on stack, in compilation cache or referenced
606 // by optimized version of function. 662 // by optimized version of function.
607 MarkBit code_mark = Marking::MarkBitFrom(function->code()); 663 MarkBit code_mark = Marking::MarkBitFrom(function->code());
608 if (code_mark.Get()) { 664 if (code_mark.Get()) {
609 if (!FLAG_age_code) {
610 if (!Marking::MarkBitFrom(shared_info).Get()) {
611 shared_info->set_code_age(0);
612 }
613 }
614 return false; 665 return false;
615 } 666 }
616 667
617 // The function must have a valid context and not be a builtin. 668 // The function must have a valid context and not be a builtin.
618 if (!IsValidNonBuiltinContext(function->unchecked_context())) { 669 if (!IsValidNonBuiltinContext(function->context())) {
619 return false; 670 return false;
620 } 671 }
621 672
622 // We do not (yet) flush code for optimized functions. 673 // We do not (yet) flush code for optimized functions.
623 if (function->code() != shared_info->code()) { 674 if (function->code() != shared_info->code()) {
624 return false; 675 return false;
625 } 676 }
626 677
627 // Check age of optimized code. 678 // Check age of optimized code.
628 if (FLAG_age_code && !function->code()->IsOld()) { 679 if (FLAG_age_code && !function->code()->IsOld()) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 if (shared_info->is_toplevel()) { 726 if (shared_info->is_toplevel()) {
676 return false; 727 return false;
677 } 728 }
678 729
679 // If this is a function initialized with %SetCode then the one-to-one 730 // If this is a function initialized with %SetCode then the one-to-one
680 // relation between SharedFunctionInfo and Code is broken. 731 // relation between SharedFunctionInfo and Code is broken.
681 if (shared_info->dont_flush()) { 732 if (shared_info->dont_flush()) {
682 return false; 733 return false;
683 } 734 }
684 735
685 if (FLAG_age_code) { 736 // Check age of code. If code aging is disabled we never flush.
686 return shared_info->code()->IsOld(); 737 if (!FLAG_age_code || !shared_info->code()->IsOld()) {
687 } else { 738 return false;
688 // How many collections newly compiled code object will survive before being 739 }
689 // flushed.
690 static const int kCodeAgeThreshold = 5;
691 740
692 // Age this shared function info. 741 return true;
693 if (shared_info->code_age() < kCodeAgeThreshold) {
694 shared_info->set_code_age(shared_info->code_age() + 1);
695 return false;
696 }
697 return true;
698 }
699 } 742 }
700 743
701 744
702 template<typename StaticVisitor> 745 template<typename StaticVisitor>
703 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoStrongCode( 746 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoStrongCode(
704 Heap* heap, HeapObject* object) { 747 Heap* heap, HeapObject* object) {
705 StaticVisitor::BeforeVisitingSharedFunctionInfo(object); 748 StaticVisitor::BeforeVisitingSharedFunctionInfo(object);
706 Object** start_slot = 749 Object** start_slot =
707 HeapObject::RawField(object, 750 HeapObject::RawField(object,
708 SharedFunctionInfo::BodyDescriptor::kStartOffset); 751 SharedFunctionInfo::BodyDescriptor::kStartOffset);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 RelocIterator it(this, mode_mask); 873 RelocIterator it(this, mode_mask);
831 for (; !it.done(); it.next()) { 874 for (; !it.done(); it.next()) {
832 it.rinfo()->template Visit<StaticVisitor>(heap); 875 it.rinfo()->template Visit<StaticVisitor>(heap);
833 } 876 }
834 } 877 }
835 878
836 879
837 } } // namespace v8::internal 880 } } // namespace v8::internal
838 881
839 #endif // V8_OBJECTS_VISITING_INL_H_ 882 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « src/objects-visiting.cc ('k') | src/optimizing-compiler-thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698