Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 Heap* heap = map->GetHeap(); | 491 Heap* heap = map->GetHeap(); |
| 492 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); | 492 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); |
| 493 for (int i = 0; i < constant_pool->count_of_code_ptr_entries(); i++) { | 493 for (int i = 0; i < constant_pool->count_of_code_ptr_entries(); i++) { |
| 494 int index = constant_pool->first_code_ptr_index() + i; | 494 int index = constant_pool->first_code_ptr_index() + i; |
| 495 Address code_entry = | 495 Address code_entry = |
| 496 reinterpret_cast<Address>(constant_pool->RawFieldOfElementAt(index)); | 496 reinterpret_cast<Address>(constant_pool->RawFieldOfElementAt(index)); |
| 497 StaticVisitor::VisitCodeEntry(heap, code_entry); | 497 StaticVisitor::VisitCodeEntry(heap, code_entry); |
| 498 } | 498 } |
| 499 for (int i = 0; i < constant_pool->count_of_heap_ptr_entries(); i++) { | 499 for (int i = 0; i < constant_pool->count_of_heap_ptr_entries(); i++) { |
| 500 int index = constant_pool->first_heap_ptr_index() + i; | 500 int index = constant_pool->first_heap_ptr_index() + i; |
| 501 StaticVisitor::VisitPointer(heap, | 501 StaticVisitor::VisitPointer(heap, |
|
ulan
2014/03/19 08:50:00
IIUC, each heap object pointer in constant pool is
| |
| 502 constant_pool->RawFieldOfElementAt(index)); | 502 constant_pool->RawFieldOfElementAt(index)); |
| 503 } | 503 } |
| 504 for (int i = 0; i < constant_pool->count_of_weak_ptr_entries(); i++) { | |
| 505 int index = constant_pool->first_weak_ptr_index() + i; | |
| 506 Object** slot = constant_pool->RawFieldOfElementAt(index); | |
| 507 HeapObject* object = HeapObject::cast(*slot); | |
| 508 if (!object->IsCell()) { | |
| 509 heap->mark_compact_collector()->RecordSlot(slot, slot, object); | |
| 510 } | |
| 511 } | |
| 504 } | 512 } |
| 505 | 513 |
| 506 | 514 |
| 507 template<typename StaticVisitor> | 515 template<typename StaticVisitor> |
| 508 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction( | 516 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction( |
| 509 Map* map, HeapObject* object) { | 517 Map* map, HeapObject* object) { |
| 510 Heap* heap = map->GetHeap(); | 518 Heap* heap = map->GetHeap(); |
| 511 JSFunction* function = JSFunction::cast(object); | 519 JSFunction* function = JSFunction::cast(object); |
| 512 MarkCompactCollector* collector = heap->mark_compact_collector(); | 520 MarkCompactCollector* collector = heap->mark_compact_collector(); |
| 513 if (collector->is_code_flushing_enabled()) { | 521 if (collector->is_code_flushing_enabled()) { |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 941 RelocIterator it(this, mode_mask); | 949 RelocIterator it(this, mode_mask); |
| 942 for (; !it.done(); it.next()) { | 950 for (; !it.done(); it.next()) { |
| 943 it.rinfo()->template Visit<StaticVisitor>(heap); | 951 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 944 } | 952 } |
| 945 } | 953 } |
| 946 | 954 |
| 947 | 955 |
| 948 } } // namespace v8::internal | 956 } } // namespace v8::internal |
| 949 | 957 |
| 950 #endif // V8_OBJECTS_VISITING_INL_H_ | 958 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |