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