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

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

Issue 13406004: - Remember objects (not addresses) in the old generation containing new pointers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/scavenger.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 NoGCScope no_gc; 1194 NoGCScope no_gc;
1195 InitializeObject(address, cls_id, size); 1195 InitializeObject(address, cls_id, size);
1196 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); 1196 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag);
1197 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_)); 1197 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_));
1198 return raw_obj; 1198 return raw_obj;
1199 } 1199 }
1200 1200
1201 1201
1202 class StoreBufferUpdateVisitor : public ObjectPointerVisitor { 1202 class StoreBufferUpdateVisitor : public ObjectPointerVisitor {
1203 public: 1203 public:
1204 explicit StoreBufferUpdateVisitor(Isolate* isolate) : 1204 explicit StoreBufferUpdateVisitor(Isolate* isolate, RawObject* obj) :
1205 ObjectPointerVisitor(isolate) { } 1205 ObjectPointerVisitor(isolate), old_obj_(obj) {
1206 ASSERT(old_obj_->IsOldObject());
1207 }
1206 1208
1207 void VisitPointers(RawObject** first, RawObject** last) { 1209 void VisitPointers(RawObject** first, RawObject** last) {
1208 for (RawObject** curr = first; curr <= last; ++curr) { 1210 for (RawObject** curr = first; curr <= last; ++curr) {
1209 RawObject* raw_obj = *curr; 1211 RawObject* raw_obj = *curr;
1210 if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) { 1212 if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) {
1211 uword ptr = reinterpret_cast<uword>(curr); 1213 uword ptr = reinterpret_cast<uword>(old_obj_);
1212 isolate()->store_buffer()->AddPointer(ptr); 1214 isolate()->store_buffer()->AddPointer(ptr);
1215 // Remembered this object. There is not need to continue searching.
siva 2013/04/02 20:20:22 no need ...
Ivan Posva 2013/04/02 23:23:11 Done.
Ivan Posva 2013/04/02 23:23:11 Done.
1216 return;
1213 } 1217 }
1214 } 1218 }
1215 } 1219 }
1216 1220
1217 private: 1221 private:
1222 RawObject* old_obj_;
1223
1218 DISALLOW_COPY_AND_ASSIGN(StoreBufferUpdateVisitor); 1224 DISALLOW_COPY_AND_ASSIGN(StoreBufferUpdateVisitor);
1219 }; 1225 };
1220 1226
1221 1227
1222 bool Object::IsReadOnlyHandle() const { 1228 bool Object::IsReadOnlyHandle() const {
1223 return Dart::IsReadOnlyHandle(reinterpret_cast<uword>(this)); 1229 return Dart::IsReadOnlyHandle(reinterpret_cast<uword>(this));
1224 } 1230 }
1225 1231
1226 1232
1227 bool Object::IsNotTemporaryScopedHandle() const { 1233 bool Object::IsNotTemporaryScopedHandle() const {
1228 return (IsZoneHandle() || IsReadOnlyHandle()); 1234 return (IsZoneHandle() || IsReadOnlyHandle());
1229 } 1235 }
1230 1236
1231 1237
1232 1238
1233 RawObject* Object::Clone(const Object& src, Heap::Space space) { 1239 RawObject* Object::Clone(const Object& src, Heap::Space space) {
1234 const Class& cls = Class::Handle(src.clazz()); 1240 const Class& cls = Class::Handle(src.clazz());
1235 intptr_t size = src.raw()->Size(); 1241 intptr_t size = src.raw()->Size();
1236 RawObject* raw_obj = Object::Allocate(cls.id(), size, space); 1242 RawObject* raw_obj = Object::Allocate(cls.id(), size, space);
1237 NoGCScope no_gc; 1243 NoGCScope no_gc;
1238 memmove(raw_obj->ptr(), src.raw()->ptr(), size); 1244 memmove(raw_obj->ptr(), src.raw()->ptr(), size);
1239 if (space == Heap::kOld) { 1245 if (space == Heap::kOld) {
1240 StoreBufferUpdateVisitor visitor(Isolate::Current()); 1246 StoreBufferUpdateVisitor visitor(Isolate::Current(), raw_obj);
1241 raw_obj->VisitPointers(&visitor); 1247 raw_obj->VisitPointers(&visitor);
1242 } 1248 }
1243 return raw_obj; 1249 return raw_obj;
1244 } 1250 }
1245 1251
1246 1252
1247 RawString* Class::Name() const { 1253 RawString* Class::Name() const {
1248 ASSERT(raw_ptr()->name_ != String::null()); 1254 ASSERT(raw_ptr()->name_ != String::null());
1249 return raw_ptr()->name_; 1255 return raw_ptr()->name_;
1250 } 1256 }
(...skipping 11796 matching lines...) Expand 10 before | Expand all | Expand 10 after
13047 } 13053 }
13048 return result.raw(); 13054 return result.raw();
13049 } 13055 }
13050 13056
13051 13057
13052 const char* WeakProperty::ToCString() const { 13058 const char* WeakProperty::ToCString() const {
13053 return "_WeakProperty"; 13059 return "_WeakProperty";
13054 } 13060 }
13055 13061
13056 } // namespace dart 13062 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/scavenger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698