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/become.h" | 10 #include "vm/become.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 RawClass* Object::pc_descriptors_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 144 RawClass* Object::pc_descriptors_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
145 RawClass* Object::code_source_map_class_ = | 145 RawClass* Object::code_source_map_class_ = |
146 reinterpret_cast<RawClass*>(RAW_NULL); | 146 reinterpret_cast<RawClass*>(RAW_NULL); |
147 RawClass* Object::stackmap_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 147 RawClass* Object::stackmap_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
148 RawClass* Object::var_descriptors_class_ = | 148 RawClass* Object::var_descriptors_class_ = |
149 reinterpret_cast<RawClass*>(RAW_NULL); | 149 reinterpret_cast<RawClass*>(RAW_NULL); |
150 RawClass* Object::exception_handlers_class_ = | 150 RawClass* Object::exception_handlers_class_ = |
151 reinterpret_cast<RawClass*>(RAW_NULL); | 151 reinterpret_cast<RawClass*>(RAW_NULL); |
152 RawClass* Object::context_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 152 RawClass* Object::context_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
153 RawClass* Object::context_scope_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 153 RawClass* Object::context_scope_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 154 RawClass* Object::singletargetcache_class_ = |
| 155 reinterpret_cast<RawClass*>(RAW_NULL); |
154 RawClass* Object::icdata_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 156 RawClass* Object::icdata_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
155 RawClass* Object::megamorphic_cache_class_ = | 157 RawClass* Object::megamorphic_cache_class_ = |
156 reinterpret_cast<RawClass*>(RAW_NULL); | 158 reinterpret_cast<RawClass*>(RAW_NULL); |
157 RawClass* Object::subtypetestcache_class_ = | 159 RawClass* Object::subtypetestcache_class_ = |
158 reinterpret_cast<RawClass*>(RAW_NULL); | 160 reinterpret_cast<RawClass*>(RAW_NULL); |
159 RawClass* Object::api_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 161 RawClass* Object::api_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
160 RawClass* Object::language_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 162 RawClass* Object::language_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
161 RawClass* Object::unhandled_exception_class_ = | 163 RawClass* Object::unhandled_exception_class_ = |
162 reinterpret_cast<RawClass*>(RAW_NULL); | 164 reinterpret_cast<RawClass*>(RAW_NULL); |
163 RawClass* Object::unwind_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 165 RawClass* Object::unwind_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 | 646 |
645 cls = Class::New<ExceptionHandlers>(); | 647 cls = Class::New<ExceptionHandlers>(); |
646 exception_handlers_class_ = cls.raw(); | 648 exception_handlers_class_ = cls.raw(); |
647 | 649 |
648 cls = Class::New<Context>(); | 650 cls = Class::New<Context>(); |
649 context_class_ = cls.raw(); | 651 context_class_ = cls.raw(); |
650 | 652 |
651 cls = Class::New<ContextScope>(); | 653 cls = Class::New<ContextScope>(); |
652 context_scope_class_ = cls.raw(); | 654 context_scope_class_ = cls.raw(); |
653 | 655 |
| 656 cls = Class::New<SingleTargetCache>(); |
| 657 singletargetcache_class_ = cls.raw(); |
| 658 |
654 cls = Class::New<ICData>(); | 659 cls = Class::New<ICData>(); |
655 icdata_class_ = cls.raw(); | 660 icdata_class_ = cls.raw(); |
656 | 661 |
657 cls = Class::New<MegamorphicCache>(); | 662 cls = Class::New<MegamorphicCache>(); |
658 megamorphic_cache_class_ = cls.raw(); | 663 megamorphic_cache_class_ = cls.raw(); |
659 | 664 |
660 cls = Class::New<SubtypeTestCache>(); | 665 cls = Class::New<SubtypeTestCache>(); |
661 subtypetestcache_class_ = cls.raw(); | 666 subtypetestcache_class_ = cls.raw(); |
662 | 667 |
663 cls = Class::New<ApiError>(); | 668 cls = Class::New<ApiError>(); |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 SET_CLASS_NAME(code, Code); | 990 SET_CLASS_NAME(code, Code); |
986 SET_CLASS_NAME(instructions, Instructions); | 991 SET_CLASS_NAME(instructions, Instructions); |
987 SET_CLASS_NAME(object_pool, ObjectPool); | 992 SET_CLASS_NAME(object_pool, ObjectPool); |
988 SET_CLASS_NAME(code_source_map, CodeSourceMap); | 993 SET_CLASS_NAME(code_source_map, CodeSourceMap); |
989 SET_CLASS_NAME(pc_descriptors, PcDescriptors); | 994 SET_CLASS_NAME(pc_descriptors, PcDescriptors); |
990 SET_CLASS_NAME(stackmap, Stackmap); | 995 SET_CLASS_NAME(stackmap, Stackmap); |
991 SET_CLASS_NAME(var_descriptors, LocalVarDescriptors); | 996 SET_CLASS_NAME(var_descriptors, LocalVarDescriptors); |
992 SET_CLASS_NAME(exception_handlers, ExceptionHandlers); | 997 SET_CLASS_NAME(exception_handlers, ExceptionHandlers); |
993 SET_CLASS_NAME(context, Context); | 998 SET_CLASS_NAME(context, Context); |
994 SET_CLASS_NAME(context_scope, ContextScope); | 999 SET_CLASS_NAME(context_scope, ContextScope); |
| 1000 SET_CLASS_NAME(singletargetcache, SingleTargetCache); |
995 SET_CLASS_NAME(icdata, ICData); | 1001 SET_CLASS_NAME(icdata, ICData); |
996 SET_CLASS_NAME(megamorphic_cache, MegamorphicCache); | 1002 SET_CLASS_NAME(megamorphic_cache, MegamorphicCache); |
997 SET_CLASS_NAME(subtypetestcache, SubtypeTestCache); | 1003 SET_CLASS_NAME(subtypetestcache, SubtypeTestCache); |
998 SET_CLASS_NAME(api_error, ApiError); | 1004 SET_CLASS_NAME(api_error, ApiError); |
999 SET_CLASS_NAME(language_error, LanguageError); | 1005 SET_CLASS_NAME(language_error, LanguageError); |
1000 SET_CLASS_NAME(unhandled_exception, UnhandledException); | 1006 SET_CLASS_NAME(unhandled_exception, UnhandledException); |
1001 SET_CLASS_NAME(unwind_error, UnwindError); | 1007 SET_CLASS_NAME(unwind_error, UnwindError); |
1002 | 1008 |
1003 // Set up names for object array and one byte string class which are | 1009 // Set up names for object array and one byte string class which are |
1004 // pre-allocated in the vm isolate also. | 1010 // pre-allocated in the vm isolate also. |
(...skipping 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3420 case kStackmapCid: | 3426 case kStackmapCid: |
3421 return Symbols::Stackmap().raw(); | 3427 return Symbols::Stackmap().raw(); |
3422 case kLocalVarDescriptorsCid: | 3428 case kLocalVarDescriptorsCid: |
3423 return Symbols::LocalVarDescriptors().raw(); | 3429 return Symbols::LocalVarDescriptors().raw(); |
3424 case kExceptionHandlersCid: | 3430 case kExceptionHandlersCid: |
3425 return Symbols::ExceptionHandlers().raw(); | 3431 return Symbols::ExceptionHandlers().raw(); |
3426 case kContextCid: | 3432 case kContextCid: |
3427 return Symbols::Context().raw(); | 3433 return Symbols::Context().raw(); |
3428 case kContextScopeCid: | 3434 case kContextScopeCid: |
3429 return Symbols::ContextScope().raw(); | 3435 return Symbols::ContextScope().raw(); |
| 3436 case kSingleTargetCacheCid: |
| 3437 return Symbols::SingleTargetCache().raw(); |
3430 case kICDataCid: | 3438 case kICDataCid: |
3431 return Symbols::ICData().raw(); | 3439 return Symbols::ICData().raw(); |
3432 case kMegamorphicCacheCid: | 3440 case kMegamorphicCacheCid: |
3433 return Symbols::MegamorphicCache().raw(); | 3441 return Symbols::MegamorphicCache().raw(); |
3434 case kSubtypeTestCacheCid: | 3442 case kSubtypeTestCacheCid: |
3435 return Symbols::SubtypeTestCache().raw(); | 3443 return Symbols::SubtypeTestCache().raw(); |
3436 case kApiErrorCid: | 3444 case kApiErrorCid: |
3437 return Symbols::ApiError().raw(); | 3445 return Symbols::ApiError().raw(); |
3438 case kLanguageErrorCid: | 3446 case kLanguageErrorCid: |
3439 return Symbols::LanguageError().raw(); | 3447 return Symbols::LanguageError().raw(); |
(...skipping 9044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12484 GrowableArray<DeoptInstr*> unpacked; | 12492 GrowableArray<DeoptInstr*> unpacked; |
12485 Unpack(deopt_table, packed, &unpacked); | 12493 Unpack(deopt_table, packed, &unpacked); |
12486 ASSERT(unpacked.length() == original.length()); | 12494 ASSERT(unpacked.length() == original.length()); |
12487 for (intptr_t i = 0; i < unpacked.length(); ++i) { | 12495 for (intptr_t i = 0; i < unpacked.length(); ++i) { |
12488 ASSERT(unpacked[i]->Equals(*original[i])); | 12496 ASSERT(unpacked[i]->Equals(*original[i])); |
12489 } | 12497 } |
12490 return true; | 12498 return true; |
12491 } | 12499 } |
12492 | 12500 |
12493 | 12501 |
| 12502 void SingleTargetCache::set_target(const Code& value) const { |
| 12503 StorePointer(&raw_ptr()->target_, value.raw()); |
| 12504 } |
| 12505 |
| 12506 |
| 12507 const char* SingleTargetCache::ToCString() const { |
| 12508 return "SingleTargetCache"; |
| 12509 } |
| 12510 |
| 12511 |
| 12512 RawSingleTargetCache* SingleTargetCache::New() { |
| 12513 SingleTargetCache& result = SingleTargetCache::Handle(); |
| 12514 { |
| 12515 // IC data objects are long living objects, allocate them in old generation. |
| 12516 RawObject* raw = Object::Allocate(SingleTargetCache::kClassId, |
| 12517 SingleTargetCache::InstanceSize(), |
| 12518 Heap::kOld); |
| 12519 NoSafepointScope no_safepoint; |
| 12520 result ^= raw; |
| 12521 } |
| 12522 result.set_target(Code::Handle()); |
| 12523 result.set_entry_point(0); |
| 12524 result.set_lower_limit(kIllegalCid); |
| 12525 result.set_upper_limit(kIllegalCid); |
| 12526 return result.raw(); |
| 12527 } |
| 12528 |
| 12529 |
12494 void ICData::ResetSwitchable(Zone* zone) const { | 12530 void ICData::ResetSwitchable(Zone* zone) const { |
12495 ASSERT(NumArgsTested() == 1); | 12531 ASSERT(NumArgsTested() == 1); |
12496 set_ic_data_array(Array::Handle(zone, CachedEmptyICDataArray(1))); | 12532 set_ic_data_array(Array::Handle(zone, CachedEmptyICDataArray(1))); |
12497 } | 12533 } |
12498 | 12534 |
12499 | 12535 |
12500 const char* ICData::ToCString() const { | 12536 const char* ICData::ToCString() const { |
12501 const String& name = String::Handle(target_name()); | 12537 const String& name = String::Handle(target_name()); |
12502 const intptr_t num_args = NumArgsTested(); | 12538 const intptr_t num_args = NumArgsTested(); |
12503 const intptr_t num_checks = NumberOfChecks(); | 12539 const intptr_t num_checks = NumberOfChecks(); |
(...skipping 10217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22721 return UserTag::null(); | 22757 return UserTag::null(); |
22722 } | 22758 } |
22723 | 22759 |
22724 | 22760 |
22725 const char* UserTag::ToCString() const { | 22761 const char* UserTag::ToCString() const { |
22726 const String& tag_label = String::Handle(label()); | 22762 const String& tag_label = String::Handle(label()); |
22727 return tag_label.ToCString(); | 22763 return tag_label.ToCString(); |
22728 } | 22764 } |
22729 | 22765 |
22730 } // namespace dart | 22766 } // namespace dart |
OLD | NEW |