Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: runtime/vm/raw_object.cc

Issue 343803002: Finishes removing intptr_t from raw object fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 RawClass* raw_class = isolate->class_table()->At(GetClassId()); 56 RawClass* raw_class = isolate->class_table()->At(GetClassId());
57 intptr_t instance_size = 57 intptr_t instance_size =
58 raw_class->ptr()->instance_size_in_words_ << kWordSizeLog2; 58 raw_class->ptr()->instance_size_in_words_ << kWordSizeLog2;
59 intptr_t class_id = raw_class->ptr()->id_; 59 intptr_t class_id = raw_class->ptr()->id_;
60 60
61 if (instance_size == 0) { 61 if (instance_size == 0) {
62 switch (class_id) { 62 switch (class_id) {
63 case kCodeCid: { 63 case kCodeCid: {
64 const RawCode* raw_code = reinterpret_cast<const RawCode*>(this); 64 const RawCode* raw_code = reinterpret_cast<const RawCode*>(this);
65 intptr_t pointer_offsets_length = 65 intptr_t pointer_offsets_length =
66 raw_code->ptr()->pointer_offsets_length_; 66 Code::PtrOffBits::decode(raw_code->ptr()->state_bits_);
67 instance_size = Code::InstanceSize(pointer_offsets_length); 67 instance_size = Code::InstanceSize(pointer_offsets_length);
68 break; 68 break;
69 } 69 }
70 case kInstructionsCid: { 70 case kInstructionsCid: {
71 const RawInstructions* raw_instructions = 71 const RawInstructions* raw_instructions =
72 reinterpret_cast<const RawInstructions*>(this); 72 reinterpret_cast<const RawInstructions*>(this);
73 intptr_t instructions_size = raw_instructions->ptr()->size_; 73 intptr_t instructions_size = raw_instructions->ptr()->size_;
74 instance_size = Instructions::InstanceSize(instructions_size); 74 instance_size = Instructions::InstanceSize(instructions_size);
75 break; 75 break;
76 } 76 }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 448 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
449 return Namespace::InstanceSize(); 449 return Namespace::InstanceSize();
450 } 450 }
451 451
452 452
453 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, 453 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj,
454 ObjectPointerVisitor* visitor) { 454 ObjectPointerVisitor* visitor) {
455 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 455 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
456 456
457 RawCode* obj = raw_obj->ptr(); 457 RawCode* obj = raw_obj->ptr();
458 intptr_t length = obj->pointer_offsets_length_; 458 intptr_t length = Code::PtrOffBits::decode(obj->state_bits_);
459 if (Code::AliveBit::decode(obj->state_bits_)) { 459 if (Code::AliveBit::decode(obj->state_bits_)) {
460 // Also visit all the embedded pointers in the corresponding instructions. 460 // Also visit all the embedded pointers in the corresponding instructions.
461 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + 461 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) +
462 Instructions::HeaderSize(); 462 Instructions::HeaderSize();
463 for (intptr_t i = 0; i < length; i++) { 463 for (intptr_t i = 0; i < length; i++) {
464 int32_t offset = obj->data()[i]; 464 int32_t offset = obj->data()[i];
465 visitor->VisitPointer( 465 visitor->VisitPointer(
466 reinterpret_cast<RawObject**>(entry_point + offset)); 466 reinterpret_cast<RawObject**>(entry_point + offset));
467 } 467 }
468 } 468 }
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 intptr_t RawUserTag::VisitUserTagPointers( 864 intptr_t RawUserTag::VisitUserTagPointers(
865 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { 865 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) {
866 // Make sure that we got here with the tagged pointer as this. 866 // Make sure that we got here with the tagged pointer as this.
867 ASSERT(raw_obj->IsHeapObject()); 867 ASSERT(raw_obj->IsHeapObject());
868 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 868 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
869 return UserTag::InstanceSize(); 869 return UserTag::InstanceSize();
870 } 870 }
871 871
872 872
873 } // namespace dart 873 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698