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

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

Issue 634443002: Fix Object::Clone heap corruption under concurrent sweeping. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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 | « no previous file | no next file » | 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 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 return (IsZoneHandle() || IsReadOnlyHandle()); 1738 return (IsZoneHandle() || IsReadOnlyHandle());
1739 } 1739 }
1740 1740
1741 1741
1742 1742
1743 RawObject* Object::Clone(const Object& src, Heap::Space space) { 1743 RawObject* Object::Clone(const Object& src, Heap::Space space) {
1744 const Class& cls = Class::Handle(src.clazz()); 1744 const Class& cls = Class::Handle(src.clazz());
1745 intptr_t size = src.raw()->Size(); 1745 intptr_t size = src.raw()->Size();
1746 RawObject* raw_obj = Object::Allocate(cls.id(), size, space); 1746 RawObject* raw_obj = Object::Allocate(cls.id(), size, space);
1747 NoGCScope no_gc; 1747 NoGCScope no_gc;
1748 // Newly allocated objects are white ...
1749 // TODO(koda): This will trip when we start allocating black.
1750 // Update unmarking code below at that point.
1751 ASSERT(!raw_obj->IsMarked());
1748 memmove(raw_obj->ptr(), src.raw()->ptr(), size); 1752 memmove(raw_obj->ptr(), src.raw()->ptr(), size);
1753 // ... so ensure clone is too (see issue 21236).
1754 if (raw_obj->IsMarked()) {
1755 raw_obj->ClearMarkBit();
1756 }
1749 if ((space == Heap::kOld) && !raw_obj->IsRemembered()) { 1757 if ((space == Heap::kOld) && !raw_obj->IsRemembered()) {
Ivan Posva 2014/10/06 05:18:53 We should discuss this condition in person. I am n
koda 2014/10/06 05:35:35 Agreed. In general, this method seems awfully tri
1750 StoreBufferUpdateVisitor visitor(Isolate::Current(), raw_obj); 1758 StoreBufferUpdateVisitor visitor(Isolate::Current(), raw_obj);
1751 raw_obj->VisitPointers(&visitor); 1759 raw_obj->VisitPointers(&visitor);
1752 } 1760 }
1753 return raw_obj; 1761 return raw_obj;
1754 } 1762 }
1755 1763
1756 1764
1757 RawString* Class::Name() const { 1765 RawString* Class::Name() const {
1758 // TODO(turnidge): This assert fails for the fake kFreeListElement class. 1766 // TODO(turnidge): This assert fails for the fake kFreeListElement class.
1759 // Fix this. 1767 // Fix this.
(...skipping 18547 matching lines...) Expand 10 before | Expand all | Expand 10 after
20307 return tag_label.ToCString(); 20315 return tag_label.ToCString();
20308 } 20316 }
20309 20317
20310 20318
20311 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20319 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20312 Instance::PrintJSONImpl(stream, ref); 20320 Instance::PrintJSONImpl(stream, ref);
20313 } 20321 }
20314 20322
20315 20323
20316 } // namespace dart 20324 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698