| 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. | |
| 549 if (Code::AliveBit::decode(obj->state_bits_)) { | 545 if (Code::AliveBit::decode(obj->state_bits_)) { |
| 546 // Also visit all the embedded pointers in the corresponding instructions. |
| 550 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + | 547 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + |
| 551 Instructions::HeaderSize(); | 548 Instructions::HeaderSize(); |
| 552 for (intptr_t i = 0; i < length; i++) { | 549 for (intptr_t i = 0; i < length; i++) { |
| 553 int32_t offset = obj->data()[i]; | 550 int32_t offset = obj->data()[i]; |
| 554 visitor->VisitPointer( | 551 visitor->VisitPointer( |
| 555 reinterpret_cast<RawObject**>(entry_point + offset)); | 552 reinterpret_cast<RawObject**>(entry_point + offset)); |
| 556 } | 553 } |
| 557 } | 554 } |
| 558 return Code::InstanceSize(length); | 555 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 | |
| 565 } | 556 } |
| 566 | 557 |
| 567 | 558 |
| 568 intptr_t RawObjectPool::VisitObjectPoolPointers( | 559 intptr_t RawObjectPool::VisitObjectPoolPointers( |
| 569 RawObjectPool* raw_obj, ObjectPointerVisitor* visitor) { | 560 RawObjectPool* raw_obj, ObjectPointerVisitor* visitor) { |
| 570 visitor->VisitPointer( | 561 visitor->VisitPointer( |
| 571 reinterpret_cast<RawObject**>(&raw_obj->ptr()->info_array_)); | 562 reinterpret_cast<RawObject**>(&raw_obj->ptr()->info_array_)); |
| 572 const intptr_t len = raw_obj->ptr()->length_; | 563 const intptr_t len = raw_obj->ptr()->length_; |
| 573 RawTypedData* info_array = raw_obj->ptr()->info_array_->ptr(); | 564 RawTypedData* info_array = raw_obj->ptr()->info_array_->ptr(); |
| 574 Entry* first = raw_obj->first_entry(); | 565 Entry* first = raw_obj->first_entry(); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 intptr_t RawUserTag::VisitUserTagPointers( | 961 intptr_t RawUserTag::VisitUserTagPointers( |
| 971 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { | 962 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { |
| 972 // Make sure that we got here with the tagged pointer as this. | 963 // Make sure that we got here with the tagged pointer as this. |
| 973 ASSERT(raw_obj->IsHeapObject()); | 964 ASSERT(raw_obj->IsHeapObject()); |
| 974 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 965 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 975 return UserTag::InstanceSize(); | 966 return UserTag::InstanceSize(); |
| 976 } | 967 } |
| 977 | 968 |
| 978 | 969 |
| 979 } // namespace dart | 970 } // namespace dart |
| OLD | NEW |