Chromium Code Reviews| 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 3609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3620 if ((idx < 0) || (idx >= Array::Cast(types).Length())) { | 3620 if ((idx < 0) || (idx >= Array::Cast(types).Length())) { |
| 3621 return Type::null(); | 3621 return Type::null(); |
| 3622 } | 3622 } |
| 3623 type ^= Array::Cast(types).At(idx); | 3623 type ^= Array::Cast(types).At(idx); |
| 3624 ASSERT(!type.IsNull()); | 3624 ASSERT(!type.IsNull()); |
| 3625 return type.raw(); | 3625 return type.raw(); |
| 3626 } | 3626 } |
| 3627 | 3627 |
| 3628 | 3628 |
| 3629 void Class::set_allocation_stub(const Code& value) const { | 3629 void Class::set_allocation_stub(const Code& value) const { |
| 3630 // Never clear the stub as it may still be a target, but will be GC-d if | |
| 3631 // not referenced. | |
| 3630 ASSERT(!value.IsNull()); | 3632 ASSERT(!value.IsNull()); |
| 3631 ASSERT(raw_ptr()->allocation_stub_ == Code::null()); | 3633 ASSERT(raw_ptr()->allocation_stub_ == Code::null()); |
| 3632 StorePointer(&raw_ptr()->allocation_stub_, value.raw()); | 3634 StorePointer(&raw_ptr()->allocation_stub_, value.raw()); |
| 3633 } | 3635 } |
| 3634 | 3636 |
| 3635 | 3637 |
| 3636 void Class::DisableAllocationStub() const { | 3638 void Class::DisableAllocationStub() const { |
|
koda
2014/09/15 14:59:12
Since you are changing the behavior, please add/up
srdjan
2014/09/15 23:39:59
Renamed to SwitchAllocationStub.
| |
| 3637 const Code& alloc_stub = Code::Handle(allocation_stub()); | 3639 const Code& alloc_stub = Code::Handle(allocation_stub()); |
| 3638 if (!alloc_stub.IsNull()) { | 3640 if (!alloc_stub.IsNull()) { |
| 3639 CodePatcher::PatchEntry(alloc_stub); | 3641 CodePatcher::PatchEntry(alloc_stub); |
| 3640 StorePointer(&raw_ptr()->allocation_stub_, Code::null()); | 3642 const Code& spare_alloc_stub = Code::Handle(spare_allocation_stub()); |
| 3643 if (spare_alloc_stub.IsNull()) { | |
| 3644 StorePointer(&raw_ptr()->allocation_stub_, Code::null()); | |
| 3645 } else { | |
| 3646 ASSERT(CodePatcher::IsEntryPatched(spare_alloc_stub)); | |
| 3647 CodePatcher::RestoreEntry(spare_alloc_stub); | |
| 3648 StorePointer(&raw_ptr()->allocation_stub_, spare_alloc_stub.raw()); | |
| 3649 } | |
| 3650 StorePointer(&raw_ptr()->spare_allocation_stub_, alloc_stub.raw()); | |
| 3641 } | 3651 } |
| 3642 } | 3652 } |
| 3643 | 3653 |
| 3644 | 3654 |
| 3645 bool Class::IsFunctionClass() const { | 3655 bool Class::IsFunctionClass() const { |
| 3646 return raw() == Type::Handle(Type::Function()).type_class(); | 3656 return raw() == Type::Handle(Type::Function()).type_class(); |
| 3647 } | 3657 } |
| 3648 | 3658 |
| 3649 | 3659 |
| 3650 bool Class::IsCanonicalSignatureClass() const { | 3660 bool Class::IsCanonicalSignatureClass() const { |
| (...skipping 16701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20352 return tag_label.ToCString(); | 20362 return tag_label.ToCString(); |
| 20353 } | 20363 } |
| 20354 | 20364 |
| 20355 | 20365 |
| 20356 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20366 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20357 Instance::PrintJSONImpl(stream, ref); | 20367 Instance::PrintJSONImpl(stream, ref); |
| 20358 } | 20368 } |
| 20359 | 20369 |
| 20360 | 20370 |
| 20361 } // namespace dart | 20371 } // namespace dart |
| OLD | NEW |