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 6909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6920 NoGCScope no_gc; | 6920 NoGCScope no_gc; |
6921 result ^= raw; | 6921 result ^= raw; |
6922 result.SetLength(num_descriptors); | 6922 result.SetLength(num_descriptors); |
6923 } | 6923 } |
6924 return result.raw(); | 6924 return result.raw(); |
6925 } | 6925 } |
6926 | 6926 |
6927 | 6927 |
6928 const char* PcDescriptors::KindAsStr(intptr_t index) const { | 6928 const char* PcDescriptors::KindAsStr(intptr_t index) const { |
6929 switch (DescriptorKind(index)) { | 6929 switch (DescriptorKind(index)) { |
6930 case PcDescriptors::kDeoptBefore: return "deopt-before "; | 6930 case PcDescriptors::kDeoptBefore: return "deopt-before "; |
6931 case PcDescriptors::kDeoptAfter: return "deopt-after "; | 6931 case PcDescriptors::kDeoptAfter: return "deopt-after "; |
6932 case PcDescriptors::kDeoptIndex: return "deopt-ix "; | 6932 case PcDescriptors::kDeoptIndex: return "deopt-ix "; |
6933 case PcDescriptors::kPatchCode: return "patch "; | 6933 case PcDescriptors::kPatchCode: return "patch "; |
6934 case PcDescriptors::kIcCall: return "ic-call "; | 6934 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt "; |
6935 case PcDescriptors::kFuncCall: return "fn-call "; | 6935 case PcDescriptors::kIcCall: return "ic-call "; |
6936 case PcDescriptors::kReturn: return "return "; | 6936 case PcDescriptors::kFuncCall: return "fn-call "; |
6937 case PcDescriptors::kOther: return "other "; | 6937 case PcDescriptors::kReturn: return "return "; |
| 6938 case PcDescriptors::kOther: return "other "; |
6938 } | 6939 } |
6939 UNREACHABLE(); | 6940 UNREACHABLE(); |
6940 return ""; | 6941 return ""; |
6941 } | 6942 } |
6942 | 6943 |
6943 | 6944 |
6944 void PcDescriptors::PrintHeaderString() { | 6945 void PcDescriptors::PrintHeaderString() { |
6945 // 4 bits per hex digit + 2 for "0x". | 6946 // 4 bits per hex digit + 2 for "0x". |
6946 const int addr_width = (kBitsPerWord / 4) + 2; | 6947 const int addr_width = (kBitsPerWord / 4) + 2; |
6947 // "*" in a printf format specifier tells it to read the field width from | 6948 // "*" in a printf format specifier tells it to read the field width from |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7025 if (deopt_id != Isolate::kNoDeoptId) { | 7026 if (deopt_id != Isolate::kNoDeoptId) { |
7026 ASSERT(DeoptId(k) != deopt_id); | 7027 ASSERT(DeoptId(k) != deopt_id); |
7027 } | 7028 } |
7028 } | 7029 } |
7029 } | 7030 } |
7030 } | 7031 } |
7031 #endif // DEBUG | 7032 #endif // DEBUG |
7032 } | 7033 } |
7033 | 7034 |
7034 | 7035 |
| 7036 uword PcDescriptors::GetPcForKind(Kind kind) const { |
| 7037 for (intptr_t i = 0; i < Length(); i++) { |
| 7038 if (DescriptorKind(i) == kind) { |
| 7039 return PC(i); |
| 7040 } |
| 7041 } |
| 7042 return 0; |
| 7043 } |
| 7044 |
| 7045 |
7035 void Stackmap::SetCode(const dart::Code& code) const { | 7046 void Stackmap::SetCode(const dart::Code& code) const { |
7036 StorePointer(&raw_ptr()->code_, code.raw()); | 7047 StorePointer(&raw_ptr()->code_, code.raw()); |
7037 } | 7048 } |
7038 | 7049 |
7039 | 7050 |
7040 bool Stackmap::GetBit(intptr_t bit_index) const { | 7051 bool Stackmap::GetBit(intptr_t bit_index) const { |
7041 ASSERT(InRange(bit_index)); | 7052 ASSERT(InRange(bit_index)); |
7042 int byte_index = bit_index >> kBitsPerByteLog2; | 7053 int byte_index = bit_index >> kBitsPerByteLog2; |
7043 int bit_remainder = bit_index & (kBitsPerByte - 1); | 7054 int bit_remainder = bit_index & (kBitsPerByte - 1); |
7044 uint8_t byte_mask = 1U << bit_remainder; | 7055 uint8_t byte_mask = 1U << bit_remainder; |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7593 const char* kFormat = "Code entry:0x%d"; | 7604 const char* kFormat = "Code entry:0x%d"; |
7594 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; | 7605 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; |
7595 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 7606 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
7596 OS::SNPrint(chars, len, kFormat, EntryPoint()); | 7607 OS::SNPrint(chars, len, kFormat, EntryPoint()); |
7597 return chars; | 7608 return chars; |
7598 } | 7609 } |
7599 | 7610 |
7600 | 7611 |
7601 uword Code::GetPatchCodePc() const { | 7612 uword Code::GetPatchCodePc() const { |
7602 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | 7613 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
7603 for (intptr_t i = 0; i < descriptors.Length(); i++) { | 7614 return descriptors.GetPcForKind(PcDescriptors::kPatchCode); |
7604 if (descriptors.DescriptorKind(i) == PcDescriptors::kPatchCode) { | 7615 } |
7605 return descriptors.PC(i); | 7616 |
7606 } | 7617 |
7607 } | 7618 uword Code::GetLazyDeoptPc() const { |
7608 return 0; | 7619 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
| 7620 return descriptors.GetPcForKind(PcDescriptors::kLazyDeoptJump); |
7609 } | 7621 } |
7610 | 7622 |
7611 | 7623 |
7612 bool Code::ObjectExistsInArea(intptr_t start_offset, | 7624 bool Code::ObjectExistsInArea(intptr_t start_offset, |
7613 intptr_t end_offset) const { | 7625 intptr_t end_offset) const { |
7614 for (intptr_t i = 0; i < this->pointer_offsets_length(); i++) { | 7626 for (intptr_t i = 0; i < this->pointer_offsets_length(); i++) { |
7615 const intptr_t offset = this->GetPointerOffsetAt(i); | 7627 const intptr_t offset = this->GetPointerOffsetAt(i); |
7616 if ((start_offset <= offset) && (offset < end_offset)) { | 7628 if ((start_offset <= offset) && (offset < end_offset)) { |
7617 return false; | 7629 return false; |
7618 } | 7630 } |
(...skipping 3864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11483 } | 11495 } |
11484 return result.raw(); | 11496 return result.raw(); |
11485 } | 11497 } |
11486 | 11498 |
11487 | 11499 |
11488 const char* WeakProperty::ToCString() const { | 11500 const char* WeakProperty::ToCString() const { |
11489 return "_WeakProperty"; | 11501 return "_WeakProperty"; |
11490 } | 11502 } |
11491 | 11503 |
11492 } // namespace dart | 11504 } // namespace dart |
OLD | NEW |