| 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 #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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 UNREACHABLE(); | 1293 UNREACHABLE(); |
| 1294 } | 1294 } |
| 1295 NoGCScope no_gc; | 1295 NoGCScope no_gc; |
| 1296 InitializeObject(address, cls_id, size); | 1296 InitializeObject(address, cls_id, size); |
| 1297 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); | 1297 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); |
| 1298 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_)); | 1298 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_)); |
| 1299 return raw_obj; | 1299 return raw_obj; |
| 1300 } | 1300 } |
| 1301 | 1301 |
| 1302 | 1302 |
| 1303 class StoreBufferObjectPointerVisitor : public ObjectPointerVisitor { | 1303 class StoreBufferUpdateVisitor : public ObjectPointerVisitor { |
| 1304 public: | 1304 public: |
| 1305 explicit StoreBufferObjectPointerVisitor(Isolate* isolate) : | 1305 explicit StoreBufferUpdateVisitor(Isolate* isolate) : |
| 1306 ObjectPointerVisitor(isolate) { | 1306 ObjectPointerVisitor(isolate) { } |
| 1307 } | 1307 |
| 1308 void VisitPointers(RawObject** first, RawObject** last) { | 1308 void VisitPointers(RawObject** first, RawObject** last) { |
| 1309 for (RawObject** curr = first; curr <= last; ++curr) { | 1309 for (RawObject** curr = first; curr <= last; ++curr) { |
| 1310 if ((*curr)->IsNewObject()) { | 1310 RawObject* raw_obj = *curr; |
| 1311 if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) { |
| 1311 uword ptr = reinterpret_cast<uword>(curr); | 1312 uword ptr = reinterpret_cast<uword>(curr); |
| 1312 isolate()->store_buffer()->AddPointer(ptr); | 1313 isolate()->store_buffer()->AddPointer(ptr); |
| 1313 } | 1314 } |
| 1314 } | 1315 } |
| 1315 } | 1316 } |
| 1316 | 1317 |
| 1317 private: | 1318 private: |
| 1318 DISALLOW_COPY_AND_ASSIGN(StoreBufferObjectPointerVisitor); | 1319 DISALLOW_COPY_AND_ASSIGN(StoreBufferUpdateVisitor); |
| 1319 }; | 1320 }; |
| 1320 | 1321 |
| 1321 | 1322 |
| 1322 bool Object::IsReadOnlyHandle() const { | 1323 bool Object::IsReadOnlyHandle() const { |
| 1323 return Dart::IsReadOnlyHandle(reinterpret_cast<uword>(this)); | 1324 return Dart::IsReadOnlyHandle(reinterpret_cast<uword>(this)); |
| 1324 } | 1325 } |
| 1325 | 1326 |
| 1326 | 1327 |
| 1327 bool Object::IsNotTemporaryScopedHandle() const { | 1328 bool Object::IsNotTemporaryScopedHandle() const { |
| 1328 return (IsZoneHandle() || IsReadOnlyHandle()); | 1329 return (IsZoneHandle() || IsReadOnlyHandle()); |
| 1329 } | 1330 } |
| 1330 | 1331 |
| 1331 | 1332 |
| 1332 | 1333 |
| 1333 RawObject* Object::Clone(const Object& src, Heap::Space space) { | 1334 RawObject* Object::Clone(const Object& src, Heap::Space space) { |
| 1334 const Class& cls = Class::Handle(src.clazz()); | 1335 const Class& cls = Class::Handle(src.clazz()); |
| 1335 intptr_t size = src.raw()->Size(); | 1336 intptr_t size = src.raw()->Size(); |
| 1336 RawObject* raw_obj = Object::Allocate(cls.id(), size, space); | 1337 RawObject* raw_obj = Object::Allocate(cls.id(), size, space); |
| 1337 NoGCScope no_gc; | 1338 NoGCScope no_gc; |
| 1338 memmove(raw_obj->ptr(), src.raw()->ptr(), size); | 1339 memmove(raw_obj->ptr(), src.raw()->ptr(), size); |
| 1339 if (space == Heap::kOld) { | 1340 if (space == Heap::kOld) { |
| 1340 StoreBufferObjectPointerVisitor visitor(Isolate::Current()); | 1341 StoreBufferUpdateVisitor visitor(Isolate::Current()); |
| 1341 raw_obj->VisitPointers(&visitor); | 1342 raw_obj->VisitPointers(&visitor); |
| 1342 } | 1343 } |
| 1343 return raw_obj; | 1344 return raw_obj; |
| 1344 } | 1345 } |
| 1345 | 1346 |
| 1346 | 1347 |
| 1347 RawString* Class::Name() const { | 1348 RawString* Class::Name() const { |
| 1348 ASSERT(raw_ptr()->name_ != String::null()); | 1349 ASSERT(raw_ptr()->name_ != String::null()); |
| 1349 return raw_ptr()->name_; | 1350 return raw_ptr()->name_; |
| 1350 } | 1351 } |
| (...skipping 11453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12804 } | 12805 } |
| 12805 return result.raw(); | 12806 return result.raw(); |
| 12806 } | 12807 } |
| 12807 | 12808 |
| 12808 | 12809 |
| 12809 const char* WeakProperty::ToCString() const { | 12810 const char* WeakProperty::ToCString() const { |
| 12810 return "_WeakProperty"; | 12811 return "_WeakProperty"; |
| 12811 } | 12812 } |
| 12812 | 12813 |
| 12813 } // namespace dart | 12814 } // namespace dart |
| OLD | NEW |