| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 return (addr >= this_addr) && (addr < (this_addr + this_size)); | 425 return (addr >= this_addr) && (addr < (this_addr + this_size)); |
| 426 } | 426 } |
| 427 | 427 |
| 428 template<typename type> void StorePointer(type* addr, type value) const { | 428 template<typename type> void StorePointer(type* addr, type value) const { |
| 429 // Ensure that this object contains the addr. | 429 // Ensure that this object contains the addr. |
| 430 ASSERT(Contains(reinterpret_cast<uword>(addr))); | 430 ASSERT(Contains(reinterpret_cast<uword>(addr))); |
| 431 *addr = value; | 431 *addr = value; |
| 432 // Filter stores based on source and target. | 432 // Filter stores based on source and target. |
| 433 if (!value->IsHeapObject()) return; | 433 if (!value->IsHeapObject()) return; |
| 434 if (value->IsNewObject() && raw()->IsOldObject()) { | 434 if (value->IsNewObject() && raw()->IsOldObject()) { |
| 435 uword ptr = reinterpret_cast<uword>(addr); | 435 uword ptr = reinterpret_cast<uword>(raw()); |
| 436 Isolate::Current()->store_buffer()->AddPointer(ptr); | 436 Isolate::Current()->store_buffer()->AddPointer(ptr); |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 | 439 |
| 440 RawObject* raw_; // The raw object reference. | 440 RawObject* raw_; // The raw object reference. |
| 441 | 441 |
| 442 private: | 442 private: |
| 443 static void InitializeObject(uword address, intptr_t id, intptr_t size); | 443 static void InitializeObject(uword address, intptr_t id, intptr_t size); |
| 444 | 444 |
| 445 static void RegisterClass(const Class& cls, | 445 static void RegisterClass(const Class& cls, |
| (...skipping 4477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4923 uword data_addr = RawObject::ToAddr(data()); | 4923 uword data_addr = RawObject::ToAddr(data()); |
| 4924 return (addr >= data_addr) && (addr < (data_addr + data_size)); | 4924 return (addr >= data_addr) && (addr < (data_addr + data_size)); |
| 4925 } | 4925 } |
| 4926 void DataStorePointer(RawObject** addr, RawObject* value) const { | 4926 void DataStorePointer(RawObject** addr, RawObject* value) const { |
| 4927 // Ensure that the backing array object contains the addr. | 4927 // Ensure that the backing array object contains the addr. |
| 4928 ASSERT(DataContains(reinterpret_cast<uword>(addr))); | 4928 ASSERT(DataContains(reinterpret_cast<uword>(addr))); |
| 4929 *addr = value; | 4929 *addr = value; |
| 4930 // Filter stores based on source and target. | 4930 // Filter stores based on source and target. |
| 4931 if (!value->IsHeapObject()) return; | 4931 if (!value->IsHeapObject()) return; |
| 4932 if (value->IsNewObject() && data()->IsOldObject()) { | 4932 if (value->IsNewObject() && data()->IsOldObject()) { |
| 4933 uword ptr = reinterpret_cast<uword>(addr); | 4933 uword ptr = reinterpret_cast<uword>(data()); |
| 4934 Isolate::Current()->store_buffer()->AddPointer(ptr); | 4934 Isolate::Current()->store_buffer()->AddPointer(ptr); |
| 4935 } | 4935 } |
| 4936 } | 4936 } |
| 4937 | 4937 |
| 4938 static const int kDefaultInitialCapacity = 4; | 4938 static const int kDefaultInitialCapacity = 4; |
| 4939 | 4939 |
| 4940 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); | 4940 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); |
| 4941 friend class Array; | 4941 friend class Array; |
| 4942 friend class Class; | 4942 friend class Class; |
| 4943 }; | 4943 }; |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5567 | 5567 |
| 5568 | 5568 |
| 5569 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 5569 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 5570 intptr_t index) { | 5570 intptr_t index) { |
| 5571 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 5571 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 5572 } | 5572 } |
| 5573 | 5573 |
| 5574 } // namespace dart | 5574 } // namespace dart |
| 5575 | 5575 |
| 5576 #endif // VM_OBJECT_H_ | 5576 #endif // VM_OBJECT_H_ |
| OLD | NEW |