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 6855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6866 NoGCScope no_gc; | 6866 NoGCScope no_gc; |
6867 result ^= raw; | 6867 result ^= raw; |
6868 result.SetLength(num_descriptors); | 6868 result.SetLength(num_descriptors); |
6869 } | 6869 } |
6870 return result.raw(); | 6870 return result.raw(); |
6871 } | 6871 } |
6872 | 6872 |
6873 | 6873 |
6874 const char* PcDescriptors::KindAsStr(intptr_t index) const { | 6874 const char* PcDescriptors::KindAsStr(intptr_t index) const { |
6875 switch (DescriptorKind(index)) { | 6875 switch (DescriptorKind(index)) { |
6876 case PcDescriptors::kDeoptBefore: return "deopt-before "; | 6876 case PcDescriptors::kDeoptBefore: return "deopt-before "; |
6877 case PcDescriptors::kDeoptAfter: return "deopt-after "; | 6877 case PcDescriptors::kDeoptAfter: return "deopt-after "; |
6878 case PcDescriptors::kDeoptIndex: return "deopt-ix "; | 6878 case PcDescriptors::kDeoptIndex: return "deopt-ix "; |
6879 case PcDescriptors::kPatchCode: return "patch "; | 6879 case PcDescriptors::kPatchCode: return "patch "; |
6880 case PcDescriptors::kIcCall: return "ic-call "; | 6880 case PcDescriptors::kLazyDeoptJump: return "lazy "; |
siva
2012/09/07 23:16:17
why not make it "lazy-deopt"
would be more explici
srdjan
2012/09/12 06:15:26
Done.
| |
6881 case PcDescriptors::kFuncCall: return "fn-call "; | 6881 case PcDescriptors::kIcCall: return "ic-call "; |
6882 case PcDescriptors::kReturn: return "return "; | 6882 case PcDescriptors::kFuncCall: return "fn-call "; |
6883 case PcDescriptors::kOther: return "other "; | 6883 case PcDescriptors::kReturn: return "return "; |
6884 case PcDescriptors::kOther: return "other "; | |
6884 } | 6885 } |
6885 UNREACHABLE(); | 6886 UNREACHABLE(); |
6886 return ""; | 6887 return ""; |
6887 } | 6888 } |
6888 | 6889 |
6889 | 6890 |
6890 void PcDescriptors::PrintHeaderString() { | 6891 void PcDescriptors::PrintHeaderString() { |
6891 // 4 bits per hex digit + 2 for "0x". | 6892 // 4 bits per hex digit + 2 for "0x". |
6892 const int addr_width = (kBitsPerWord / 4) + 2; | 6893 const int addr_width = (kBitsPerWord / 4) + 2; |
6893 // "*" in a printf format specifier tells it to read the field width from | 6894 // "*" 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... | |
6971 if (deopt_id != Isolate::kNoDeoptId) { | 6972 if (deopt_id != Isolate::kNoDeoptId) { |
6972 ASSERT(DeoptId(k) != deopt_id); | 6973 ASSERT(DeoptId(k) != deopt_id); |
6973 } | 6974 } |
6974 } | 6975 } |
6975 } | 6976 } |
6976 } | 6977 } |
6977 #endif // DEBUG | 6978 #endif // DEBUG |
6978 } | 6979 } |
6979 | 6980 |
6980 | 6981 |
6982 uword PcDescriptors::GetPcForKind(Kind kind) const { | |
6983 for (intptr_t i = 0; i < Length(); i++) { | |
6984 if (DescriptorKind(i) == kind) { | |
6985 return PC(i); | |
6986 } | |
6987 } | |
6988 return 0; | |
6989 } | |
6990 | |
6991 | |
6981 void Stackmap::SetCode(const dart::Code& code) const { | 6992 void Stackmap::SetCode(const dart::Code& code) const { |
6982 StorePointer(&raw_ptr()->code_, code.raw()); | 6993 StorePointer(&raw_ptr()->code_, code.raw()); |
6983 } | 6994 } |
6984 | 6995 |
6985 | 6996 |
6986 bool Stackmap::GetBit(intptr_t bit_index) const { | 6997 bool Stackmap::GetBit(intptr_t bit_index) const { |
6987 ASSERT(InRange(bit_index)); | 6998 ASSERT(InRange(bit_index)); |
6988 int byte_index = bit_index >> kBitsPerByteLog2; | 6999 int byte_index = bit_index >> kBitsPerByteLog2; |
6989 int bit_remainder = bit_index & (kBitsPerByte - 1); | 7000 int bit_remainder = bit_index & (kBitsPerByte - 1); |
6990 uint8_t byte_mask = 1U << bit_remainder; | 7001 uint8_t byte_mask = 1U << bit_remainder; |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7539 const char* kFormat = "Code entry:0x%d"; | 7550 const char* kFormat = "Code entry:0x%d"; |
7540 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; | 7551 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; |
7541 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 7552 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
7542 OS::SNPrint(chars, len, kFormat, EntryPoint()); | 7553 OS::SNPrint(chars, len, kFormat, EntryPoint()); |
7543 return chars; | 7554 return chars; |
7544 } | 7555 } |
7545 | 7556 |
7546 | 7557 |
7547 uword Code::GetPatchCodePc() const { | 7558 uword Code::GetPatchCodePc() const { |
7548 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | 7559 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
7549 for (intptr_t i = 0; i < descriptors.Length(); i++) { | 7560 return descriptors.GetPcForKind(PcDescriptors::kPatchCode); |
7550 if (descriptors.DescriptorKind(i) == PcDescriptors::kPatchCode) { | 7561 } |
7551 return descriptors.PC(i); | 7562 |
7552 } | 7563 |
7553 } | 7564 uword Code::GetLazyDeoptPc() const { |
7554 return 0; | 7565 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
7566 return descriptors.GetPcForKind(PcDescriptors::kLazyDeoptJump); | |
7555 } | 7567 } |
7556 | 7568 |
7557 | 7569 |
7558 bool Code::ObjectExistsInArea(intptr_t start_offset, | 7570 bool Code::ObjectExistsInArea(intptr_t start_offset, |
7559 intptr_t end_offset) const { | 7571 intptr_t end_offset) const { |
7560 for (intptr_t i = 0; i < this->pointer_offsets_length(); i++) { | 7572 for (intptr_t i = 0; i < this->pointer_offsets_length(); i++) { |
7561 const intptr_t offset = this->GetPointerOffsetAt(i); | 7573 const intptr_t offset = this->GetPointerOffsetAt(i); |
7562 if ((start_offset <= offset) && (offset < end_offset)) { | 7574 if ((start_offset <= offset) && (offset < end_offset)) { |
7563 return false; | 7575 return false; |
7564 } | 7576 } |
(...skipping 3849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11414 } | 11426 } |
11415 return result.raw(); | 11427 return result.raw(); |
11416 } | 11428 } |
11417 | 11429 |
11418 | 11430 |
11419 const char* WeakProperty::ToCString() const { | 11431 const char* WeakProperty::ToCString() const { |
11420 return "_WeakProperty"; | 11432 return "_WeakProperty"; |
11421 } | 11433 } |
11422 | 11434 |
11423 } // namespace dart | 11435 } // namespace dart |
OLD | NEW |