| 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 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 uword this_addr = RawObject::ToAddr(raw()); | 433 uword this_addr = RawObject::ToAddr(raw()); |
| 434 return (addr >= this_addr) && (addr < (this_addr + this_size)); | 434 return (addr >= this_addr) && (addr < (this_addr + this_size)); |
| 435 } | 435 } |
| 436 | 436 |
| 437 template<typename type> void StorePointer(type* addr, type value) const { | 437 template<typename type> void StorePointer(type* addr, type value) const { |
| 438 // Ensure that this object contains the addr. | 438 // Ensure that this object contains the addr. |
| 439 ASSERT(Contains(reinterpret_cast<uword>(addr))); | 439 ASSERT(Contains(reinterpret_cast<uword>(addr))); |
| 440 *addr = value; | 440 *addr = value; |
| 441 // Filter stores based on source and target. | 441 // Filter stores based on source and target. |
| 442 if (!value->IsHeapObject()) return; | 442 if (!value->IsHeapObject()) return; |
| 443 if (value->IsNewObject() && raw()->IsOldObject()) { | 443 if (value->IsNewObject() && raw()->IsOldObject() && |
| 444 uword ptr = reinterpret_cast<uword>(raw()); | 444 !raw()->IsRemembered()) { |
| 445 Isolate::Current()->store_buffer()->AddPointer(ptr); | 445 raw()->SetRememberedBit(); |
| 446 Isolate::Current()->store_buffer()->AddObject(raw()); |
| 446 } | 447 } |
| 447 } | 448 } |
| 448 | 449 |
| 449 RawObject* raw_; // The raw object reference. | 450 RawObject* raw_; // The raw object reference. |
| 450 | 451 |
| 451 private: | 452 private: |
| 452 static void InitializeObject(uword address, intptr_t id, intptr_t size); | 453 static void InitializeObject(uword address, intptr_t id, intptr_t size); |
| 453 | 454 |
| 454 static void RegisterClass(const Class& cls, | 455 static void RegisterClass(const Class& cls, |
| 455 const String& name, | 456 const String& name, |
| (...skipping 4510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4966 intptr_t data_size = data()->Size(); | 4967 intptr_t data_size = data()->Size(); |
| 4967 uword data_addr = RawObject::ToAddr(data()); | 4968 uword data_addr = RawObject::ToAddr(data()); |
| 4968 return (addr >= data_addr) && (addr < (data_addr + data_size)); | 4969 return (addr >= data_addr) && (addr < (data_addr + data_size)); |
| 4969 } | 4970 } |
| 4970 void DataStorePointer(RawObject** addr, RawObject* value) const { | 4971 void DataStorePointer(RawObject** addr, RawObject* value) const { |
| 4971 // Ensure that the backing array object contains the addr. | 4972 // Ensure that the backing array object contains the addr. |
| 4972 ASSERT(DataContains(reinterpret_cast<uword>(addr))); | 4973 ASSERT(DataContains(reinterpret_cast<uword>(addr))); |
| 4973 *addr = value; | 4974 *addr = value; |
| 4974 // Filter stores based on source and target. | 4975 // Filter stores based on source and target. |
| 4975 if (!value->IsHeapObject()) return; | 4976 if (!value->IsHeapObject()) return; |
| 4976 if (value->IsNewObject() && data()->IsOldObject()) { | 4977 if (value->IsNewObject() && data()->IsOldObject() && |
| 4977 uword ptr = reinterpret_cast<uword>(data()); | 4978 !data()->IsRemembered()) { |
| 4978 Isolate::Current()->store_buffer()->AddPointer(ptr); | 4979 data()->SetRememberedBit(); |
| 4980 Isolate::Current()->store_buffer()->AddObject(data()); |
| 4979 } | 4981 } |
| 4980 } | 4982 } |
| 4981 | 4983 |
| 4982 static const int kDefaultInitialCapacity = 4; | 4984 static const int kDefaultInitialCapacity = 4; |
| 4983 | 4985 |
| 4984 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); | 4986 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); |
| 4985 friend class Array; | 4987 friend class Array; |
| 4986 friend class Class; | 4988 friend class Class; |
| 4987 }; | 4989 }; |
| 4988 | 4990 |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5721 | 5723 |
| 5722 | 5724 |
| 5723 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 5725 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 5724 intptr_t index) { | 5726 intptr_t index) { |
| 5725 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 5727 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 5726 } | 5728 } |
| 5727 | 5729 |
| 5728 } // namespace dart | 5730 } // namespace dart |
| 5729 | 5731 |
| 5730 #endif // VM_OBJECT_H_ | 5732 #endif // VM_OBJECT_H_ |
| OLD | NEW |