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 13807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13818 ASSERT(IsFunctionCode()); | 13818 ASSERT(IsFunctionCode()); |
13819 ASSERT(!IsDisabled()); | 13819 ASSERT(!IsDisabled()); |
13820 const Code& new_code = | 13820 const Code& new_code = |
13821 Code::Handle(StubCode::FixCallersTarget_entry()->code()); | 13821 Code::Handle(StubCode::FixCallersTarget_entry()->code()); |
13822 ASSERT(new_code.instructions()->IsVMHeapObject()); | 13822 ASSERT(new_code.instructions()->IsVMHeapObject()); |
13823 SetActiveInstructions(new_code.instructions()); | 13823 SetActiveInstructions(new_code.instructions()); |
13824 } | 13824 } |
13825 | 13825 |
13826 | 13826 |
13827 void Code::DisableStubCode() const { | 13827 void Code::DisableStubCode() const { |
| 13828 #if !defined(TARGET_ARCH_DBC) |
13828 ASSERT(Thread::Current()->IsMutatorThread()); | 13829 ASSERT(Thread::Current()->IsMutatorThread()); |
13829 ASSERT(IsAllocationStubCode()); | 13830 ASSERT(IsAllocationStubCode()); |
13830 ASSERT(!IsDisabled()); | 13831 ASSERT(!IsDisabled()); |
13831 const Code& new_code = | 13832 const Code& new_code = |
13832 Code::Handle(StubCode::FixAllocationStubTarget_entry()->code()); | 13833 Code::Handle(StubCode::FixAllocationStubTarget_entry()->code()); |
13833 ASSERT(new_code.instructions()->IsVMHeapObject()); | 13834 ASSERT(new_code.instructions()->IsVMHeapObject()); |
13834 SetActiveInstructions(new_code.instructions()); | 13835 SetActiveInstructions(new_code.instructions()); |
| 13836 #else |
| 13837 // DBC does not use allocation stubs. |
| 13838 UNIMPLEMENTED(); |
| 13839 #endif // !defined(TARGET_ARCH_DBC) |
13835 } | 13840 } |
13836 | 13841 |
13837 | 13842 |
13838 void Code::SetActiveInstructions(RawInstructions* instructions) const { | 13843 void Code::SetActiveInstructions(RawInstructions* instructions) const { |
13839 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); | 13844 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); |
13840 // RawInstructions are never allocated in New space and hence a | 13845 // RawInstructions are never allocated in New space and hence a |
13841 // store buffer update is not needed here. | 13846 // store buffer update is not needed here. |
13842 StoreNonPointer(&raw_ptr()->entry_point_, | 13847 StoreNonPointer(&raw_ptr()->entry_point_, |
13843 reinterpret_cast<uword>(instructions->ptr()) + | 13848 reinterpret_cast<uword>(instructions->ptr()) + |
13844 Instructions::HeaderSize()); | 13849 Instructions::HeaderSize()); |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14963 ASSERT(!other.IsDynamicType()); | 14968 ASSERT(!other.IsDynamicType()); |
14964 ASSERT(!other.IsTypeRef()); // Must be dereferenced at compile time. | 14969 ASSERT(!other.IsTypeRef()); // Must be dereferenced at compile time. |
14965 ASSERT(!other.IsMalformed()); | 14970 ASSERT(!other.IsMalformed()); |
14966 ASSERT(!other.IsMalbounded()); | 14971 ASSERT(!other.IsMalbounded()); |
14967 if (other.IsVoidType()) { | 14972 if (other.IsVoidType()) { |
14968 return false; | 14973 return false; |
14969 } | 14974 } |
14970 Zone* zone = Thread::Current()->zone(); | 14975 Zone* zone = Thread::Current()->zone(); |
14971 const Class& cls = Class::Handle(zone, clazz()); | 14976 const Class& cls = Class::Handle(zone, clazz()); |
14972 if (cls.IsClosureClass()) { | 14977 if (cls.IsClosureClass()) { |
14973 if (other.IsObjectType() || other.IsDartFunctionType()) { | 14978 if (other.IsObjectType() || |
| 14979 other.IsDartFunctionType() || |
| 14980 other.IsDartClosureType()) { |
14974 return true; | 14981 return true; |
14975 } | 14982 } |
14976 Function& other_signature = Function::Handle(zone); | 14983 Function& other_signature = Function::Handle(zone); |
14977 TypeArguments& other_type_arguments = TypeArguments::Handle(zone); | 14984 TypeArguments& other_type_arguments = TypeArguments::Handle(zone); |
14978 // Note that we may encounter a bound error in checked mode. | 14985 // Note that we may encounter a bound error in checked mode. |
14979 if (!other.IsInstantiated()) { | 14986 if (!other.IsInstantiated()) { |
14980 AbstractType& instantiated_other = AbstractType::Handle( | 14987 AbstractType& instantiated_other = AbstractType::Handle( |
14981 zone, other.InstantiateFrom(other_instantiator, bound_error, | 14988 zone, other.InstantiateFrom(other_instantiator, bound_error, |
14982 NULL, NULL, Heap::kOld)); | 14989 NULL, NULL, Heap::kOld)); |
14983 if ((bound_error != NULL) && !bound_error->IsNull()) { | 14990 if ((bound_error != NULL) && !bound_error->IsNull()) { |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15750 } | 15757 } |
15751 | 15758 |
15752 | 15759 |
15753 bool AbstractType::IsDartFunctionType() const { | 15760 bool AbstractType::IsDartFunctionType() const { |
15754 return !IsFunctionType() && | 15761 return !IsFunctionType() && |
15755 HasResolvedTypeClass() && | 15762 HasResolvedTypeClass() && |
15756 (type_class() == Type::Handle(Type::DartFunctionType()).type_class()); | 15763 (type_class() == Type::Handle(Type::DartFunctionType()).type_class()); |
15757 } | 15764 } |
15758 | 15765 |
15759 | 15766 |
| 15767 bool AbstractType::IsDartClosureType() const { |
| 15768 return !IsFunctionType() && |
| 15769 HasResolvedTypeClass() && |
| 15770 (type_class() == Isolate::Current()->object_store()->closure_class()); |
| 15771 } |
| 15772 |
| 15773 |
15760 bool AbstractType::TypeTest(TypeTestKind test_kind, | 15774 bool AbstractType::TypeTest(TypeTestKind test_kind, |
15761 const AbstractType& other, | 15775 const AbstractType& other, |
15762 Error* bound_error, | 15776 Error* bound_error, |
15763 TrailPtr bound_trail, | 15777 TrailPtr bound_trail, |
15764 Heap::Space space) const { | 15778 Heap::Space space) const { |
15765 ASSERT(IsFinalized()); | 15779 ASSERT(IsFinalized()); |
15766 ASSERT(other.IsFinalized()); | 15780 ASSERT(other.IsFinalized()); |
15767 if (IsMalformed() || other.IsMalformed()) { | 15781 if (IsMalformed() || other.IsMalformed()) { |
15768 // Malformed types involved in subtype tests should be handled specially | 15782 // Malformed types involved in subtype tests should be handled specially |
15769 // by the caller. Malformed types should only be encountered here in a | 15783 // by the caller. Malformed types should only be encountered here in a |
(...skipping 6283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22053 return UserTag::null(); | 22067 return UserTag::null(); |
22054 } | 22068 } |
22055 | 22069 |
22056 | 22070 |
22057 const char* UserTag::ToCString() const { | 22071 const char* UserTag::ToCString() const { |
22058 const String& tag_label = String::Handle(label()); | 22072 const String& tag_label = String::Handle(label()); |
22059 return tag_label.ToCString(); | 22073 return tag_label.ToCString(); |
22060 } | 22074 } |
22061 | 22075 |
22062 } // namespace dart | 22076 } // namespace dart |
OLD | NEW |