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