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

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

Issue 11312183: - Do not mix scalar values and object fields in RawInstance to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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/freelist.h" 8 #include "vm/freelist.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 RawUnwindError* raw_obj, ObjectPointerVisitor* visitor) { 586 RawUnwindError* raw_obj, ObjectPointerVisitor* visitor) {
587 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 587 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
588 return UnwindError::InstanceSize(); 588 return UnwindError::InstanceSize();
589 } 589 }
590 590
591 591
592 intptr_t RawInstance::VisitInstancePointers(RawInstance* raw_obj, 592 intptr_t RawInstance::VisitInstancePointers(RawInstance* raw_obj,
593 ObjectPointerVisitor* visitor) { 593 ObjectPointerVisitor* visitor) {
594 // Make sure that we got here with the tagged pointer as this. 594 // Make sure that we got here with the tagged pointer as this.
595 ASSERT(raw_obj->IsHeapObject()); 595 ASSERT(raw_obj->IsHeapObject());
596 RawClass* cls = visitor->isolate()->class_table()->At(raw_obj->GetClassId()); 596 uword tags = raw_obj->ptr()->tags_;
cshapiro 2012/11/12 18:48:45 Any reason we are not just using RawObject::Size()
Ivan Posva 2012/11/12 22:01:03 I tried to keep it as similar as possible to the o
597 intptr_t instance_size = cls->ptr()->instance_size_; 597 intptr_t instance_size = SizeTag::decode(tags);
598 intptr_t num_native_fields = cls->ptr()->num_native_fields_; 598 if (instance_size == 0) {
599 RawClass* cls =
600 visitor->isolate()->class_table()->At(raw_obj->GetClassId());
601 instance_size = cls->ptr()->instance_size_;
602 }
599 603
600 // Calculate the first and last raw object pointer fields. 604 // Calculate the first and last raw object pointer fields.
601 uword obj_addr = RawObject::ToAddr(raw_obj); 605 uword obj_addr = RawObject::ToAddr(raw_obj);
602 uword from = obj_addr + sizeof(RawObject) + num_native_fields * kWordSize; 606 uword from = obj_addr + sizeof(RawObject);
603 uword to = obj_addr + instance_size - kWordSize; 607 uword to = obj_addr + instance_size - kWordSize;
604 visitor->VisitPointers(reinterpret_cast<RawObject**>(from), 608 visitor->VisitPointers(reinterpret_cast<RawObject**>(from),
605 reinterpret_cast<RawObject**>(to)); 609 reinterpret_cast<RawObject**>(to));
606 return instance_size; 610 return instance_size;
607 } 611 }
608 612
609 613
610 intptr_t RawNumber::VisitNumberPointers(RawNumber* raw_obj, 614 intptr_t RawNumber::VisitNumberPointers(RawNumber* raw_obj,
611 ObjectPointerVisitor* visitor) { 615 ObjectPointerVisitor* visitor) {
612 // Number is an abstract class. 616 // Number is an abstract class.
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 959
956 intptr_t RawWeakProperty::VisitWeakPropertyPointers( 960 intptr_t RawWeakProperty::VisitWeakPropertyPointers(
957 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) { 961 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) {
958 // Make sure that we got here with the tagged pointer as this. 962 // Make sure that we got here with the tagged pointer as this.
959 ASSERT(raw_obj->IsHeapObject()); 963 ASSERT(raw_obj->IsHeapObject());
960 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 964 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
961 return WeakProperty::InstanceSize(); 965 return WeakProperty::InstanceSize();
962 } 966 }
963 967
964 } // namespace dart 968 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698