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 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2729 CHACodeArray a(*this); | 2729 CHACodeArray a(*this); |
2730 a.DisableCode(); | 2730 a.DisableCode(); |
2731 } | 2731 } |
2732 | 2732 |
2733 | 2733 |
2734 void Class::SetTraceAllocation(bool trace_allocation) const { | 2734 void Class::SetTraceAllocation(bool trace_allocation) const { |
2735 const bool changed = trace_allocation != this->trace_allocation(); | 2735 const bool changed = trace_allocation != this->trace_allocation(); |
2736 set_state_bits( | 2736 set_state_bits( |
2737 TraceAllocationBit::update(trace_allocation, raw_ptr()->state_bits_)); | 2737 TraceAllocationBit::update(trace_allocation, raw_ptr()->state_bits_)); |
2738 if (changed) { | 2738 if (changed) { |
2739 // TODO(johnmccutchan): Deoptimize the world? | 2739 DisableAllocationStub(); |
2740 } | 2740 } |
2741 } | 2741 } |
2742 | 2742 |
2743 | 2743 |
2744 void Class::set_cha_codes(const Array& cache) const { | 2744 void Class::set_cha_codes(const Array& cache) const { |
2745 StorePointer(&raw_ptr()->cha_codes_, cache.raw()); | 2745 StorePointer(&raw_ptr()->cha_codes_, cache.raw()); |
2746 } | 2746 } |
2747 | 2747 |
2748 | 2748 |
2749 // Apply the members from the patch class to the original class. | 2749 // Apply the members from the patch class to the original class. |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3626 void Class::set_allocation_stub(const Code& value) const { | 3626 void Class::set_allocation_stub(const Code& value) const { |
3627 // Never clear the stub as it may still be a target, but will be GC-d if | 3627 // Never clear the stub as it may still be a target, but will be GC-d if |
3628 // not referenced. | 3628 // not referenced. |
3629 ASSERT(!value.IsNull()); | 3629 ASSERT(!value.IsNull()); |
3630 ASSERT(raw_ptr()->allocation_stub_ == Code::null()); | 3630 ASSERT(raw_ptr()->allocation_stub_ == Code::null()); |
3631 StorePointer(&raw_ptr()->allocation_stub_, value.raw()); | 3631 StorePointer(&raw_ptr()->allocation_stub_, value.raw()); |
3632 } | 3632 } |
3633 | 3633 |
3634 | 3634 |
3635 void Class::DisableAllocationStub() const { | 3635 void Class::DisableAllocationStub() const { |
| 3636 const Code& existing_stub = Code::Handle(allocation_stub()); |
| 3637 if (existing_stub.IsNull()) { |
| 3638 return; |
| 3639 } |
| 3640 ASSERT(!CodePatcher::IsEntryPatched(existing_stub)); |
| 3641 // Patch the stub so that the next caller will regenerate the stub. |
| 3642 CodePatcher::PatchEntry(existing_stub); |
| 3643 // Disassociate the existing stub from class. |
3636 StorePointer(&raw_ptr()->allocation_stub_, Code::null()); | 3644 StorePointer(&raw_ptr()->allocation_stub_, Code::null()); |
3637 } | 3645 } |
3638 | 3646 |
3639 | 3647 |
3640 bool Class::IsFunctionClass() const { | 3648 bool Class::IsFunctionClass() const { |
3641 return raw() == Type::Handle(Type::Function()).type_class(); | 3649 return raw() == Type::Handle(Type::Function()).type_class(); |
3642 } | 3650 } |
3643 | 3651 |
3644 | 3652 |
3645 bool Class::IsCanonicalSignatureClass() const { | 3653 bool Class::IsCanonicalSignatureClass() const { |
(...skipping 17455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21101 return tag_label.ToCString(); | 21109 return tag_label.ToCString(); |
21102 } | 21110 } |
21103 | 21111 |
21104 | 21112 |
21105 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21113 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21106 Instance::PrintJSONImpl(stream, ref); | 21114 Instance::PrintJSONImpl(stream, ref); |
21107 } | 21115 } |
21108 | 21116 |
21109 | 21117 |
21110 } // namespace dart | 21118 } // namespace dart |
OLD | NEW |