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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 RawClass* raw_class = isolate->class_table()->At(GetClassId()); | 62 RawClass* raw_class = isolate->class_table()->At(GetClassId()); |
63 intptr_t instance_size = | 63 intptr_t instance_size = |
64 raw_class->ptr()->instance_size_in_words_ << kWordSizeLog2; | 64 raw_class->ptr()->instance_size_in_words_ << kWordSizeLog2; |
65 intptr_t class_id = raw_class->ptr()->id_; | 65 intptr_t class_id = raw_class->ptr()->id_; |
66 | 66 |
67 if (instance_size == 0) { | 67 if (instance_size == 0) { |
68 switch (class_id) { | 68 switch (class_id) { |
69 case kCodeCid: { | 69 case kCodeCid: { |
70 const RawCode* raw_code = reinterpret_cast<const RawCode*>(this); | 70 const RawCode* raw_code = reinterpret_cast<const RawCode*>(this); |
71 intptr_t pointer_offsets_length = | 71 intptr_t pointer_offsets_length = |
72 raw_code->ptr()->pointer_offsets_length_; | 72 Code::PtrOffBits::decode(raw_code->ptr()->state_bits_); |
73 instance_size = Code::InstanceSize(pointer_offsets_length); | 73 instance_size = Code::InstanceSize(pointer_offsets_length); |
74 break; | 74 break; |
75 } | 75 } |
76 case kInstructionsCid: { | 76 case kInstructionsCid: { |
77 const RawInstructions* raw_instructions = | 77 const RawInstructions* raw_instructions = |
78 reinterpret_cast<const RawInstructions*>(this); | 78 reinterpret_cast<const RawInstructions*>(this); |
79 intptr_t instructions_size = raw_instructions->ptr()->size_; | 79 intptr_t instructions_size = raw_instructions->ptr()->size_; |
80 instance_size = Instructions::InstanceSize(instructions_size); | 80 instance_size = Instructions::InstanceSize(instructions_size); |
81 break; | 81 break; |
82 } | 82 } |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 458 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
459 return Namespace::InstanceSize(); | 459 return Namespace::InstanceSize(); |
460 } | 460 } |
461 | 461 |
462 | 462 |
463 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, | 463 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, |
464 ObjectPointerVisitor* visitor) { | 464 ObjectPointerVisitor* visitor) { |
465 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 465 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
466 | 466 |
467 RawCode* obj = raw_obj->ptr(); | 467 RawCode* obj = raw_obj->ptr(); |
468 intptr_t length = obj->pointer_offsets_length_; | 468 intptr_t length = Code::PtrOffBits::decode(obj->state_bits_); |
469 if (Code::AliveBit::decode(obj->state_bits_)) { | 469 if (Code::AliveBit::decode(obj->state_bits_)) { |
470 // Also visit all the embedded pointers in the corresponding instructions. | 470 // Also visit all the embedded pointers in the corresponding instructions. |
471 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + | 471 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + |
472 Instructions::HeaderSize(); | 472 Instructions::HeaderSize(); |
473 for (intptr_t i = 0; i < length; i++) { | 473 for (intptr_t i = 0; i < length; i++) { |
474 int32_t offset = obj->data()[i]; | 474 int32_t offset = obj->data()[i]; |
475 visitor->VisitPointer( | 475 visitor->VisitPointer( |
476 reinterpret_cast<RawObject**>(entry_point + offset)); | 476 reinterpret_cast<RawObject**>(entry_point + offset)); |
477 } | 477 } |
478 } | 478 } |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 intptr_t RawUserTag::VisitUserTagPointers( | 888 intptr_t RawUserTag::VisitUserTagPointers( |
889 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { | 889 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { |
890 // Make sure that we got here with the tagged pointer as this. | 890 // Make sure that we got here with the tagged pointer as this. |
891 ASSERT(raw_obj->IsHeapObject()); | 891 ASSERT(raw_obj->IsHeapObject()); |
892 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 892 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
893 return UserTag::InstanceSize(); | 893 return UserTag::InstanceSize(); |
894 } | 894 } |
895 | 895 |
896 | 896 |
897 } // namespace dart | 897 } // namespace dart |
OLD | NEW |