| 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 3693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3704 } | 3704 } |
| 3705 | 3705 |
| 3706 | 3706 |
| 3707 void Class::DisableAllocationStub() const { | 3707 void Class::DisableAllocationStub() const { |
| 3708 const Code& existing_stub = Code::Handle(allocation_stub()); | 3708 const Code& existing_stub = Code::Handle(allocation_stub()); |
| 3709 if (existing_stub.IsNull()) { | 3709 if (existing_stub.IsNull()) { |
| 3710 return; | 3710 return; |
| 3711 } | 3711 } |
| 3712 ASSERT(!CodePatcher::IsEntryPatched(existing_stub)); | 3712 ASSERT(!CodePatcher::IsEntryPatched(existing_stub)); |
| 3713 // Patch the stub so that the next caller will regenerate the stub. | 3713 // Patch the stub so that the next caller will regenerate the stub. |
| 3714 CodePatcher::PatchEntry(existing_stub); | 3714 CodePatcher::PatchEntry( |
| 3715 existing_stub, |
| 3716 Code::Handle(StubCode::FixAllocationStubTarget_entry()->code())); |
| 3715 // Disassociate the existing stub from class. | 3717 // Disassociate the existing stub from class. |
| 3716 StorePointer(&raw_ptr()->allocation_stub_, Code::null()); | 3718 StorePointer(&raw_ptr()->allocation_stub_, Code::null()); |
| 3717 } | 3719 } |
| 3718 | 3720 |
| 3719 | 3721 |
| 3720 bool Class::IsFunctionClass() const { | 3722 bool Class::IsFunctionClass() const { |
| 3721 return raw() == Type::Handle(Type::Function()).type_class(); | 3723 return raw() == Type::Handle(Type::Function()).type_class(); |
| 3722 } | 3724 } |
| 3723 | 3725 |
| 3724 | 3726 |
| (...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5222 StorePointer(&raw_ptr()->source_class_, value.raw()); | 5224 StorePointer(&raw_ptr()->source_class_, value.raw()); |
| 5223 } | 5225 } |
| 5224 | 5226 |
| 5225 | 5227 |
| 5226 bool Function::HasBreakpoint() const { | 5228 bool Function::HasBreakpoint() const { |
| 5227 return Isolate::Current()->debugger()->HasBreakpoint(*this); | 5229 return Isolate::Current()->debugger()->HasBreakpoint(*this); |
| 5228 } | 5230 } |
| 5229 | 5231 |
| 5230 | 5232 |
| 5231 void Function::SetInstructions(const Code& value) const { | 5233 void Function::SetInstructions(const Code& value) const { |
| 5232 StorePointer(&raw_ptr()->instructions_, value.instructions()); | 5234 StorePointer(&raw_ptr()->code_, value.raw()); |
| 5233 StoreNonPointer(&raw_ptr()->entry_point_, value.EntryPoint()); | 5235 StoreNonPointer(&raw_ptr()->entry_point_, value.EntryPoint()); |
| 5234 } | 5236 } |
| 5235 | 5237 |
| 5236 void Function::AttachCode(const Code& value) const { | 5238 void Function::AttachCode(const Code& value) const { |
| 5237 SetInstructions(value); | 5239 SetInstructions(value); |
| 5238 ASSERT(Function::Handle(value.function()).IsNull() || | 5240 ASSERT(Function::Handle(value.function()).IsNull() || |
| 5239 (value.function() == this->raw())); | 5241 (value.function() == this->raw())); |
| 5240 value.set_owner(*this); | 5242 value.set_owner(*this); |
| 5241 } | 5243 } |
| 5242 | 5244 |
| 5243 | 5245 |
| 5244 bool Function::HasCode() const { | 5246 bool Function::HasCode() const { |
| 5245 ASSERT(raw_ptr()->instructions_ != Instructions::null()); | 5247 ASSERT(raw_ptr()->code_ != Code::null()); |
| 5246 return raw_ptr()->instructions_ != | 5248 return raw_ptr()->code_ != StubCode::LazyCompile_entry()->code(); |
| 5247 StubCode::LazyCompile_entry()->code()->ptr()->instructions_; | |
| 5248 } | 5249 } |
| 5249 | 5250 |
| 5250 | 5251 |
| 5251 void Function::ClearCode() const { | 5252 void Function::ClearCode() const { |
| 5252 ASSERT((usage_counter() != 0) || (ic_data_array() == Array::null())); | 5253 ASSERT((usage_counter() != 0) || (ic_data_array() == Array::null())); |
| 5253 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); | 5254 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); |
| 5254 SetInstructions(Code::Handle(StubCode::LazyCompile_entry()->code())); | 5255 SetInstructions(Code::Handle(StubCode::LazyCompile_entry()->code())); |
| 5255 } | 5256 } |
| 5256 | 5257 |
| 5257 | 5258 |
| 5258 void Function::SwitchToUnoptimizedCode() const { | 5259 void Function::SwitchToUnoptimizedCode() const { |
| 5259 ASSERT(HasOptimizedCode()); | 5260 ASSERT(HasOptimizedCode()); |
| 5260 Thread* thread = Thread::Current(); | 5261 Thread* thread = Thread::Current(); |
| 5261 Isolate* isolate = thread->isolate(); | 5262 Isolate* isolate = thread->isolate(); |
| 5262 Zone* zone = thread->zone(); | 5263 Zone* zone = thread->zone(); |
| 5263 const Code& current_code = Code::Handle(zone, CurrentCode()); | 5264 const Code& current_code = Code::Handle(zone, CurrentCode()); |
| 5264 | 5265 |
| 5265 if (FLAG_trace_deoptimization_verbose) { | 5266 if (FLAG_trace_deoptimization_verbose) { |
| 5266 THR_Print("Disabling optimized code: '%s' entry: %#" Px "\n", | 5267 THR_Print("Disabling optimized code: '%s' entry: %#" Px "\n", |
| 5267 ToFullyQualifiedCString(), | 5268 ToFullyQualifiedCString(), |
| 5268 current_code.EntryPoint()); | 5269 current_code.EntryPoint()); |
| 5269 } | 5270 } |
| 5270 // Patch entry of the optimized code. | 5271 // Patch entry of the optimized code. |
| 5271 CodePatcher::PatchEntry(current_code); | 5272 CodePatcher::PatchEntry( |
| 5273 current_code, Code::Handle(StubCode::FixCallersTarget_entry()->code())); |
| 5272 const Error& error = Error::Handle(zone, | 5274 const Error& error = Error::Handle(zone, |
| 5273 Compiler::EnsureUnoptimizedCode(thread, *this)); | 5275 Compiler::EnsureUnoptimizedCode(thread, *this)); |
| 5274 if (!error.IsNull()) { | 5276 if (!error.IsNull()) { |
| 5275 Exceptions::PropagateError(error); | 5277 Exceptions::PropagateError(error); |
| 5276 } | 5278 } |
| 5277 const Code& unopt_code = Code::Handle(zone, unoptimized_code()); | 5279 const Code& unopt_code = Code::Handle(zone, unoptimized_code()); |
| 5278 AttachCode(unopt_code); | 5280 AttachCode(unopt_code); |
| 5279 CodePatcher::RestoreEntry(unopt_code); | 5281 CodePatcher::RestoreEntry(unopt_code); |
| 5280 isolate->TrackDeoptimizedCode(current_code); | 5282 isolate->TrackDeoptimizedCode(current_code); |
| 5281 } | 5283 } |
| (...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6725 const Object& obj = Object::Handle(raw_ptr()->owner_); | 6727 const Object& obj = Object::Handle(raw_ptr()->owner_); |
| 6726 if (obj.IsClass()) { | 6728 if (obj.IsClass()) { |
| 6727 return Class::Cast(obj).script(); | 6729 return Class::Cast(obj).script(); |
| 6728 } | 6730 } |
| 6729 ASSERT(obj.IsPatchClass()); | 6731 ASSERT(obj.IsPatchClass()); |
| 6730 return PatchClass::Cast(obj).Script(); | 6732 return PatchClass::Cast(obj).Script(); |
| 6731 } | 6733 } |
| 6732 | 6734 |
| 6733 | 6735 |
| 6734 bool Function::HasOptimizedCode() const { | 6736 bool Function::HasOptimizedCode() const { |
| 6735 return HasCode() && Code::Handle(Instructions::Handle( | 6737 return HasCode() && Code::Handle(CurrentCode()).is_optimized(); |
| 6736 raw_ptr()->instructions_).code()).is_optimized(); | |
| 6737 } | 6738 } |
| 6738 | 6739 |
| 6739 | 6740 |
| 6740 RawString* Function::PrettyName() const { | 6741 RawString* Function::PrettyName() const { |
| 6741 const String& str = String::Handle(name()); | 6742 const String& str = String::Handle(name()); |
| 6742 return String::IdentifierPrettyName(str); | 6743 return String::IdentifierPrettyName(str); |
| 6743 } | 6744 } |
| 6744 | 6745 |
| 6745 | 6746 |
| 6746 const char* Function::QualifiedUserVisibleNameCString() const { | 6747 const char* Function::QualifiedUserVisibleNameCString() const { |
| (...skipping 4170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10917 | 10918 |
| 10918 const char* Instructions::ToCString() const { | 10919 const char* Instructions::ToCString() const { |
| 10919 return "Instructions"; | 10920 return "Instructions"; |
| 10920 } | 10921 } |
| 10921 | 10922 |
| 10922 | 10923 |
| 10923 void Instructions::PrintJSONImpl(JSONStream* stream, bool ref) const { | 10924 void Instructions::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 10924 JSONObject jsobj(stream); | 10925 JSONObject jsobj(stream); |
| 10925 AddCommonObjectProperties(&jsobj, "Object", ref); | 10926 AddCommonObjectProperties(&jsobj, "Object", ref); |
| 10926 jsobj.AddServiceId(*this); | 10927 jsobj.AddServiceId(*this); |
| 10927 jsobj.AddProperty("_code", Code::Handle(code())); | |
| 10928 if (ref) { | 10928 if (ref) { |
| 10929 return; | 10929 return; |
| 10930 } | 10930 } |
| 10931 jsobj.AddProperty("_objectPool", ObjectPool::Handle(object_pool())); | |
| 10932 } | 10931 } |
| 10933 | 10932 |
| 10934 | 10933 |
| 10935 // Encode integer in SLEB128 format. | 10934 // Encode integer in SLEB128 format. |
| 10936 void PcDescriptors::EncodeInteger(GrowableArray<uint8_t>* data, | 10935 void PcDescriptors::EncodeInteger(GrowableArray<uint8_t>* data, |
| 10937 intptr_t value) { | 10936 intptr_t value) { |
| 10938 bool is_last_part = false; | 10937 bool is_last_part = false; |
| 10939 while (!is_last_part) { | 10938 while (!is_last_part) { |
| 10940 intptr_t part = value & 0x7f; | 10939 intptr_t part = value & 0x7f; |
| 10941 value >>= 7; | 10940 value >>= 7; |
| (...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12855 } else { | 12854 } else { |
| 12856 ASSERT(code.IsNull() || | 12855 ASSERT(code.IsNull() || |
| 12857 (code.function() == array.At(i + kSCallTableFunctionEntry))); | 12856 (code.function() == array.At(i + kSCallTableFunctionEntry))); |
| 12858 } | 12857 } |
| 12859 #endif | 12858 #endif |
| 12860 array.SetAt(i + kSCallTableCodeEntry, code); | 12859 array.SetAt(i + kSCallTableCodeEntry, code); |
| 12861 } | 12860 } |
| 12862 | 12861 |
| 12863 | 12862 |
| 12864 void Code::Disassemble(DisassemblyFormatter* formatter) const { | 12863 void Code::Disassemble(DisassemblyFormatter* formatter) const { |
| 12865 const bool fix_patch = CodePatcher::CodeIsPatchable(*this) && | |
| 12866 CodePatcher::IsEntryPatched(*this); | |
| 12867 if (fix_patch) { | |
| 12868 // The disassembler may choke on illegal instructions if the code has been | |
| 12869 // patched, un-patch the code before disassembling and re-patch after. | |
| 12870 CodePatcher::RestoreEntry(*this); | |
| 12871 } | |
| 12872 const Instructions& instr = Instructions::Handle(instructions()); | 12864 const Instructions& instr = Instructions::Handle(instructions()); |
| 12873 uword start = instr.EntryPoint(); | 12865 uword start = instr.EntryPoint(); |
| 12874 if (formatter == NULL) { | 12866 if (formatter == NULL) { |
| 12875 Disassembler::Disassemble(start, start + instr.size(), *this); | 12867 Disassembler::Disassemble(start, start + instr.size(), *this); |
| 12876 } else { | 12868 } else { |
| 12877 Disassembler::Disassemble(start, start + instr.size(), formatter, *this); | 12869 Disassembler::Disassemble(start, start + instr.size(), formatter, *this); |
| 12878 } | 12870 } |
| 12879 if (fix_patch) { | |
| 12880 // Redo the patch. | |
| 12881 CodePatcher::PatchEntry(*this); | |
| 12882 } | |
| 12883 } | 12871 } |
| 12884 | 12872 |
| 12885 | 12873 |
| 12886 const Code::Comments& Code::comments() const { | 12874 const Code::Comments& Code::comments() const { |
| 12887 Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments_)); | 12875 Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments_)); |
| 12888 return *comments; | 12876 return *comments; |
| 12889 } | 12877 } |
| 12890 | 12878 |
| 12891 | 12879 |
| 12892 void Code::set_comments(const Code::Comments& comments) const { | 12880 void Code::set_comments(const Code::Comments& comments) const { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12994 { | 12982 { |
| 12995 uword size = Code::InstanceSize(pointer_offsets_length); | 12983 uword size = Code::InstanceSize(pointer_offsets_length); |
| 12996 RawObject* raw = Object::Allocate(Code::kClassId, size, Heap::kOld); | 12984 RawObject* raw = Object::Allocate(Code::kClassId, size, Heap::kOld); |
| 12997 NoSafepointScope no_safepoint; | 12985 NoSafepointScope no_safepoint; |
| 12998 result ^= raw; | 12986 result ^= raw; |
| 12999 result.set_pointer_offsets_length(pointer_offsets_length); | 12987 result.set_pointer_offsets_length(pointer_offsets_length); |
| 13000 result.set_is_optimized(false); | 12988 result.set_is_optimized(false); |
| 13001 result.set_is_alive(false); | 12989 result.set_is_alive(false); |
| 13002 result.set_comments(Comments::New(0)); | 12990 result.set_comments(Comments::New(0)); |
| 13003 result.set_compile_timestamp(0); | 12991 result.set_compile_timestamp(0); |
| 13004 result.set_entry_patch_pc_offset(kInvalidPc); | |
| 13005 result.set_patch_code_pc_offset(kInvalidPc); | |
| 13006 result.set_lazy_deopt_pc_offset(kInvalidPc); | 12992 result.set_lazy_deopt_pc_offset(kInvalidPc); |
| 13007 result.set_pc_descriptors(Object::empty_descriptors()); | 12993 result.set_pc_descriptors(Object::empty_descriptors()); |
| 13008 } | 12994 } |
| 13009 return result.raw(); | 12995 return result.raw(); |
| 13010 } | 12996 } |
| 13011 | 12997 |
| 13012 | 12998 |
| 13013 RawCode* Code::FinalizeCode(const char* name, | 12999 RawCode* Code::FinalizeCode(const char* name, |
| 13014 Assembler* assembler, | 13000 Assembler* assembler, |
| 13015 bool optimized) { | 13001 bool optimized) { |
| 13016 Isolate* isolate = Isolate::Current(); | 13002 Isolate* isolate = Isolate::Current(); |
| 13017 if (!isolate->compilation_allowed()) { | 13003 if (!isolate->compilation_allowed()) { |
| 13018 FATAL1("Precompilation missed code %s\n", name); | 13004 FATAL1("Precompilation missed code %s\n", name); |
| 13019 } | 13005 } |
| 13020 | 13006 |
| 13021 ASSERT(assembler != NULL); | 13007 ASSERT(assembler != NULL); |
| 13022 const ObjectPool& object_pool = | 13008 const ObjectPool& object_pool = |
| 13023 ObjectPool::Handle(assembler->object_pool_wrapper().MakeObjectPool()); | 13009 ObjectPool::Handle(assembler->object_pool_wrapper().MakeObjectPool()); |
| 13024 | 13010 |
| 13025 // Allocate the Code and Instructions objects. Code is allocated first | 13011 // Allocate the Code and Instructions objects. Code is allocated first |
| 13026 // because a GC during allocation of the code will leave the instruction | 13012 // because a GC during allocation of the code will leave the instruction |
| 13027 // pages read-only. | 13013 // pages read-only. |
| 13028 intptr_t pointer_offset_count = assembler->CountPointerOffsets(); | 13014 intptr_t pointer_offset_count = assembler->CountPointerOffsets(); |
| 13029 Code& code = Code::ZoneHandle(Code::New(pointer_offset_count)); | 13015 Code& code = Code::ZoneHandle(Code::New(pointer_offset_count)); |
| 13016 #ifdef TARGET_ARCH_IA32 |
| 13017 assembler->set_code_object(code); |
| 13018 #endif |
| 13030 Instructions& instrs = | 13019 Instructions& instrs = |
| 13031 Instructions::ZoneHandle(Instructions::New(assembler->CodeSize())); | 13020 Instructions::ZoneHandle(Instructions::New(assembler->CodeSize())); |
| 13032 INC_STAT(Thread::Current(), total_instr_size, assembler->CodeSize()); | 13021 INC_STAT(Thread::Current(), total_instr_size, assembler->CodeSize()); |
| 13033 INC_STAT(Thread::Current(), total_code_size, assembler->CodeSize()); | 13022 INC_STAT(Thread::Current(), total_code_size, assembler->CodeSize()); |
| 13034 | 13023 |
| 13035 // Copy the instructions into the instruction area and apply all fixups. | 13024 // Copy the instructions into the instruction area and apply all fixups. |
| 13036 // Embedded pointers are still in handles at this point. | 13025 // Embedded pointers are still in handles at this point. |
| 13037 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()), | 13026 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()), |
| 13038 instrs.size()); | 13027 instrs.size()); |
| 13039 assembler->FinalizeInstructions(region); | 13028 assembler->FinalizeInstructions(region); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 13058 for (intptr_t i = 0; i < pointer_offsets.length(); i++) { | 13047 for (intptr_t i = 0; i < pointer_offsets.length(); i++) { |
| 13059 intptr_t offset_in_instrs = pointer_offsets[i]; | 13048 intptr_t offset_in_instrs = pointer_offsets[i]; |
| 13060 code.SetPointerOffsetAt(i, offset_in_instrs); | 13049 code.SetPointerOffsetAt(i, offset_in_instrs); |
| 13061 uword addr = region.start() + offset_in_instrs; | 13050 uword addr = region.start() + offset_in_instrs; |
| 13062 const Object* object = *reinterpret_cast<Object**>(addr); | 13051 const Object* object = *reinterpret_cast<Object**>(addr); |
| 13063 instrs.raw()->StorePointer(reinterpret_cast<RawObject**>(addr), | 13052 instrs.raw()->StorePointer(reinterpret_cast<RawObject**>(addr), |
| 13064 object->raw()); | 13053 object->raw()); |
| 13065 } | 13054 } |
| 13066 | 13055 |
| 13067 // Hook up Code and Instructions objects. | 13056 // Hook up Code and Instructions objects. |
| 13068 instrs.set_code(code.raw()); | 13057 code.set_active_instructions(instrs.raw()); |
| 13069 code.set_instructions(instrs.raw()); | 13058 code.set_instructions(instrs.raw()); |
| 13070 code.set_is_alive(true); | 13059 code.set_is_alive(true); |
| 13071 | 13060 |
| 13072 // Set object pool in Instructions object. | 13061 // Set object pool in Instructions object. |
| 13073 INC_STAT(Thread::Current(), | 13062 INC_STAT(Thread::Current(), |
| 13074 total_code_size, object_pool.Length() * sizeof(uintptr_t)); | 13063 total_code_size, object_pool.Length() * sizeof(uintptr_t)); |
| 13075 instrs.set_object_pool(object_pool.raw()); | 13064 code.set_object_pool(object_pool.raw()); |
| 13076 | 13065 |
| 13077 if (FLAG_write_protect_code) { | 13066 if (FLAG_write_protect_code) { |
| 13078 uword address = RawObject::ToAddr(instrs.raw()); | 13067 uword address = RawObject::ToAddr(instrs.raw()); |
| 13079 bool status = VirtualMemory::Protect( | 13068 bool status = VirtualMemory::Protect( |
| 13080 reinterpret_cast<void*>(address), | 13069 reinterpret_cast<void*>(address), |
| 13081 instrs.raw()->Size(), | 13070 instrs.raw()->Size(), |
| 13082 VirtualMemory::kReadExecute); | 13071 VirtualMemory::kReadExecute); |
| 13083 ASSERT(status); | 13072 ASSERT(status); |
| 13084 } | 13073 } |
| 13085 } | 13074 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 13107 assembler, | 13096 assembler, |
| 13108 optimized); | 13097 optimized); |
| 13109 } else { | 13098 } else { |
| 13110 return FinalizeCode("", assembler); | 13099 return FinalizeCode("", assembler); |
| 13111 } | 13100 } |
| 13112 } | 13101 } |
| 13113 | 13102 |
| 13114 | 13103 |
| 13115 // Check if object matches find condition. | 13104 // Check if object matches find condition. |
| 13116 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) const { | 13105 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) const { |
| 13117 return RawInstructions::ContainsPC(obj, pc_); | 13106 return RawCode::ContainsPC(obj, pc_); |
| 13118 } | 13107 } |
| 13119 | 13108 |
| 13120 | 13109 |
| 13121 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { | 13110 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { |
| 13122 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); | 13111 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); |
| 13123 NoSafepointScope no_safepoint; | 13112 NoSafepointScope no_safepoint; |
| 13124 FindRawCodeVisitor visitor(pc); | 13113 FindRawCodeVisitor visitor(pc); |
| 13125 RawInstructions* instr; | 13114 RawObject* instr; |
| 13126 if (isolate->heap() == NULL) { | 13115 if (isolate->heap() == NULL) { |
| 13127 return Code::null(); | 13116 return Code::null(); |
| 13128 } | 13117 } |
| 13129 instr = isolate->heap()->FindObjectInCodeSpace(&visitor); | 13118 instr = isolate->heap()->FindOldObject(&visitor); |
| 13130 if (instr != Instructions::null()) { | 13119 if (instr != Code::null()) { |
| 13131 return instr->ptr()->code_; | 13120 return static_cast<RawCode*>(instr); |
| 13132 } | 13121 } |
| 13133 return Code::null(); | 13122 return Code::null(); |
| 13134 } | 13123 } |
| 13135 | 13124 |
| 13136 | 13125 |
| 13137 RawCode* Code::LookupCode(uword pc) { | 13126 RawCode* Code::LookupCode(uword pc) { |
| 13138 return LookupCodeInIsolate(Isolate::Current(), pc); | 13127 return LookupCodeInIsolate(Isolate::Current(), pc); |
| 13139 } | 13128 } |
| 13140 | 13129 |
| 13141 | 13130 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13362 while (inlining_id >= 0) { | 13351 while (inlining_id >= 0) { |
| 13363 inline_interval.AddValue(inlining_id); | 13352 inline_interval.AddValue(inlining_id); |
| 13364 inlining_id = caller_id; | 13353 inlining_id = caller_id; |
| 13365 caller_id = GetCallerId(inlining_id); | 13354 caller_id = GetCallerId(inlining_id); |
| 13366 } | 13355 } |
| 13367 } | 13356 } |
| 13368 } | 13357 } |
| 13369 } | 13358 } |
| 13370 | 13359 |
| 13371 | 13360 |
| 13372 uword Code::GetEntryPatchPc() const { | |
| 13373 return (entry_patch_pc_offset() != kInvalidPc) | |
| 13374 ? EntryPoint() + entry_patch_pc_offset() : 0; | |
| 13375 } | |
| 13376 | |
| 13377 | |
| 13378 uword Code::GetPatchCodePc() const { | |
| 13379 return (patch_code_pc_offset() != kInvalidPc) | |
| 13380 ? EntryPoint() + patch_code_pc_offset() : 0; | |
| 13381 } | |
| 13382 | |
| 13383 | |
| 13384 uword Code::GetLazyDeoptPc() const { | 13361 uword Code::GetLazyDeoptPc() const { |
| 13385 return (lazy_deopt_pc_offset() != kInvalidPc) | 13362 return (lazy_deopt_pc_offset() != kInvalidPc) |
| 13386 ? EntryPoint() + lazy_deopt_pc_offset() : 0; | 13363 ? EntryPoint() + lazy_deopt_pc_offset() : 0; |
| 13387 } | 13364 } |
| 13388 | 13365 |
| 13389 | 13366 |
| 13390 RawStackmap* Code::GetStackmap( | 13367 RawStackmap* Code::GetStackmap( |
| 13391 uint32_t pc_offset, Array* maps, Stackmap* map) const { | 13368 uint32_t pc_offset, Array* maps, Stackmap* map) const { |
| 13392 // This code is used during iterating frames during a GC and hence it | 13369 // This code is used during iterating frames during a GC and hence it |
| 13393 // should not in turn start a GC. | 13370 // should not in turn start a GC. |
| (...skipping 8046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21440 return tag_label.ToCString(); | 21417 return tag_label.ToCString(); |
| 21441 } | 21418 } |
| 21442 | 21419 |
| 21443 | 21420 |
| 21444 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21421 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21445 Instance::PrintJSONImpl(stream, ref); | 21422 Instance::PrintJSONImpl(stream, ref); |
| 21446 } | 21423 } |
| 21447 | 21424 |
| 21448 | 21425 |
| 21449 } // namespace dart | 21426 } // namespace dart |
| OLD | NEW |