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