| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/isolate.h" | 7 #include "vm/isolate.h" |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/visitor.h" | 9 #include "vm/visitor.h" |
| 10 | 10 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 intptr_t RawInstance::VisitInstancePointers(RawInstance* raw_obj, | 370 intptr_t RawInstance::VisitInstancePointers(RawInstance* raw_obj, |
| 371 ObjectPointerVisitor* visitor) { | 371 ObjectPointerVisitor* visitor) { |
| 372 // Make sure that we got here with the tagged pointer as this. | 372 // Make sure that we got here with the tagged pointer as this. |
| 373 ASSERT(raw_obj->IsHeapObject()); | 373 ASSERT(raw_obj->IsHeapObject()); |
| 374 RawInstance* obj = raw_obj->ptr(); | 374 RawInstance* obj = raw_obj->ptr(); |
| 375 intptr_t instance_size = obj->class_->ptr()->instance_size_; | 375 intptr_t instance_size = obj->class_->ptr()->instance_size_; |
| 376 intptr_t num_native_fields = obj->class_->ptr()->num_native_fields_; | 376 intptr_t num_native_fields = obj->class_->ptr()->num_native_fields_; |
| 377 | 377 |
| 378 // Calculate the first and last raw object pointer fields. | 378 // Calculate the first and last raw object pointer fields. |
| 379 uword obj_addr = RawObject::ToAddr(raw_obj); | 379 uword obj_addr = RawObject::ToAddr(raw_obj); |
| 380 uword from = obj_addr + ((num_native_fields + 1) * kWordSize); | 380 uword from = obj_addr + sizeof(RawObject) + num_native_fields * kWordSize; |
| 381 uword to = obj_addr + instance_size - kWordSize; | 381 uword to = obj_addr + instance_size - kWordSize; |
| 382 visitor->VisitPointers(reinterpret_cast<RawObject**>(from), | 382 visitor->VisitPointers(reinterpret_cast<RawObject**>(from), |
| 383 reinterpret_cast<RawObject**>(to)); | 383 reinterpret_cast<RawObject**>(to)); |
| 384 return instance_size; | 384 return instance_size; |
| 385 } | 385 } |
| 386 | 386 |
| 387 | 387 |
| 388 intptr_t RawNumber::VisitNumberPointers(RawNumber* raw_obj, | 388 intptr_t RawNumber::VisitNumberPointers(RawNumber* raw_obj, |
| 389 ObjectPointerVisitor* visitor) { | 389 ObjectPointerVisitor* visitor) { |
| 390 // Number is an abstract class. | 390 // Number is an abstract class. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, | 545 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, |
| 546 ObjectPointerVisitor* visitor) { | 546 ObjectPointerVisitor* visitor) { |
| 547 // Make sure that we got here with the tagged pointer as this. | 547 // Make sure that we got here with the tagged pointer as this. |
| 548 ASSERT(raw_obj->IsHeapObject()); | 548 ASSERT(raw_obj->IsHeapObject()); |
| 549 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); | 549 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); |
| 550 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 550 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 551 return JSRegExp::InstanceSize(length); | 551 return JSRegExp::InstanceSize(length); |
| 552 } | 552 } |
| 553 | 553 |
| 554 } // namespace dart | 554 } // namespace dart |
| OLD | NEW |