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

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

Issue 1250463004: Migrate NoSafepointScope; add constrained concurrent allocation to unit test (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Assert current thread is mutator; add shared assertion macro. Created 5 years, 5 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
« no previous file with comments | « runtime/vm/heap_test.cc ('k') | runtime/vm/object.cc » ('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 #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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 // Provides non-const access to non-pointer fields within the object. Such 677 // Provides non-const access to non-pointer fields within the object. Such
678 // access does not need a write barrier, but it is *not* GC-safe, since the 678 // access does not need a write barrier, but it is *not* GC-safe, since the
679 // object might move, hence must be fully contained within a NoSafepointScope. 679 // object might move, hence must be fully contained within a NoSafepointScope.
680 template<typename FieldType> 680 template<typename FieldType>
681 FieldType* UnsafeMutableNonPointer(const FieldType* addr) const { 681 FieldType* UnsafeMutableNonPointer(const FieldType* addr) const {
682 // Allow pointers at the end of variable-length data, and disallow pointers 682 // Allow pointers at the end of variable-length data, and disallow pointers
683 // within the header word. 683 // within the header word.
684 ASSERT(Contains(reinterpret_cast<uword>(addr) - 1) && 684 ASSERT(Contains(reinterpret_cast<uword>(addr) - 1) &&
685 Contains(reinterpret_cast<uword>(addr) - kWordSize)); 685 Contains(reinterpret_cast<uword>(addr) - kWordSize));
686 // At least check that there is a NoSafepointScope and hope it's big enough. 686 // At least check that there is a NoSafepointScope and hope it's big enough.
687 ASSERT(Isolate::Current()->no_safepoint_scope_depth() > 0); 687 ASSERT(Thread::Current()->no_safepoint_scope_depth() > 0);
688 return const_cast<FieldType*>(addr); 688 return const_cast<FieldType*>(addr);
689 } 689 }
690 690
691 // Fail at link time if StoreNonPointer or UnsafeMutableNonPointer is 691 // Fail at link time if StoreNonPointer or UnsafeMutableNonPointer is
692 // instantiated with an object pointer type. 692 // instantiated with an object pointer type.
693 #define STORE_NON_POINTER_ILLEGAL_TYPE(type) \ 693 #define STORE_NON_POINTER_ILLEGAL_TYPE(type) \
694 template<typename ValueType> \ 694 template<typename ValueType> \
695 void StoreNonPointer(Raw##type* const* addr, ValueType value) const { \ 695 void StoreNonPointer(Raw##type* const* addr, ValueType value) const { \
696 UnimplementedMethod(); \ 696 UnimplementedMethod(); \
697 } \ 697 } \
(...skipping 7308 matching lines...) Expand 10 before | Expand all | Expand 10 after
8006 8006
8007 8007
8008 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8008 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8009 intptr_t index) { 8009 intptr_t index) {
8010 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8010 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8011 } 8011 }
8012 8012
8013 } // namespace dart 8013 } // namespace dart
8014 8014
8015 #endif // VM_OBJECT_H_ 8015 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/heap_test.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698