| 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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 6899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6910 NoGCScope no_gc; | 6910 NoGCScope no_gc; |
| 6911 result ^= raw; | 6911 result ^= raw; |
| 6912 result.SetLength(num_descriptors); | 6912 result.SetLength(num_descriptors); |
| 6913 } | 6913 } |
| 6914 return result.raw(); | 6914 return result.raw(); |
| 6915 } | 6915 } |
| 6916 | 6916 |
| 6917 | 6917 |
| 6918 const char* PcDescriptors::KindAsStr(intptr_t index) const { | 6918 const char* PcDescriptors::KindAsStr(intptr_t index) const { |
| 6919 switch (DescriptorKind(index)) { | 6919 switch (DescriptorKind(index)) { |
| 6920 case PcDescriptors::kDeoptBefore: return "deopt-before "; | 6920 case PcDescriptors::kDeopt: return "deopt "; |
| 6921 case PcDescriptors::kDeoptAfter: return "deopt-after "; | |
| 6922 case PcDescriptors::kEntryPatch: return "entry-patch "; | 6921 case PcDescriptors::kEntryPatch: return "entry-patch "; |
| 6923 case PcDescriptors::kPatchCode: return "patch "; | 6922 case PcDescriptors::kPatchCode: return "patch "; |
| 6924 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt "; | 6923 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt "; |
| 6925 case PcDescriptors::kIcCall: return "ic-call "; | 6924 case PcDescriptors::kIcCall: return "ic-call "; |
| 6926 case PcDescriptors::kFuncCall: return "fn-call "; | 6925 case PcDescriptors::kFuncCall: return "fn-call "; |
| 6927 case PcDescriptors::kReturn: return "return "; | 6926 case PcDescriptors::kReturn: return "return "; |
| 6928 case PcDescriptors::kOther: return "other "; | 6927 case PcDescriptors::kOther: return "other "; |
| 6929 } | 6928 } |
| 6930 UNREACHABLE(); | 6929 UNREACHABLE(); |
| 6931 return ""; | 6930 return ""; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6992 OS::Print("Not checking pc decriptors, length %"Pd"\n", Length()); | 6991 OS::Print("Not checking pc decriptors, length %"Pd"\n", Length()); |
| 6993 } | 6992 } |
| 6994 return; | 6993 return; |
| 6995 } | 6994 } |
| 6996 // Only check ids for unoptimized code that is optimizable. | 6995 // Only check ids for unoptimized code that is optimizable. |
| 6997 if (!function.is_optimizable()) return; | 6996 if (!function.is_optimizable()) return; |
| 6998 for (intptr_t i = 0; i < Length(); i++) { | 6997 for (intptr_t i = 0; i < Length(); i++) { |
| 6999 PcDescriptors::Kind kind = DescriptorKind(i); | 6998 PcDescriptors::Kind kind = DescriptorKind(i); |
| 7000 // 'deopt_id' is set for kDeopt and kIcCall and must be unique for one kind. | 6999 // 'deopt_id' is set for kDeopt and kIcCall and must be unique for one kind. |
| 7001 intptr_t deopt_id = Isolate::kNoDeoptId; | 7000 intptr_t deopt_id = Isolate::kNoDeoptId; |
| 7002 if ((DescriptorKind(i) == PcDescriptors::kDeoptBefore) || | 7001 if ((DescriptorKind(i) != PcDescriptors::kDeopt) || |
| 7003 (DescriptorKind(i) == PcDescriptors::kIcCall)) { | 7002 (DescriptorKind(i) != PcDescriptors::kIcCall)) { |
| 7004 deopt_id = DeoptId(i); | 7003 continue; |
| 7005 } | 7004 } |
| 7005 |
| 7006 deopt_id = DeoptId(i); |
| 7007 if (Isolate::IsDeoptAfter(deopt_id)) { |
| 7008 // TODO(vegorov): some instructions contain multiple calls and have |
| 7009 // multiple "after" targets recorded. Right now it is benign but might |
| 7010 // lead to issues in the future. Fix that and enable verification. |
| 7011 continue; |
| 7012 } |
| 7013 |
| 7006 for (intptr_t k = i + 1; k < Length(); k++) { | 7014 for (intptr_t k = i + 1; k < Length(); k++) { |
| 7007 if (kind == DescriptorKind(k)) { | 7015 if (kind == DescriptorKind(k)) { |
| 7008 if (deopt_id != Isolate::kNoDeoptId) { | 7016 if (deopt_id != Isolate::kNoDeoptId) { |
| 7009 ASSERT(DeoptId(k) != deopt_id); | 7017 ASSERT(DeoptId(k) != deopt_id); |
| 7010 } | 7018 } |
| 7011 } | 7019 } |
| 7012 } | 7020 } |
| 7013 } | 7021 } |
| 7014 #endif // DEBUG | 7022 #endif // DEBUG |
| 7015 } | 7023 } |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7737 (descriptors.DescriptorKind(i) == kind)) { | 7745 (descriptors.DescriptorKind(i) == kind)) { |
| 7738 uword pc = descriptors.PC(i); | 7746 uword pc = descriptors.PC(i); |
| 7739 ASSERT(ContainsInstructionAt(pc)); | 7747 ASSERT(ContainsInstructionAt(pc)); |
| 7740 return pc; | 7748 return pc; |
| 7741 } | 7749 } |
| 7742 } | 7750 } |
| 7743 return 0; | 7751 return 0; |
| 7744 } | 7752 } |
| 7745 | 7753 |
| 7746 | 7754 |
| 7747 uword Code::GetDeoptBeforePcAtDeoptId(intptr_t deopt_id) const { | |
| 7748 ASSERT(!is_optimized()); | |
| 7749 return GetPcForDeoptId(deopt_id, PcDescriptors::kDeoptBefore); | |
| 7750 } | |
| 7751 | |
| 7752 | |
| 7753 uword Code::GetDeoptAfterPcAtDeoptId(intptr_t deopt_id) const { | |
| 7754 ASSERT(!is_optimized()); | |
| 7755 return GetPcForDeoptId(deopt_id, PcDescriptors::kDeoptAfter); | |
| 7756 } | |
| 7757 | |
| 7758 | |
| 7759 const char* Code::ToCString() const { | 7755 const char* Code::ToCString() const { |
| 7760 const char* kFormat = "Code entry:%p"; | 7756 const char* kFormat = "Code entry:%p"; |
| 7761 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; | 7757 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; |
| 7762 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 7758 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 7763 OS::SNPrint(chars, len, kFormat, EntryPoint()); | 7759 OS::SNPrint(chars, len, kFormat, EntryPoint()); |
| 7764 return chars; | 7760 return chars; |
| 7765 } | 7761 } |
| 7766 | 7762 |
| 7767 | 7763 |
| 7768 uword Code::GetPatchCodePc() const { | 7764 uword Code::GetPatchCodePc() const { |
| (...skipping 5280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13049 } | 13045 } |
| 13050 return result.raw(); | 13046 return result.raw(); |
| 13051 } | 13047 } |
| 13052 | 13048 |
| 13053 | 13049 |
| 13054 const char* WeakProperty::ToCString() const { | 13050 const char* WeakProperty::ToCString() const { |
| 13055 return "_WeakProperty"; | 13051 return "_WeakProperty"; |
| 13056 } | 13052 } |
| 13057 | 13053 |
| 13058 } // namespace dart | 13054 } // namespace dart |
| OLD | NEW |