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