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

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

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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 public: 1217 public:
1218 explicit StoreBufferUpdateVisitor(Isolate* isolate, RawObject* obj) : 1218 explicit StoreBufferUpdateVisitor(Isolate* isolate, RawObject* obj) :
1219 ObjectPointerVisitor(isolate), old_obj_(obj) { 1219 ObjectPointerVisitor(isolate), old_obj_(obj) {
1220 ASSERT(old_obj_->IsOldObject()); 1220 ASSERT(old_obj_->IsOldObject());
1221 } 1221 }
1222 1222
1223 void VisitPointers(RawObject** first, RawObject** last) { 1223 void VisitPointers(RawObject** first, RawObject** last) {
1224 for (RawObject** curr = first; curr <= last; ++curr) { 1224 for (RawObject** curr = first; curr <= last; ++curr) {
1225 RawObject* raw_obj = *curr; 1225 RawObject* raw_obj = *curr;
1226 if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) { 1226 if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) {
1227 uword ptr = reinterpret_cast<uword>(old_obj_); 1227 old_obj_->SetRememberedBit();
1228 isolate()->store_buffer()->AddPointer(ptr); 1228 isolate()->store_buffer()->AddObject(old_obj_);
1229 // Remembered this object. There is no need to continue searching. 1229 // Remembered this object. There is no need to continue searching.
1230 return; 1230 return;
1231 } 1231 }
1232 } 1232 }
1233 } 1233 }
1234 1234
1235 private: 1235 private:
1236 RawObject* old_obj_; 1236 RawObject* old_obj_;
1237 1237
1238 DISALLOW_COPY_AND_ASSIGN(StoreBufferUpdateVisitor); 1238 DISALLOW_COPY_AND_ASSIGN(StoreBufferUpdateVisitor);
(...skipping 10 matching lines...) Expand all
1249 } 1249 }
1250 1250
1251 1251
1252 1252
1253 RawObject* Object::Clone(const Object& src, Heap::Space space) { 1253 RawObject* Object::Clone(const Object& src, Heap::Space space) {
1254 const Class& cls = Class::Handle(src.clazz()); 1254 const Class& cls = Class::Handle(src.clazz());
1255 intptr_t size = src.raw()->Size(); 1255 intptr_t size = src.raw()->Size();
1256 RawObject* raw_obj = Object::Allocate(cls.id(), size, space); 1256 RawObject* raw_obj = Object::Allocate(cls.id(), size, space);
1257 NoGCScope no_gc; 1257 NoGCScope no_gc;
1258 memmove(raw_obj->ptr(), src.raw()->ptr(), size); 1258 memmove(raw_obj->ptr(), src.raw()->ptr(), size);
1259 if (space == Heap::kOld) { 1259 if ((space == Heap::kOld) && !raw_obj->IsRemembered()) {
1260 StoreBufferUpdateVisitor visitor(Isolate::Current(), raw_obj); 1260 StoreBufferUpdateVisitor visitor(Isolate::Current(), raw_obj);
1261 raw_obj->VisitPointers(&visitor); 1261 raw_obj->VisitPointers(&visitor);
1262 } 1262 }
1263 return raw_obj; 1263 return raw_obj;
1264 } 1264 }
1265 1265
1266 1266
1267 RawString* Class::Name() const { 1267 RawString* Class::Name() const {
1268 ASSERT(raw_ptr()->name_ != String::null()); 1268 ASSERT(raw_ptr()->name_ != String::null());
1269 return raw_ptr()->name_; 1269 return raw_ptr()->name_;
(...skipping 11955 matching lines...) Expand 10 before | Expand all | Expand 10 after
13225 } 13225 }
13226 return result.raw(); 13226 return result.raw();
13227 } 13227 }
13228 13228
13229 13229
13230 const char* WeakProperty::ToCString() const { 13230 const char* WeakProperty::ToCString() const {
13231 return "_WeakProperty"; 13231 return "_WeakProperty";
13232 } 13232 }
13233 13233
13234 } // namespace dart 13234 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698