| 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 16 matching lines...) Expand all Loading... |
| 27 #include "vm/exceptions.h" | 27 #include "vm/exceptions.h" |
| 28 #include "vm/flow_graph_builder.h" | 28 #include "vm/flow_graph_builder.h" |
| 29 #include "vm/flow_graph_compiler.h" | 29 #include "vm/flow_graph_compiler.h" |
| 30 #include "vm/growable_array.h" | 30 #include "vm/growable_array.h" |
| 31 #include "vm/hash_table.h" | 31 #include "vm/hash_table.h" |
| 32 #include "vm/heap.h" | 32 #include "vm/heap.h" |
| 33 #include "vm/intermediate_language.h" | 33 #include "vm/intermediate_language.h" |
| 34 #include "vm/intrinsifier.h" | 34 #include "vm/intrinsifier.h" |
| 35 #include "vm/object_store.h" | 35 #include "vm/object_store.h" |
| 36 #include "vm/parser.h" | 36 #include "vm/parser.h" |
| 37 #include "vm/profiler.h" |
| 37 #include "vm/report.h" | 38 #include "vm/report.h" |
| 38 #include "vm/reusable_handles.h" | 39 #include "vm/reusable_handles.h" |
| 39 #include "vm/runtime_entry.h" | 40 #include "vm/runtime_entry.h" |
| 40 #include "vm/scopes.h" | 41 #include "vm/scopes.h" |
| 41 #include "vm/stack_frame.h" | 42 #include "vm/stack_frame.h" |
| 42 #include "vm/symbols.h" | 43 #include "vm/symbols.h" |
| 43 #include "vm/tags.h" | 44 #include "vm/tags.h" |
| 44 #include "vm/timer.h" | 45 #include "vm/timer.h" |
| 45 #include "vm/unicode.h" | 46 #include "vm/unicode.h" |
| 46 #include "vm/verified_memory.h" | 47 #include "vm/verified_memory.h" |
| (...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 | 1725 |
| 1725 uword address = heap->Allocate(size, space); | 1726 uword address = heap->Allocate(size, space); |
| 1726 if (address == 0) { | 1727 if (address == 0) { |
| 1727 // Use the preallocated out of memory exception to avoid calling | 1728 // Use the preallocated out of memory exception to avoid calling |
| 1728 // into dart code or allocating any code. | 1729 // into dart code or allocating any code. |
| 1729 const Instance& exception = | 1730 const Instance& exception = |
| 1730 Instance::Handle(isolate->object_store()->out_of_memory()); | 1731 Instance::Handle(isolate->object_store()->out_of_memory()); |
| 1731 Exceptions::Throw(thread, exception); | 1732 Exceptions::Throw(thread, exception); |
| 1732 UNREACHABLE(); | 1733 UNREACHABLE(); |
| 1733 } | 1734 } |
| 1735 ClassTable* class_table = isolate->class_table(); |
| 1734 if (space == Heap::kNew) { | 1736 if (space == Heap::kNew) { |
| 1735 isolate->class_table()->UpdateAllocatedNew(cls_id, size); | 1737 class_table->UpdateAllocatedNew(cls_id, size); |
| 1736 } else { | 1738 } else { |
| 1737 isolate->class_table()->UpdateAllocatedOld(cls_id, size); | 1739 class_table->UpdateAllocatedOld(cls_id, size); |
| 1740 } |
| 1741 const Class& cls = Class::Handle(class_table->At(cls_id)); |
| 1742 if (cls.trace_allocation()) { |
| 1743 Profiler::RecordAllocation(isolate, cls_id); |
| 1738 } | 1744 } |
| 1739 NoSafepointScope no_safepoint; | 1745 NoSafepointScope no_safepoint; |
| 1740 InitializeObject(address, cls_id, size); | 1746 InitializeObject(address, cls_id, size); |
| 1741 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); | 1747 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); |
| 1742 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_)); | 1748 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_)); |
| 1743 return raw_obj; | 1749 return raw_obj; |
| 1744 } | 1750 } |
| 1745 | 1751 |
| 1746 | 1752 |
| 1747 class StoreBufferUpdateVisitor : public ObjectPointerVisitor { | 1753 class StoreBufferUpdateVisitor : public ObjectPointerVisitor { |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2718 a.Register(code); | 2724 a.Register(code); |
| 2719 } | 2725 } |
| 2720 | 2726 |
| 2721 | 2727 |
| 2722 void Class::DisableCHAOptimizedCode() { | 2728 void Class::DisableCHAOptimizedCode() { |
| 2723 CHACodeArray a(*this); | 2729 CHACodeArray a(*this); |
| 2724 a.DisableCode(); | 2730 a.DisableCode(); |
| 2725 } | 2731 } |
| 2726 | 2732 |
| 2727 | 2733 |
| 2734 void Class::SetTraceAllocation(bool trace_allocation) const { |
| 2735 const bool changed = trace_allocation != this->trace_allocation(); |
| 2736 set_state_bits( |
| 2737 TraceAllocationBit::update(trace_allocation, raw_ptr()->state_bits_)); |
| 2738 if (changed) { |
| 2739 // TODO(johnmccutchan): Deoptimize the world? |
| 2740 } |
| 2741 } |
| 2742 |
| 2743 |
| 2728 void Class::set_cha_codes(const Array& cache) const { | 2744 void Class::set_cha_codes(const Array& cache) const { |
| 2729 StorePointer(&raw_ptr()->cha_codes_, cache.raw()); | 2745 StorePointer(&raw_ptr()->cha_codes_, cache.raw()); |
| 2730 } | 2746 } |
| 2731 | 2747 |
| 2732 | 2748 |
| 2733 // Apply the members from the patch class to the original class. | 2749 // Apply the members from the patch class to the original class. |
| 2734 bool Class::ApplyPatch(const Class& patch, Error* error) const { | 2750 bool Class::ApplyPatch(const Class& patch, Error* error) const { |
| 2735 ASSERT(error != NULL); | 2751 ASSERT(error != NULL); |
| 2736 ASSERT(!is_finalized()); | 2752 ASSERT(!is_finalized()); |
| 2737 // Shared handles used during the iteration. | 2753 // Shared handles used during the iteration. |
| (...skipping 18328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21066 return tag_label.ToCString(); | 21082 return tag_label.ToCString(); |
| 21067 } | 21083 } |
| 21068 | 21084 |
| 21069 | 21085 |
| 21070 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21086 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21071 Instance::PrintJSONImpl(stream, ref); | 21087 Instance::PrintJSONImpl(stream, ref); |
| 21072 } | 21088 } |
| 21073 | 21089 |
| 21074 | 21090 |
| 21075 } // namespace dart | 21091 } // namespace dart |
| OLD | NEW |