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

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

Issue 1408923005: Add IsMutatorThread to the Thread class and use it instead of MutatorThreadIsCurrentThread (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
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 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 } 1823 }
1824 1824
1825 1825
1826 RawObject* Object::Allocate(intptr_t cls_id, 1826 RawObject* Object::Allocate(intptr_t cls_id,
1827 intptr_t size, 1827 intptr_t size,
1828 Heap::Space space) { 1828 Heap::Space space) {
1829 ASSERT(Utils::IsAligned(size, kObjectAlignment)); 1829 ASSERT(Utils::IsAligned(size, kObjectAlignment));
1830 Thread* thread = Thread::Current(); 1830 Thread* thread = Thread::Current();
1831 Isolate* isolate = thread->isolate(); 1831 Isolate* isolate = thread->isolate();
1832 // New space allocation allowed only in mutator thread (Dart thread); 1832 // New space allocation allowed only in mutator thread (Dart thread);
1833 ASSERT(isolate->MutatorThreadIsCurrentThread() || (space != Heap::kNew)); 1833 ASSERT(thread->IsMutatorThread() || (space != Heap::kNew));
1834 ASSERT(thread->no_callback_scope_depth() == 0); 1834 ASSERT(thread->no_callback_scope_depth() == 0);
1835 Heap* heap = isolate->heap(); 1835 Heap* heap = isolate->heap();
1836 1836
1837 uword address = heap->Allocate(size, space); 1837 uword address = heap->Allocate(size, space);
1838 if (address == 0) { 1838 if (address == 0) {
1839 // Use the preallocated out of memory exception to avoid calling 1839 // Use the preallocated out of memory exception to avoid calling
1840 // into dart code or allocating any code. 1840 // into dart code or allocating any code.
1841 const Instance& exception = 1841 const Instance& exception =
1842 Instance::Handle(isolate->object_store()->out_of_memory()); 1842 Instance::Handle(isolate->object_store()->out_of_memory());
1843 Exceptions::Throw(thread, exception); 1843 Exceptions::Throw(thread, exception);
(...skipping 19912 matching lines...) Expand 10 before | Expand all | Expand 10 after
21756 return tag_label.ToCString(); 21756 return tag_label.ToCString();
21757 } 21757 }
21758 21758
21759 21759
21760 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21760 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21761 Instance::PrintJSONImpl(stream, ref); 21761 Instance::PrintJSONImpl(stream, ref);
21762 } 21762 }
21763 21763
21764 21764
21765 } // namespace dart 21765 } // namespace dart
OLDNEW
« runtime/vm/debugger.h ('K') | « runtime/vm/longjump.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698