| 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 = raw_instructions->ptr()->size_; | 71 intptr_t instructions_size = abs(raw_instructions->ptr()->size_); |
| 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 = | 76 const RawContext* raw_context = |
| 77 reinterpret_cast<const RawContext*>(this); | 77 reinterpret_cast<const RawContext*>(this); |
| 78 intptr_t num_variables = raw_context->ptr()->num_variables_; | 78 intptr_t num_variables = raw_context->ptr()->num_variables_; |
| 79 instance_size = Context::InstanceSize(num_variables); | 79 instance_size = Context::InstanceSize(num_variables); |
| 80 break; | 80 break; |
| 81 } | 81 } |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 visitor->VisitPointer(&(first + i)->raw_obj_); | 567 visitor->VisitPointer(&(first + i)->raw_obj_); |
| 568 } | 568 } |
| 569 } | 569 } |
| 570 return ObjectPool::InstanceSize(raw_obj->ptr()->length_); | 570 return ObjectPool::InstanceSize(raw_obj->ptr()->length_); |
| 571 } | 571 } |
| 572 | 572 |
| 573 | 573 |
| 574 intptr_t RawInstructions::VisitInstructionsPointers( | 574 intptr_t RawInstructions::VisitInstructionsPointers( |
| 575 RawInstructions* raw_obj, ObjectPointerVisitor* visitor) { | 575 RawInstructions* raw_obj, ObjectPointerVisitor* visitor) { |
| 576 RawInstructions* obj = raw_obj->ptr(); | 576 RawInstructions* obj = raw_obj->ptr(); |
| 577 return Instructions::InstanceSize(obj->size_); | 577 return Instructions::InstanceSize(abs(obj->size_)); |
| 578 } | 578 } |
| 579 | 579 |
| 580 | 580 |
| 581 bool RawInstructions::ContainsPC(RawInstructions* raw_instr, uword pc) { | 581 bool RawInstructions::ContainsPC(RawInstructions* raw_instr, uword pc) { |
| 582 uword start_pc = | 582 uword start_pc = |
| 583 reinterpret_cast<uword>(raw_instr->ptr()) + Instructions::HeaderSize(); | 583 reinterpret_cast<uword>(raw_instr->ptr()) + Instructions::HeaderSize(); |
| 584 uword end_pc = start_pc + raw_instr->ptr()->size_; | 584 uword end_pc = start_pc + abs(raw_instr->ptr()->size_); |
| 585 ASSERT(end_pc > start_pc); | 585 ASSERT(end_pc > start_pc); |
| 586 return (pc >= start_pc) && (pc < end_pc); | 586 return (pc >= start_pc) && (pc < end_pc); |
| 587 } | 587 } |
| 588 | 588 |
| 589 | 589 |
| 590 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( | 590 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( |
| 591 RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) { | 591 RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) { |
| 592 return PcDescriptors::InstanceSize(raw_obj->ptr()->length_); | 592 return PcDescriptors::InstanceSize(raw_obj->ptr()->length_); |
| 593 } | 593 } |
| 594 | 594 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 intptr_t RawUserTag::VisitUserTagPointers( | 971 intptr_t RawUserTag::VisitUserTagPointers( |
| 972 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { | 972 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { |
| 973 // Make sure that we got here with the tagged pointer as this. | 973 // Make sure that we got here with the tagged pointer as this. |
| 974 ASSERT(raw_obj->IsHeapObject()); | 974 ASSERT(raw_obj->IsHeapObject()); |
| 975 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 975 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 976 return UserTag::InstanceSize(); | 976 return UserTag::InstanceSize(); |
| 977 } | 977 } |
| 978 | 978 |
| 979 | 979 |
| 980 } // namespace dart | 980 } // namespace dart |
| OLD | NEW |