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

Side by Side Diff: runtime/vm/object.h

Issue 14307013: - Remember the fact that an object has been added to the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 #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
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 !raw()->IsRemembered()) {
445 raw()->SetRememberedBit();
444 uword ptr = reinterpret_cast<uword>(raw()); 446 uword ptr = reinterpret_cast<uword>(raw());
445 Isolate::Current()->store_buffer()->AddPointer(ptr); 447 Isolate::Current()->store_buffer()->AddPointer(ptr);
446 } 448 }
447 } 449 }
448 450
449 RawObject* raw_; // The raw object reference. 451 RawObject* raw_; // The raw object reference.
450 452
451 private: 453 private:
452 static void InitializeObject(uword address, intptr_t id, intptr_t size); 454 static void InitializeObject(uword address, intptr_t id, intptr_t size);
453 455
(...skipping 4502 matching lines...) Expand 10 before | Expand all | Expand 10 after
4956 intptr_t data_size = data()->Size(); 4958 intptr_t data_size = data()->Size();
4957 uword data_addr = RawObject::ToAddr(data()); 4959 uword data_addr = RawObject::ToAddr(data());
4958 return (addr >= data_addr) && (addr < (data_addr + data_size)); 4960 return (addr >= data_addr) && (addr < (data_addr + data_size));
4959 } 4961 }
4960 void DataStorePointer(RawObject** addr, RawObject* value) const { 4962 void DataStorePointer(RawObject** addr, RawObject* value) const {
4961 // Ensure that the backing array object contains the addr. 4963 // Ensure that the backing array object contains the addr.
4962 ASSERT(DataContains(reinterpret_cast<uword>(addr))); 4964 ASSERT(DataContains(reinterpret_cast<uword>(addr)));
4963 *addr = value; 4965 *addr = value;
4964 // Filter stores based on source and target. 4966 // Filter stores based on source and target.
4965 if (!value->IsHeapObject()) return; 4967 if (!value->IsHeapObject()) return;
4966 if (value->IsNewObject() && data()->IsOldObject()) { 4968 if (value->IsNewObject() && data()->IsOldObject() &&
4969 !data()->IsRemembered()) {
4970 data()->SetRememberedBit();
4967 uword ptr = reinterpret_cast<uword>(data()); 4971 uword ptr = reinterpret_cast<uword>(data());
4968 Isolate::Current()->store_buffer()->AddPointer(ptr); 4972 Isolate::Current()->store_buffer()->AddPointer(ptr);
4969 } 4973 }
4970 } 4974 }
4971 4975
4972 static const int kDefaultInitialCapacity = 4; 4976 static const int kDefaultInitialCapacity = 4;
4973 4977
4974 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); 4978 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance);
4975 friend class Array; 4979 friend class Array;
4976 friend class Class; 4980 friend class Class;
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
5711 5715
5712 5716
5713 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 5717 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
5714 intptr_t index) { 5718 intptr_t index) {
5715 return array.At((index * kEntryLength) + kTargetFunctionIndex); 5719 return array.At((index * kEntryLength) + kTargetFunctionIndex);
5716 } 5720 }
5717 5721
5718 } // namespace dart 5722 } // namespace dart
5719 5723
5720 #endif // VM_OBJECT_H_ 5724 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/gc_marker.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/raw_object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698