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/become.h" | 7 #include "vm/become.h" |
8 #include "vm/class_table.h" | 8 #include "vm/class_table.h" |
9 #include "vm/dart.h" | 9 #include "vm/dart.h" |
10 #include "vm/freelist.h" | 10 #include "vm/freelist.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 case kCodeCid: { | 61 case kCodeCid: { |
62 const RawCode* raw_code = reinterpret_cast<const RawCode*>(this); | 62 const RawCode* raw_code = reinterpret_cast<const RawCode*>(this); |
63 intptr_t pointer_offsets_length = | 63 intptr_t pointer_offsets_length = |
64 Code::PtrOffBits::decode(raw_code->ptr()->state_bits_); | 64 Code::PtrOffBits::decode(raw_code->ptr()->state_bits_); |
65 instance_size = Code::InstanceSize(pointer_offsets_length); | 65 instance_size = Code::InstanceSize(pointer_offsets_length); |
66 break; | 66 break; |
67 } | 67 } |
68 case kInstructionsCid: { | 68 case kInstructionsCid: { |
69 const RawInstructions* raw_instructions = | 69 const RawInstructions* raw_instructions = |
70 reinterpret_cast<const RawInstructions*>(this); | 70 reinterpret_cast<const RawInstructions*>(this); |
71 intptr_t instructions_size = abs(raw_instructions->ptr()->size_); | 71 intptr_t instructions_size = Instructions::Size(raw_instructions); |
72 instance_size = Instructions::InstanceSize(instructions_size); | 72 instance_size = Instructions::InstanceSize(instructions_size); |
73 break; | 73 break; |
74 } | 74 } |
75 case kContextCid: { | 75 case kContextCid: { |
76 const RawContext* raw_context = reinterpret_cast<const RawContext*>(this); | 76 const RawContext* raw_context = reinterpret_cast<const RawContext*>(this); |
77 intptr_t num_variables = raw_context->ptr()->num_variables_; | 77 intptr_t num_variables = raw_context->ptr()->num_variables_; |
78 instance_size = Context::InstanceSize(num_variables); | 78 instance_size = Context::InstanceSize(num_variables); |
79 break; | 79 break; |
80 } | 80 } |
81 case kContextScopeCid: { | 81 case kContextScopeCid: { |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 visitor->VisitPointer(&(first + i)->raw_obj_); | 573 visitor->VisitPointer(&(first + i)->raw_obj_); |
574 } | 574 } |
575 } | 575 } |
576 return ObjectPool::InstanceSize(raw_obj->ptr()->length_); | 576 return ObjectPool::InstanceSize(raw_obj->ptr()->length_); |
577 } | 577 } |
578 | 578 |
579 | 579 |
580 intptr_t RawInstructions::VisitInstructionsPointers( | 580 intptr_t RawInstructions::VisitInstructionsPointers( |
581 RawInstructions* raw_obj, | 581 RawInstructions* raw_obj, |
582 ObjectPointerVisitor* visitor) { | 582 ObjectPointerVisitor* visitor) { |
583 RawInstructions* obj = raw_obj->ptr(); | 583 return Instructions::InstanceSize(Instructions::Size(raw_obj)); |
584 return Instructions::InstanceSize(abs(obj->size_)); | |
585 } | 584 } |
586 | 585 |
587 | 586 |
588 bool RawInstructions::ContainsPC(RawInstructions* raw_instr, uword pc) { | 587 bool RawInstructions::ContainsPC(RawInstructions* raw_instr, uword pc) { |
589 uword start_pc = | 588 uword start_pc = |
590 reinterpret_cast<uword>(raw_instr->ptr()) + Instructions::HeaderSize(); | 589 reinterpret_cast<uword>(raw_instr->ptr()) + Instructions::HeaderSize(); |
591 uword end_pc = start_pc + abs(raw_instr->ptr()->size_); | 590 uword end_pc = start_pc + Instructions::Size(raw_instr); |
592 ASSERT(end_pc > start_pc); | 591 ASSERT(end_pc > start_pc); |
593 return (pc >= start_pc) && (pc < end_pc); | 592 return (pc >= start_pc) && (pc < end_pc); |
594 } | 593 } |
595 | 594 |
596 | 595 |
597 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( | 596 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( |
598 RawPcDescriptors* raw_obj, | 597 RawPcDescriptors* raw_obj, |
599 ObjectPointerVisitor* visitor) { | 598 ObjectPointerVisitor* visitor) { |
600 return PcDescriptors::InstanceSize(raw_obj->ptr()->length_); | 599 return PcDescriptors::InstanceSize(raw_obj->ptr()->length_); |
601 } | 600 } |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 intptr_t RawUserTag::VisitUserTagPointers(RawUserTag* raw_obj, | 996 intptr_t RawUserTag::VisitUserTagPointers(RawUserTag* raw_obj, |
998 ObjectPointerVisitor* visitor) { | 997 ObjectPointerVisitor* visitor) { |
999 // Make sure that we got here with the tagged pointer as this. | 998 // Make sure that we got here with the tagged pointer as this. |
1000 ASSERT(raw_obj->IsHeapObject()); | 999 ASSERT(raw_obj->IsHeapObject()); |
1001 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 1000 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
1002 return UserTag::InstanceSize(); | 1001 return UserTag::InstanceSize(); |
1003 } | 1002 } |
1004 | 1003 |
1005 | 1004 |
1006 } // namespace dart | 1005 } // namespace dart |
OLD | NEW |