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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 #endif | 1819 #endif |
1820 } | 1820 } |
1821 | 1821 |
1822 | 1822 |
1823 RawObject* Object::Allocate(intptr_t cls_id, | 1823 RawObject* Object::Allocate(intptr_t cls_id, |
1824 intptr_t size, | 1824 intptr_t size, |
1825 Heap::Space space) { | 1825 Heap::Space space) { |
1826 ASSERT(Utils::IsAligned(size, kObjectAlignment)); | 1826 ASSERT(Utils::IsAligned(size, kObjectAlignment)); |
1827 Thread* thread = Thread::Current(); | 1827 Thread* thread = Thread::Current(); |
1828 Isolate* isolate = thread->isolate(); | 1828 Isolate* isolate = thread->isolate(); |
1829 ASSERT(isolate->no_callback_scope_depth() == 0); | 1829 // New space allocation allowed only in mutator thread (Dart thread); |
| 1830 ASSERT(isolate->MutatorThreadIsCurrentThread() || (space != Heap::kNew)); |
| 1831 ASSERT(thread->no_callback_scope_depth() == 0); |
1830 Heap* heap = isolate->heap(); | 1832 Heap* heap = isolate->heap(); |
1831 | 1833 |
1832 uword address = heap->Allocate(size, space); | 1834 uword address = heap->Allocate(size, space); |
1833 if (address == 0) { | 1835 if (address == 0) { |
1834 // Use the preallocated out of memory exception to avoid calling | 1836 // Use the preallocated out of memory exception to avoid calling |
1835 // into dart code or allocating any code. | 1837 // into dart code or allocating any code. |
1836 const Instance& exception = | 1838 const Instance& exception = |
1837 Instance::Handle(isolate->object_store()->out_of_memory()); | 1839 Instance::Handle(isolate->object_store()->out_of_memory()); |
1838 Exceptions::Throw(thread, exception); | 1840 Exceptions::Throw(thread, exception); |
1839 UNREACHABLE(); | 1841 UNREACHABLE(); |
(...skipping 19726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21566 return tag_label.ToCString(); | 21568 return tag_label.ToCString(); |
21567 } | 21569 } |
21568 | 21570 |
21569 | 21571 |
21570 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21572 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21571 Instance::PrintJSONImpl(stream, ref); | 21573 Instance::PrintJSONImpl(stream, ref); |
21572 } | 21574 } |
21573 | 21575 |
21574 | 21576 |
21575 } // namespace dart | 21577 } // namespace dart |
OLD | NEW |