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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 return false; | 535 return false; |
536 } | 536 } |
537 | 537 |
538 | 538 |
539 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, | 539 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, |
540 ObjectPointerVisitor* visitor) { | 540 ObjectPointerVisitor* visitor) { |
541 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 541 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
542 | 542 |
543 RawCode* obj = raw_obj->ptr(); | 543 RawCode* obj = raw_obj->ptr(); |
544 intptr_t length = Code::PtrOffBits::decode(obj->state_bits_); | 544 intptr_t length = Code::PtrOffBits::decode(obj->state_bits_); |
| 545 #if defined(TARGET_ARCH_IA32) |
| 546 // On IA32 only we embed pointers to objects directly in the generated |
| 547 // instructions. The variable porition of a Code object describes where to |
| 548 // find those pointers for tracing. |
545 if (Code::AliveBit::decode(obj->state_bits_)) { | 549 if (Code::AliveBit::decode(obj->state_bits_)) { |
546 // Also visit all the embedded pointers in the corresponding instructions. | |
547 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + | 550 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + |
548 Instructions::HeaderSize(); | 551 Instructions::HeaderSize(); |
549 for (intptr_t i = 0; i < length; i++) { | 552 for (intptr_t i = 0; i < length; i++) { |
550 int32_t offset = obj->data()[i]; | 553 int32_t offset = obj->data()[i]; |
551 visitor->VisitPointer( | 554 visitor->VisitPointer( |
552 reinterpret_cast<RawObject**>(entry_point + offset)); | 555 reinterpret_cast<RawObject**>(entry_point + offset)); |
553 } | 556 } |
554 } | 557 } |
555 return Code::InstanceSize(length); | 558 return Code::InstanceSize(length); |
| 559 #else |
| 560 // On all other architectures, objects are referenced indirectly through |
| 561 // either the ObjectPool or Thread. |
| 562 ASSERT(length == 0); |
| 563 return Code::InstanceSize(0); |
| 564 #endif |
556 } | 565 } |
557 | 566 |
558 | 567 |
559 intptr_t RawObjectPool::VisitObjectPoolPointers( | 568 intptr_t RawObjectPool::VisitObjectPoolPointers( |
560 RawObjectPool* raw_obj, ObjectPointerVisitor* visitor) { | 569 RawObjectPool* raw_obj, ObjectPointerVisitor* visitor) { |
561 visitor->VisitPointer( | 570 visitor->VisitPointer( |
562 reinterpret_cast<RawObject**>(&raw_obj->ptr()->info_array_)); | 571 reinterpret_cast<RawObject**>(&raw_obj->ptr()->info_array_)); |
563 const intptr_t len = raw_obj->ptr()->length_; | 572 const intptr_t len = raw_obj->ptr()->length_; |
564 RawTypedData* info_array = raw_obj->ptr()->info_array_->ptr(); | 573 RawTypedData* info_array = raw_obj->ptr()->info_array_->ptr(); |
565 Entry* first = raw_obj->first_entry(); | 574 Entry* first = raw_obj->first_entry(); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 intptr_t RawUserTag::VisitUserTagPointers( | 970 intptr_t RawUserTag::VisitUserTagPointers( |
962 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { | 971 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { |
963 // Make sure that we got here with the tagged pointer as this. | 972 // Make sure that we got here with the tagged pointer as this. |
964 ASSERT(raw_obj->IsHeapObject()); | 973 ASSERT(raw_obj->IsHeapObject()); |
965 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 974 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
966 return UserTag::InstanceSize(); | 975 return UserTag::InstanceSize(); |
967 } | 976 } |
968 | 977 |
969 | 978 |
970 } // namespace dart | 979 } // namespace dart |
OLD | NEW |