| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 RawClass* Object::library_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 135 RawClass* Object::library_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 136 RawClass* Object::namespace_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 136 RawClass* Object::namespace_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 137 RawClass* Object::code_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 137 RawClass* Object::code_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 138 RawClass* Object::instructions_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 138 RawClass* Object::instructions_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 139 RawClass* Object::pc_descriptors_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 139 RawClass* Object::pc_descriptors_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 140 RawClass* Object::stackmap_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 140 RawClass* Object::stackmap_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 141 RawClass* Object::var_descriptors_class_ = | 141 RawClass* Object::var_descriptors_class_ = |
| 142 reinterpret_cast<RawClass*>(RAW_NULL); | 142 reinterpret_cast<RawClass*>(RAW_NULL); |
| 143 RawClass* Object::exception_handlers_class_ = | 143 RawClass* Object::exception_handlers_class_ = |
| 144 reinterpret_cast<RawClass*>(RAW_NULL); | 144 reinterpret_cast<RawClass*>(RAW_NULL); |
| 145 RawClass* Object::deopt_info_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | |
| 146 RawClass* Object::context_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 145 RawClass* Object::context_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 147 RawClass* Object::context_scope_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 146 RawClass* Object::context_scope_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 148 RawClass* Object::icdata_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 147 RawClass* Object::icdata_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 149 RawClass* Object::megamorphic_cache_class_ = | 148 RawClass* Object::megamorphic_cache_class_ = |
| 150 reinterpret_cast<RawClass*>(RAW_NULL); | 149 reinterpret_cast<RawClass*>(RAW_NULL); |
| 151 RawClass* Object::subtypetestcache_class_ = | 150 RawClass* Object::subtypetestcache_class_ = |
| 152 reinterpret_cast<RawClass*>(RAW_NULL); | 151 reinterpret_cast<RawClass*>(RAW_NULL); |
| 153 RawClass* Object::api_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 152 RawClass* Object::api_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 154 RawClass* Object::language_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 153 RawClass* Object::language_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 155 RawClass* Object::unhandled_exception_class_ = | 154 RawClass* Object::unhandled_exception_class_ = |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 | 551 |
| 553 cls = Class::New<Stackmap>(); | 552 cls = Class::New<Stackmap>(); |
| 554 stackmap_class_ = cls.raw(); | 553 stackmap_class_ = cls.raw(); |
| 555 | 554 |
| 556 cls = Class::New<LocalVarDescriptors>(); | 555 cls = Class::New<LocalVarDescriptors>(); |
| 557 var_descriptors_class_ = cls.raw(); | 556 var_descriptors_class_ = cls.raw(); |
| 558 | 557 |
| 559 cls = Class::New<ExceptionHandlers>(); | 558 cls = Class::New<ExceptionHandlers>(); |
| 560 exception_handlers_class_ = cls.raw(); | 559 exception_handlers_class_ = cls.raw(); |
| 561 | 560 |
| 562 cls = Class::New<DeoptInfo>(); | |
| 563 deopt_info_class_ = cls.raw(); | |
| 564 | |
| 565 cls = Class::New<Context>(); | 561 cls = Class::New<Context>(); |
| 566 context_class_ = cls.raw(); | 562 context_class_ = cls.raw(); |
| 567 | 563 |
| 568 cls = Class::New<ContextScope>(); | 564 cls = Class::New<ContextScope>(); |
| 569 context_scope_class_ = cls.raw(); | 565 context_scope_class_ = cls.raw(); |
| 570 | 566 |
| 571 cls = Class::New<ICData>(); | 567 cls = Class::New<ICData>(); |
| 572 icdata_class_ = cls.raw(); | 568 icdata_class_ = cls.raw(); |
| 573 | 569 |
| 574 cls = Class::New<MegamorphicCache>(); | 570 cls = Class::New<MegamorphicCache>(); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 SET_CLASS_NAME(token_stream, TokenStream); | 805 SET_CLASS_NAME(token_stream, TokenStream); |
| 810 SET_CLASS_NAME(script, Script); | 806 SET_CLASS_NAME(script, Script); |
| 811 SET_CLASS_NAME(library, LibraryClass); | 807 SET_CLASS_NAME(library, LibraryClass); |
| 812 SET_CLASS_NAME(namespace, Namespace); | 808 SET_CLASS_NAME(namespace, Namespace); |
| 813 SET_CLASS_NAME(code, Code); | 809 SET_CLASS_NAME(code, Code); |
| 814 SET_CLASS_NAME(instructions, Instructions); | 810 SET_CLASS_NAME(instructions, Instructions); |
| 815 SET_CLASS_NAME(pc_descriptors, PcDescriptors); | 811 SET_CLASS_NAME(pc_descriptors, PcDescriptors); |
| 816 SET_CLASS_NAME(stackmap, Stackmap); | 812 SET_CLASS_NAME(stackmap, Stackmap); |
| 817 SET_CLASS_NAME(var_descriptors, LocalVarDescriptors); | 813 SET_CLASS_NAME(var_descriptors, LocalVarDescriptors); |
| 818 SET_CLASS_NAME(exception_handlers, ExceptionHandlers); | 814 SET_CLASS_NAME(exception_handlers, ExceptionHandlers); |
| 819 SET_CLASS_NAME(deopt_info, DeoptInfo); | |
| 820 SET_CLASS_NAME(context, Context); | 815 SET_CLASS_NAME(context, Context); |
| 821 SET_CLASS_NAME(context_scope, ContextScope); | 816 SET_CLASS_NAME(context_scope, ContextScope); |
| 822 SET_CLASS_NAME(icdata, ICData); | 817 SET_CLASS_NAME(icdata, ICData); |
| 823 SET_CLASS_NAME(megamorphic_cache, MegamorphicCache); | 818 SET_CLASS_NAME(megamorphic_cache, MegamorphicCache); |
| 824 SET_CLASS_NAME(subtypetestcache, SubtypeTestCache); | 819 SET_CLASS_NAME(subtypetestcache, SubtypeTestCache); |
| 825 SET_CLASS_NAME(api_error, ApiError); | 820 SET_CLASS_NAME(api_error, ApiError); |
| 826 SET_CLASS_NAME(language_error, LanguageError); | 821 SET_CLASS_NAME(language_error, LanguageError); |
| 827 SET_CLASS_NAME(unhandled_exception, UnhandledException); | 822 SET_CLASS_NAME(unhandled_exception, UnhandledException); |
| 828 SET_CLASS_NAME(unwind_error, UnwindError); | 823 SET_CLASS_NAME(unwind_error, UnwindError); |
| 829 | 824 |
| (...skipping 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3202 case kInstructionsCid: | 3197 case kInstructionsCid: |
| 3203 return Symbols::Instructions().raw(); | 3198 return Symbols::Instructions().raw(); |
| 3204 case kPcDescriptorsCid: | 3199 case kPcDescriptorsCid: |
| 3205 return Symbols::PcDescriptors().raw(); | 3200 return Symbols::PcDescriptors().raw(); |
| 3206 case kStackmapCid: | 3201 case kStackmapCid: |
| 3207 return Symbols::Stackmap().raw(); | 3202 return Symbols::Stackmap().raw(); |
| 3208 case kLocalVarDescriptorsCid: | 3203 case kLocalVarDescriptorsCid: |
| 3209 return Symbols::LocalVarDescriptors().raw(); | 3204 return Symbols::LocalVarDescriptors().raw(); |
| 3210 case kExceptionHandlersCid: | 3205 case kExceptionHandlersCid: |
| 3211 return Symbols::ExceptionHandlers().raw(); | 3206 return Symbols::ExceptionHandlers().raw(); |
| 3212 case kDeoptInfoCid: | |
| 3213 return Symbols::DeoptInfo().raw(); | |
| 3214 case kContextCid: | 3207 case kContextCid: |
| 3215 return Symbols::Context().raw(); | 3208 return Symbols::Context().raw(); |
| 3216 case kContextScopeCid: | 3209 case kContextScopeCid: |
| 3217 return Symbols::ContextScope().raw(); | 3210 return Symbols::ContextScope().raw(); |
| 3218 case kICDataCid: | 3211 case kICDataCid: |
| 3219 return Symbols::ICData().raw(); | 3212 return Symbols::ICData().raw(); |
| 3220 case kMegamorphicCacheCid: | 3213 case kMegamorphicCacheCid: |
| 3221 return Symbols::MegamorphicCache().raw(); | 3214 return Symbols::MegamorphicCache().raw(); |
| 3222 case kSubtypeTestCacheCid: | 3215 case kSubtypeTestCacheCid: |
| 3223 return Symbols::SubtypeTestCache().raw(); | 3216 return Symbols::SubtypeTestCache().raw(); |
| (...skipping 7909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11133 return buffer; | 11126 return buffer; |
| 11134 } | 11127 } |
| 11135 | 11128 |
| 11136 | 11129 |
| 11137 void ExceptionHandlers::PrintJSONImpl(JSONStream* stream, | 11130 void ExceptionHandlers::PrintJSONImpl(JSONStream* stream, |
| 11138 bool ref) const { | 11131 bool ref) const { |
| 11139 Object::PrintJSONImpl(stream, ref); | 11132 Object::PrintJSONImpl(stream, ref); |
| 11140 } | 11133 } |
| 11141 | 11134 |
| 11142 | 11135 |
| 11143 intptr_t DeoptInfo::Length() const { | 11136 intptr_t DeoptInfo::FrameSize(const TypedData& packed) { |
| 11144 return Smi::Value(raw_ptr()->length_); | 11137 NoSafepointScope no_safepoint; |
| 11138 typedef ReadStream::Raw<sizeof(intptr_t), intptr_t> Reader; |
| 11139 ReadStream read_stream(reinterpret_cast<uint8_t*>(packed.DataAddr(0)), |
| 11140 packed.LengthInBytes()); |
| 11141 return Reader::Read(&read_stream); |
| 11145 } | 11142 } |
| 11146 | 11143 |
| 11147 | 11144 |
| 11148 intptr_t DeoptInfo::FromIndex(intptr_t index) const { | 11145 intptr_t DeoptInfo::NumMaterializations( |
| 11149 NoSafepointScope no_safepoint; | 11146 const GrowableArray<DeoptInstr*>& unpacked) { |
| 11150 return *(EntryAddr(index, kFromIndex)); | 11147 intptr_t num = 0; |
| 11148 while (unpacked[num]->kind() == DeoptInstr::kMaterializeObject) { |
| 11149 num++; |
| 11150 } |
| 11151 return num; |
| 11151 } | 11152 } |
| 11152 | 11153 |
| 11153 | 11154 |
| 11154 intptr_t DeoptInfo::Instruction(intptr_t index) const { | 11155 void DeoptInfo::UnpackInto(const Array& table, |
| 11156 const TypedData& packed, |
| 11157 GrowableArray<DeoptInstr*>* unpacked, |
| 11158 intptr_t length) { |
| 11155 NoSafepointScope no_safepoint; | 11159 NoSafepointScope no_safepoint; |
| 11156 return *(EntryAddr(index, kInstruction)); | 11160 typedef ReadStream::Raw<sizeof(intptr_t), intptr_t> Reader; |
| 11157 } | 11161 ReadStream read_stream(reinterpret_cast<uint8_t*>(packed.DataAddr(0)), |
| 11162 packed.LengthInBytes()); |
| 11163 const intptr_t frame_size = Reader::Read(&read_stream); // Skip frame size. |
| 11164 USE(frame_size); |
| 11158 | 11165 |
| 11166 const intptr_t suffix_length = Reader::Read(&read_stream); |
| 11167 if (suffix_length != 0) { |
| 11168 ASSERT(suffix_length > 1); |
| 11169 const intptr_t info_number = Reader::Read(&read_stream); |
| 11159 | 11170 |
| 11160 intptr_t DeoptInfo::FrameSize() const { | 11171 TypedData& suffix = TypedData::Handle(); |
| 11161 return TranslationLength() - NumMaterializations(); | 11172 Smi& offset = Smi::Handle(); |
| 11162 } | 11173 Smi& reason_and_flags = Smi::Handle(); |
| 11174 DeoptTable::GetEntry( |
| 11175 table, info_number, &offset, &suffix, &reason_and_flags); |
| 11176 UnpackInto(table, suffix, unpacked, suffix_length); |
| 11177 } |
| 11163 | 11178 |
| 11164 | 11179 while ((read_stream.PendingBytes() > 0) && |
| 11165 intptr_t DeoptInfo::TranslationLength() const { | 11180 (unpacked->length() < length)) { |
| 11166 intptr_t length = Length(); | 11181 const intptr_t instruction = Reader::Read(&read_stream); |
| 11167 if (Instruction(length - 1) != DeoptInstr::kSuffix) return length; | 11182 const intptr_t from_index = Reader::Read(&read_stream); |
| 11168 | 11183 unpacked->Add(DeoptInstr::Create(instruction, from_index)); |
| 11169 // If the last command is a suffix, add in the length of the suffix and | |
| 11170 // do not count the suffix command as a translation command. | |
| 11171 intptr_t ignored = 0; | |
| 11172 intptr_t suffix_length = | |
| 11173 DeoptInstr::DecodeSuffix(FromIndex(length - 1), &ignored); | |
| 11174 return length + suffix_length - 1; | |
| 11175 } | |
| 11176 | |
| 11177 | |
| 11178 intptr_t DeoptInfo::NumMaterializations() const { | |
| 11179 intptr_t pos = 0; | |
| 11180 while (Instruction(pos) == DeoptInstr::kMaterializeObject) { | |
| 11181 pos++; | |
| 11182 } | |
| 11183 return pos; | |
| 11184 } | |
| 11185 | |
| 11186 | |
| 11187 void DeoptInfo::ToInstructions(const Array& table, | |
| 11188 GrowableArray<DeoptInstr*>* instructions) const { | |
| 11189 ASSERT(instructions->is_empty()); | |
| 11190 Smi& offset = Smi::Handle(); | |
| 11191 DeoptInfo& info = DeoptInfo::Handle(raw()); | |
| 11192 Smi& reason_and_flags = Smi::Handle(); | |
| 11193 intptr_t index = 0; | |
| 11194 intptr_t length = TranslationLength(); | |
| 11195 while (index < length) { | |
| 11196 intptr_t instruction = info.Instruction(index); | |
| 11197 intptr_t from_index = info.FromIndex(index); | |
| 11198 if (instruction == DeoptInstr::kSuffix) { | |
| 11199 // Suffix instructions cause us to 'jump' to another translation, | |
| 11200 // changing info, length and index. | |
| 11201 intptr_t info_number = 0; | |
| 11202 intptr_t suffix_length = | |
| 11203 DeoptInstr::DecodeSuffix(from_index, &info_number); | |
| 11204 DeoptTable::GetEntry( | |
| 11205 table, info_number, &offset, &info, &reason_and_flags); | |
| 11206 length = info.TranslationLength(); | |
| 11207 index = length - suffix_length; | |
| 11208 } else { | |
| 11209 instructions->Add(DeoptInstr::Create(instruction, from_index)); | |
| 11210 ++index; | |
| 11211 } | |
| 11212 } | 11184 } |
| 11213 } | 11185 } |
| 11214 | 11186 |
| 11215 | 11187 |
| 11216 const char* DeoptInfo::ToCString() const { | 11188 void DeoptInfo::Unpack(const Array& table, |
| 11217 if (Length() == 0) { | 11189 const TypedData& packed, |
| 11218 return "No DeoptInfo"; | 11190 GrowableArray<DeoptInstr*>* unpacked) { |
| 11219 } | 11191 ASSERT(unpacked->is_empty()); |
| 11220 // Convert to DeoptInstr. | 11192 |
| 11221 GrowableArray<DeoptInstr*> deopt_instrs(Length()); | 11193 // Pass kMaxInt32 as the length to unpack all instructions from the |
| 11222 for (intptr_t i = 0; i < Length(); i++) { | 11194 // packed stream. |
| 11223 deopt_instrs.Add(DeoptInstr::Create(Instruction(i), FromIndex(i))); | 11195 UnpackInto(table, packed, unpacked, kMaxInt32); |
| 11224 } | 11196 |
| 11197 unpacked->Reverse(); |
| 11198 } |
| 11199 |
| 11200 |
| 11201 const char* DeoptInfo::ToCString(const Array& deopt_table, |
| 11202 const TypedData& packed) { |
| 11203 GrowableArray<DeoptInstr*> deopt_instrs; |
| 11204 Unpack(deopt_table, packed, &deopt_instrs); |
| 11205 |
| 11225 // Compute the buffer size required. | 11206 // Compute the buffer size required. |
| 11226 intptr_t len = 1; // Trailing '\0'. | 11207 intptr_t len = 1; // Trailing '\0'. |
| 11227 for (intptr_t i = 0; i < Length(); i++) { | 11208 for (intptr_t i = 0; i < deopt_instrs.length(); i++) { |
| 11228 len += OS::SNPrint(NULL, 0, "[%s]", deopt_instrs[i]->ToCString()); | 11209 len += OS::SNPrint(NULL, 0, "[%s]", deopt_instrs[i]->ToCString()); |
| 11229 } | 11210 } |
| 11211 |
| 11230 // Allocate the buffer. | 11212 // Allocate the buffer. |
| 11231 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len); | 11213 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 11214 |
| 11232 // Layout the fields in the buffer. | 11215 // Layout the fields in the buffer. |
| 11233 intptr_t index = 0; | 11216 intptr_t index = 0; |
| 11234 for (intptr_t i = 0; i < Length(); i++) { | 11217 for (intptr_t i = 0; i < deopt_instrs.length(); i++) { |
| 11235 index += OS::SNPrint((buffer + index), | 11218 index += OS::SNPrint((buffer + index), |
| 11236 (len - index), | 11219 (len - index), |
| 11237 "[%s]", | 11220 "[%s]", |
| 11238 deopt_instrs[i]->ToCString()); | 11221 deopt_instrs[i]->ToCString()); |
| 11239 } | 11222 } |
| 11223 |
| 11240 return buffer; | 11224 return buffer; |
| 11241 } | 11225 } |
| 11242 | 11226 |
| 11243 | 11227 |
| 11244 // Returns a bool so it can be asserted. | 11228 // Returns a bool so it can be asserted. |
| 11245 bool DeoptInfo::VerifyDecompression(const GrowableArray<DeoptInstr*>& original, | 11229 bool DeoptInfo::VerifyDecompression(const GrowableArray<DeoptInstr*>& original, |
| 11246 const Array& deopt_table) const { | 11230 const Array& deopt_table, |
| 11247 intptr_t length = TranslationLength(); | 11231 const TypedData& packed) { |
| 11248 GrowableArray<DeoptInstr*> unpacked(length); | 11232 GrowableArray<DeoptInstr*> unpacked; |
| 11249 ToInstructions(deopt_table, &unpacked); | 11233 Unpack(deopt_table, packed, &unpacked); |
| 11250 ASSERT(unpacked.length() == original.length()); | 11234 ASSERT(unpacked.length() == original.length()); |
| 11251 for (intptr_t i = 0; i < unpacked.length(); ++i) { | 11235 for (intptr_t i = 0; i < unpacked.length(); ++i) { |
| 11252 ASSERT(unpacked[i]->Equals(*original[i])); | 11236 ASSERT(unpacked[i]->Equals(*original[i])); |
| 11253 } | 11237 } |
| 11254 return true; | 11238 return true; |
| 11255 } | 11239 } |
| 11256 | 11240 |
| 11257 | 11241 |
| 11258 void DeoptInfo::PrintJSONImpl(JSONStream* stream, bool ref) const { | |
| 11259 Object::PrintJSONImpl(stream, ref); | |
| 11260 } | |
| 11261 | |
| 11262 | |
| 11263 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { | |
| 11264 ASSERT(Object::deopt_info_class() != Class::null()); | |
| 11265 if ((num_commands < 0) || (num_commands > kMaxElements)) { | |
| 11266 FATAL1("Fatal error in DeoptInfo::New(): invalid num_commands %" Pd "\n", | |
| 11267 num_commands); | |
| 11268 } | |
| 11269 DeoptInfo& result = DeoptInfo::Handle(); | |
| 11270 { | |
| 11271 uword size = DeoptInfo::InstanceSize(num_commands); | |
| 11272 RawObject* raw = Object::Allocate(DeoptInfo::kClassId, | |
| 11273 size, | |
| 11274 Heap::kOld); | |
| 11275 NoSafepointScope no_safepoint; | |
| 11276 result ^= raw; | |
| 11277 result.SetLength(num_commands); | |
| 11278 } | |
| 11279 return result.raw(); | |
| 11280 } | |
| 11281 | |
| 11282 | |
| 11283 void DeoptInfo::SetLength(intptr_t value) const { | |
| 11284 // This is only safe because we create a new Smi, which does not cause | |
| 11285 // heap allocation. | |
| 11286 StoreSmi(&raw_ptr()->length_, Smi::New(value)); | |
| 11287 } | |
| 11288 | |
| 11289 | |
| 11290 void DeoptInfo::SetAt(intptr_t index, | |
| 11291 intptr_t instr_kind, | |
| 11292 intptr_t from_index) const { | |
| 11293 NoSafepointScope no_safepoint; | |
| 11294 *(EntryAddr(index, kInstruction)) = instr_kind; | |
| 11295 *(EntryAddr(index, kFromIndex)) = from_index; | |
| 11296 } | |
| 11297 | |
| 11298 | |
| 11299 const char* ICData::ToCString() const { | 11242 const char* ICData::ToCString() const { |
| 11300 const char* kFormat = "ICData target:'%s' num-args: %" Pd | 11243 const char* kFormat = "ICData target:'%s' num-args: %" Pd |
| 11301 " num-checks: %" Pd ""; | 11244 " num-checks: %" Pd ""; |
| 11302 const String& name = String::Handle(target_name()); | 11245 const String& name = String::Handle(target_name()); |
| 11303 const intptr_t num_args = NumArgsTested(); | 11246 const intptr_t num_args = NumArgsTested(); |
| 11304 const intptr_t num_checks = NumberOfChecks(); | 11247 const intptr_t num_checks = NumberOfChecks(); |
| 11305 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString(), | 11248 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString(), |
| 11306 num_args, num_checks) + 1; | 11249 num_args, num_checks) + 1; |
| 11307 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 11250 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 11308 OS::SNPrint(chars, len, kFormat, name.ToCString(), num_args, num_checks); | 11251 OS::SNPrint(chars, len, kFormat, name.ToCString(), num_args, num_checks); |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12101 } | 12044 } |
| 12102 #endif // DEBUG | 12045 #endif // DEBUG |
| 12103 } | 12046 } |
| 12104 | 12047 |
| 12105 | 12048 |
| 12106 bool Code::HasBreakpoint() const { | 12049 bool Code::HasBreakpoint() const { |
| 12107 return Isolate::Current()->debugger()->HasBreakpoint(*this); | 12050 return Isolate::Current()->debugger()->HasBreakpoint(*this); |
| 12108 } | 12051 } |
| 12109 | 12052 |
| 12110 | 12053 |
| 12111 RawDeoptInfo* Code::GetDeoptInfoAtPc(uword pc, | 12054 RawTypedData* Code::GetDeoptInfoAtPc(uword pc, |
| 12112 ICData::DeoptReasonId* deopt_reason, | 12055 ICData::DeoptReasonId* deopt_reason, |
| 12113 uint32_t* deopt_flags) const { | 12056 uint32_t* deopt_flags) const { |
| 12114 ASSERT(is_optimized()); | 12057 ASSERT(is_optimized()); |
| 12115 const Instructions& instrs = Instructions::Handle(instructions()); | 12058 const Instructions& instrs = Instructions::Handle(instructions()); |
| 12116 uword code_entry = instrs.EntryPoint(); | 12059 uword code_entry = instrs.EntryPoint(); |
| 12117 const Array& table = Array::Handle(deopt_info_array()); | 12060 const Array& table = Array::Handle(deopt_info_array()); |
| 12118 ASSERT(!table.IsNull()); | 12061 ASSERT(!table.IsNull()); |
| 12119 // Linear search for the PC offset matching the target PC. | 12062 // Linear search for the PC offset matching the target PC. |
| 12120 intptr_t length = DeoptTable::GetLength(table); | 12063 intptr_t length = DeoptTable::GetLength(table); |
| 12121 Smi& offset = Smi::Handle(); | 12064 Smi& offset = Smi::Handle(); |
| 12122 Smi& reason_and_flags = Smi::Handle(); | 12065 Smi& reason_and_flags = Smi::Handle(); |
| 12123 DeoptInfo& info = DeoptInfo::Handle(); | 12066 TypedData& info = TypedData::Handle(); |
| 12124 for (intptr_t i = 0; i < length; ++i) { | 12067 for (intptr_t i = 0; i < length; ++i) { |
| 12125 DeoptTable::GetEntry(table, i, &offset, &info, &reason_and_flags); | 12068 DeoptTable::GetEntry(table, i, &offset, &info, &reason_and_flags); |
| 12126 if (pc == (code_entry + offset.Value())) { | 12069 if (pc == (code_entry + offset.Value())) { |
| 12127 ASSERT(!info.IsNull()); | 12070 ASSERT(!info.IsNull()); |
| 12128 *deopt_reason = DeoptTable::ReasonField::decode(reason_and_flags.Value()); | 12071 *deopt_reason = DeoptTable::ReasonField::decode(reason_and_flags.Value()); |
| 12129 *deopt_flags = DeoptTable::FlagsField::decode(reason_and_flags.Value()); | 12072 *deopt_flags = DeoptTable::FlagsField::decode(reason_and_flags.Value()); |
| 12130 return info.raw(); | 12073 return info.raw(); |
| 12131 } | 12074 } |
| 12132 } | 12075 } |
| 12133 *deopt_reason = ICData::kDeoptUnknown; | 12076 *deopt_reason = ICData::kDeoptUnknown; |
| 12134 return DeoptInfo::null(); | 12077 return TypedData::null(); |
| 12135 } | 12078 } |
| 12136 | 12079 |
| 12137 | 12080 |
| 12138 intptr_t Code::BinarySearchInSCallTable(uword pc) const { | 12081 intptr_t Code::BinarySearchInSCallTable(uword pc) const { |
| 12139 NoSafepointScope no_safepoint; | 12082 NoSafepointScope no_safepoint; |
| 12140 const Array& table = Array::Handle(raw_ptr()->static_calls_target_table_); | 12083 const Array& table = Array::Handle(raw_ptr()->static_calls_target_table_); |
| 12141 RawObject* key = reinterpret_cast<RawObject*>(Smi::New(pc - EntryPoint())); | 12084 RawObject* key = reinterpret_cast<RawObject*>(Smi::New(pc - EntryPoint())); |
| 12142 intptr_t imin = 0; | 12085 intptr_t imin = 0; |
| 12143 intptr_t imax = table.Length() / kSCallTableEntryLength; | 12086 intptr_t imax = table.Length() / kSCallTableEntryLength; |
| 12144 while (imax >= imin) { | 12087 while (imax >= imin) { |
| (...skipping 8580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20725 return tag_label.ToCString(); | 20668 return tag_label.ToCString(); |
| 20726 } | 20669 } |
| 20727 | 20670 |
| 20728 | 20671 |
| 20729 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20672 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20730 Instance::PrintJSONImpl(stream, ref); | 20673 Instance::PrintJSONImpl(stream, ref); |
| 20731 } | 20674 } |
| 20732 | 20675 |
| 20733 | 20676 |
| 20734 } // namespace dart | 20677 } // namespace dart |
| OLD | NEW |