OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/raw_object.h" | 5 #include "vm/raw_object.h" |
6 | 6 |
7 #include "vm/class_table.h" | 7 #include "vm/class_table.h" |
8 #include "vm/dart.h" | 8 #include "vm/dart.h" |
9 #include "vm/freelist.h" | 9 #include "vm/freelist.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 return false; | 528 return false; |
529 } | 529 } |
530 | 530 |
531 | 531 |
532 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, | 532 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, |
533 ObjectPointerVisitor* visitor) { | 533 ObjectPointerVisitor* visitor) { |
534 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 534 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
535 | 535 |
536 RawCode* obj = raw_obj->ptr(); | 536 RawCode* obj = raw_obj->ptr(); |
537 intptr_t length = Code::PtrOffBits::decode(obj->state_bits_); | 537 intptr_t length = Code::PtrOffBits::decode(obj->state_bits_); |
| 538 #if defined(TARGET_ARCH_IA32) |
| 539 // On IA32 only we embed pointers to objects directly in the generated |
| 540 // instructions. The variable portion of a Code object describes where to |
| 541 // find those pointers for tracing. |
538 if (Code::AliveBit::decode(obj->state_bits_)) { | 542 if (Code::AliveBit::decode(obj->state_bits_)) { |
539 // Also visit all the embedded pointers in the corresponding instructions. | |
540 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + | 543 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + |
541 Instructions::HeaderSize(); | 544 Instructions::HeaderSize(); |
542 for (intptr_t i = 0; i < length; i++) { | 545 for (intptr_t i = 0; i < length; i++) { |
543 int32_t offset = obj->data()[i]; | 546 int32_t offset = obj->data()[i]; |
544 visitor->VisitPointer( | 547 visitor->VisitPointer( |
545 reinterpret_cast<RawObject**>(entry_point + offset)); | 548 reinterpret_cast<RawObject**>(entry_point + offset)); |
546 } | 549 } |
547 } | 550 } |
548 return Code::InstanceSize(length); | 551 return Code::InstanceSize(length); |
| 552 #else |
| 553 // On all other architectures, objects are referenced indirectly through |
| 554 // either an ObjectPool or Thread. |
| 555 ASSERT(length == 0); |
| 556 return Code::InstanceSize(0); |
| 557 #endif |
549 } | 558 } |
550 | 559 |
551 | 560 |
552 intptr_t RawObjectPool::VisitObjectPoolPointers( | 561 intptr_t RawObjectPool::VisitObjectPoolPointers( |
553 RawObjectPool* raw_obj, ObjectPointerVisitor* visitor) { | 562 RawObjectPool* raw_obj, ObjectPointerVisitor* visitor) { |
554 visitor->VisitPointer( | 563 visitor->VisitPointer( |
555 reinterpret_cast<RawObject**>(&raw_obj->ptr()->info_array_)); | 564 reinterpret_cast<RawObject**>(&raw_obj->ptr()->info_array_)); |
556 const intptr_t len = raw_obj->ptr()->length_; | 565 const intptr_t len = raw_obj->ptr()->length_; |
557 RawTypedData* info_array = raw_obj->ptr()->info_array_->ptr(); | 566 RawTypedData* info_array = raw_obj->ptr()->info_array_->ptr(); |
558 Entry* first = raw_obj->first_entry(); | 567 Entry* first = raw_obj->first_entry(); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 intptr_t RawUserTag::VisitUserTagPointers( | 963 intptr_t RawUserTag::VisitUserTagPointers( |
955 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { | 964 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { |
956 // Make sure that we got here with the tagged pointer as this. | 965 // Make sure that we got here with the tagged pointer as this. |
957 ASSERT(raw_obj->IsHeapObject()); | 966 ASSERT(raw_obj->IsHeapObject()); |
958 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 967 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
959 return UserTag::InstanceSize(); | 968 return UserTag::InstanceSize(); |
960 } | 969 } |
961 | 970 |
962 | 971 |
963 } // namespace dart | 972 } // namespace dart |
OLD | NEW |