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 13459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13470 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); | 13470 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); |
13471 ASSERT(IsFunctionCode()); | 13471 ASSERT(IsFunctionCode()); |
13472 ASSERT(instructions() == active_instructions()); | 13472 ASSERT(instructions() == active_instructions()); |
13473 const Code& new_code = | 13473 const Code& new_code = |
13474 Code::Handle(StubCode::FixCallersTarget_entry()->code()); | 13474 Code::Handle(StubCode::FixCallersTarget_entry()->code()); |
13475 SetActiveInstructions(new_code.instructions()); | 13475 SetActiveInstructions(new_code.instructions()); |
13476 } | 13476 } |
13477 | 13477 |
13478 | 13478 |
13479 void Code::DisableStubCode() const { | 13479 void Code::DisableStubCode() const { |
| 13480 #if !defined(TARGET_ARCH_DBC) |
13480 ASSERT(Thread::Current()->IsMutatorThread()); | 13481 ASSERT(Thread::Current()->IsMutatorThread()); |
13481 ASSERT(IsAllocationStubCode()); | 13482 ASSERT(IsAllocationStubCode()); |
13482 ASSERT(instructions() == active_instructions()); | 13483 ASSERT(instructions() == active_instructions()); |
13483 const Code& new_code = | 13484 const Code& new_code = |
13484 Code::Handle(StubCode::FixAllocationStubTarget_entry()->code()); | 13485 Code::Handle(StubCode::FixAllocationStubTarget_entry()->code()); |
13485 SetActiveInstructions(new_code.instructions()); | 13486 SetActiveInstructions(new_code.instructions()); |
| 13487 #else |
| 13488 UNIMPLEMENTED(); |
| 13489 #endif |
13486 } | 13490 } |
13487 | 13491 |
13488 | 13492 |
13489 void Code::SetActiveInstructions(RawInstructions* instructions) const { | 13493 void Code::SetActiveInstructions(RawInstructions* instructions) const { |
13490 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); | 13494 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); |
13491 // RawInstructions are never allocated in New space and hence a | 13495 // RawInstructions are never allocated in New space and hence a |
13492 // store buffer update is not needed here. | 13496 // store buffer update is not needed here. |
13493 StorePointer(&raw_ptr()->active_instructions_, instructions); | 13497 StorePointer(&raw_ptr()->active_instructions_, instructions); |
13494 StoreNonPointer(&raw_ptr()->entry_point_, | 13498 StoreNonPointer(&raw_ptr()->entry_point_, |
13495 reinterpret_cast<uword>(instructions->ptr()) + | 13499 reinterpret_cast<uword>(instructions->ptr()) + |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14632 ASSERT(!other.IsDynamicType()); | 14636 ASSERT(!other.IsDynamicType()); |
14633 ASSERT(!other.IsTypeRef()); // Must be dereferenced at compile time. | 14637 ASSERT(!other.IsTypeRef()); // Must be dereferenced at compile time. |
14634 ASSERT(!other.IsMalformed()); | 14638 ASSERT(!other.IsMalformed()); |
14635 ASSERT(!other.IsMalbounded()); | 14639 ASSERT(!other.IsMalbounded()); |
14636 if (other.IsVoidType()) { | 14640 if (other.IsVoidType()) { |
14637 return false; | 14641 return false; |
14638 } | 14642 } |
14639 Zone* zone = Thread::Current()->zone(); | 14643 Zone* zone = Thread::Current()->zone(); |
14640 const Class& cls = Class::Handle(zone, clazz()); | 14644 const Class& cls = Class::Handle(zone, clazz()); |
14641 if (cls.IsClosureClass()) { | 14645 if (cls.IsClosureClass()) { |
14642 if (other.IsObjectType() || other.IsDartFunctionType()) { | 14646 if (other.IsObjectType() || |
| 14647 other.IsDartFunctionType() || |
| 14648 other.IsDartClosureType()) { |
14643 return true; | 14649 return true; |
14644 } | 14650 } |
14645 Function& other_signature = Function::Handle(zone); | 14651 Function& other_signature = Function::Handle(zone); |
14646 TypeArguments& other_type_arguments = TypeArguments::Handle(zone); | 14652 TypeArguments& other_type_arguments = TypeArguments::Handle(zone); |
14647 // Note that we may encounter a bound error in checked mode. | 14653 // Note that we may encounter a bound error in checked mode. |
14648 if (!other.IsInstantiated()) { | 14654 if (!other.IsInstantiated()) { |
14649 AbstractType& instantiated_other = AbstractType::Handle( | 14655 AbstractType& instantiated_other = AbstractType::Handle( |
14650 zone, other.InstantiateFrom(other_instantiator, bound_error, | 14656 zone, other.InstantiateFrom(other_instantiator, bound_error, |
14651 NULL, NULL, Heap::kOld)); | 14657 NULL, NULL, Heap::kOld)); |
14652 if ((bound_error != NULL) && !bound_error->IsNull()) { | 14658 if ((bound_error != NULL) && !bound_error->IsNull()) { |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15402 (type_class() == Type::Handle(Type::StringType()).type_class()); | 15408 (type_class() == Type::Handle(Type::StringType()).type_class()); |
15403 } | 15409 } |
15404 | 15410 |
15405 | 15411 |
15406 bool AbstractType::IsDartFunctionType() const { | 15412 bool AbstractType::IsDartFunctionType() const { |
15407 return HasResolvedTypeClass() && | 15413 return HasResolvedTypeClass() && |
15408 (type_class() == Type::Handle(Type::Function()).type_class()); | 15414 (type_class() == Type::Handle(Type::Function()).type_class()); |
15409 } | 15415 } |
15410 | 15416 |
15411 | 15417 |
| 15418 bool AbstractType::IsDartClosureType() const { |
| 15419 return HasResolvedTypeClass() && |
| 15420 (type_class() == Isolate::Current()->object_store()->closure_class()); |
| 15421 } |
| 15422 |
| 15423 |
15412 bool AbstractType::TypeTest(TypeTestKind test_kind, | 15424 bool AbstractType::TypeTest(TypeTestKind test_kind, |
15413 const AbstractType& other, | 15425 const AbstractType& other, |
15414 Error* bound_error, | 15426 Error* bound_error, |
15415 TrailPtr bound_trail, | 15427 TrailPtr bound_trail, |
15416 Heap::Space space) const { | 15428 Heap::Space space) const { |
15417 ASSERT(IsFinalized()); | 15429 ASSERT(IsFinalized()); |
15418 ASSERT(other.IsFinalized()); | 15430 ASSERT(other.IsFinalized()); |
15419 if (IsMalformed() || other.IsMalformed()) { | 15431 if (IsMalformed() || other.IsMalformed()) { |
15420 // Malformed types involved in subtype tests should be handled specially | 15432 // Malformed types involved in subtype tests should be handled specially |
15421 // by the caller. Malformed types should only be encountered here in a | 15433 // by the caller. Malformed types should only be encountered here in a |
(...skipping 6454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21876 return UserTag::null(); | 21888 return UserTag::null(); |
21877 } | 21889 } |
21878 | 21890 |
21879 | 21891 |
21880 const char* UserTag::ToCString() const { | 21892 const char* UserTag::ToCString() const { |
21881 const String& tag_label = String::Handle(label()); | 21893 const String& tag_label = String::Handle(label()); |
21882 return tag_label.ToCString(); | 21894 return tag_label.ToCString(); |
21883 } | 21895 } |
21884 | 21896 |
21885 } // namespace dart | 21897 } // namespace dart |
OLD | NEW |