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 10108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10119 result ^= raw; | 10119 result ^= raw; |
10120 result.SetLength(num_descriptors); | 10120 result.SetLength(num_descriptors); |
10121 } | 10121 } |
10122 return result.raw(); | 10122 return result.raw(); |
10123 } | 10123 } |
10124 | 10124 |
10125 | 10125 |
10126 const char* PcDescriptors::KindAsStr(intptr_t index) const { | 10126 const char* PcDescriptors::KindAsStr(intptr_t index) const { |
10127 switch (DescriptorKind(index)) { | 10127 switch (DescriptorKind(index)) { |
10128 case PcDescriptors::kDeopt: return "deopt "; | 10128 case PcDescriptors::kDeopt: return "deopt "; |
10129 case PcDescriptors::kEntryPatch: return "entry-patch "; | |
10130 case PcDescriptors::kPatchCode: return "patch "; | |
10131 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt "; | |
10132 case PcDescriptors::kIcCall: return "ic-call "; | 10129 case PcDescriptors::kIcCall: return "ic-call "; |
10133 case PcDescriptors::kOptStaticCall: return "opt-call "; | 10130 case PcDescriptors::kOptStaticCall: return "opt-call "; |
10134 case PcDescriptors::kUnoptStaticCall: return "unopt-call "; | 10131 case PcDescriptors::kUnoptStaticCall: return "unopt-call "; |
10135 case PcDescriptors::kClosureCall: return "closure-call "; | 10132 case PcDescriptors::kClosureCall: return "closure-call "; |
10136 case PcDescriptors::kReturn: return "return "; | 10133 case PcDescriptors::kReturn: return "return "; |
10137 case PcDescriptors::kRuntimeCall: return "runtime-call "; | 10134 case PcDescriptors::kRuntimeCall: return "runtime-call "; |
10138 case PcDescriptors::kOsrEntry: return "osr-entry "; | 10135 case PcDescriptors::kOsrEntry: return "osr-entry "; |
10139 case PcDescriptors::kOther: return "other "; | 10136 case PcDescriptors::kOther: return "other "; |
10140 } | 10137 } |
10141 UNREACHABLE(); | 10138 UNREACHABLE(); |
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11608 { | 11605 { |
11609 uword size = Code::InstanceSize(pointer_offsets_length); | 11606 uword size = Code::InstanceSize(pointer_offsets_length); |
11610 RawObject* raw = Object::Allocate(Code::kClassId, size, Heap::kOld); | 11607 RawObject* raw = Object::Allocate(Code::kClassId, size, Heap::kOld); |
11611 NoGCScope no_gc; | 11608 NoGCScope no_gc; |
11612 result ^= raw; | 11609 result ^= raw; |
11613 result.set_pointer_offsets_length(pointer_offsets_length); | 11610 result.set_pointer_offsets_length(pointer_offsets_length); |
11614 result.set_is_optimized(false); | 11611 result.set_is_optimized(false); |
11615 result.set_is_alive(false); | 11612 result.set_is_alive(false); |
11616 result.set_comments(Comments::New(0)); | 11613 result.set_comments(Comments::New(0)); |
11617 result.set_compile_timestamp(0); | 11614 result.set_compile_timestamp(0); |
| 11615 result.set_entry_patch_pc(kInvalidPc); |
| 11616 result.set_patch_code_pc(kInvalidPc); |
| 11617 result.set_lazy_deopt_pc(kInvalidPc); |
11618 result.set_pc_descriptors(Object::empty_descriptors()); | 11618 result.set_pc_descriptors(Object::empty_descriptors()); |
11619 } | 11619 } |
11620 return result.raw(); | 11620 return result.raw(); |
11621 } | 11621 } |
11622 | 11622 |
11623 | 11623 |
11624 RawCode* Code::FinalizeCode(const char* name, | 11624 RawCode* Code::FinalizeCode(const char* name, |
11625 Assembler* assembler, | 11625 Assembler* assembler, |
11626 bool optimized) { | 11626 bool optimized) { |
11627 ASSERT(assembler != NULL); | 11627 ASSERT(assembler != NULL); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11887 } | 11887 } |
11888 } | 11888 } |
11889 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | 11889 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
11890 if (!descriptors.IsNull()) { | 11890 if (!descriptors.IsNull()) { |
11891 JSONObject desc(&jsobj, "descriptors"); | 11891 JSONObject desc(&jsobj, "descriptors"); |
11892 descriptors.PrintToJSONObject(&desc); | 11892 descriptors.PrintToJSONObject(&desc); |
11893 } | 11893 } |
11894 } | 11894 } |
11895 | 11895 |
11896 | 11896 |
| 11897 uword Code::GetEntryPatchPc() const { |
| 11898 return (entry_patch_pc() != kInvalidPc) ? EntryPoint() + entry_patch_pc() : 0; |
| 11899 } |
| 11900 |
| 11901 |
11897 uword Code::GetPatchCodePc() const { | 11902 uword Code::GetPatchCodePc() const { |
11898 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | 11903 return (patch_code_pc() != kInvalidPc) ? EntryPoint() + patch_code_pc() : 0; |
11899 return descriptors.GetPcForKind(PcDescriptors::kPatchCode); | |
11900 } | 11904 } |
11901 | 11905 |
11902 | 11906 |
11903 uword Code::GetLazyDeoptPc() const { | 11907 uword Code::GetLazyDeoptPc() const { |
11904 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | 11908 return (lazy_deopt_pc() != kInvalidPc) ? EntryPoint() + lazy_deopt_pc() : 0; |
11905 return descriptors.GetPcForKind(PcDescriptors::kLazyDeoptJump); | |
11906 } | 11909 } |
11907 | 11910 |
11908 | 11911 |
11909 bool Code::ObjectExistsInArea(intptr_t start_offset, | 11912 bool Code::ObjectExistsInArea(intptr_t start_offset, |
11910 intptr_t end_offset) const { | 11913 intptr_t end_offset) const { |
11911 for (intptr_t i = 0; i < this->pointer_offsets_length(); i++) { | 11914 for (intptr_t i = 0; i < this->pointer_offsets_length(); i++) { |
11912 const intptr_t offset = this->GetPointerOffsetAt(i); | 11915 const intptr_t offset = this->GetPointerOffsetAt(i); |
11913 if ((start_offset <= offset) && (offset < end_offset)) { | 11916 if ((start_offset <= offset) && (offset < end_offset)) { |
11914 return false; | 11917 return false; |
11915 } | 11918 } |
(...skipping 7064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18980 return tag_label.ToCString(); | 18983 return tag_label.ToCString(); |
18981 } | 18984 } |
18982 | 18985 |
18983 | 18986 |
18984 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 18987 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
18985 Instance::PrintJSONImpl(stream, ref); | 18988 Instance::PrintJSONImpl(stream, ref); |
18986 } | 18989 } |
18987 | 18990 |
18988 | 18991 |
18989 } // namespace dart | 18992 } // namespace dart |
OLD | NEW |