| 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" |
| 11 #include "vm/bigint_operations.h" | 11 #include "vm/bigint_operations.h" |
| 12 #include "vm/bootstrap.h" | 12 #include "vm/bootstrap.h" |
| 13 #include "vm/class_finalizer.h" | 13 #include "vm/class_finalizer.h" |
| 14 #include "vm/code_generator.h" | 14 #include "vm/code_generator.h" |
| 15 #include "vm/code_observers.h" | 15 #include "vm/code_observers.h" |
| 16 #include "vm/code_patcher.h" | 16 #include "vm/code_patcher.h" |
| 17 #include "vm/compiler.h" | 17 #include "vm/compiler.h" |
| 18 #include "vm/compiler_stats.h" | 18 #include "vm/compiler_stats.h" |
| 19 #include "vm/dart.h" | 19 #include "vm/dart.h" |
| 20 #include "vm/dart_api_state.h" | 20 #include "vm/dart_api_state.h" |
| 21 #include "vm/dart_entry.h" | 21 #include "vm/dart_entry.h" |
| 22 #include "vm/datastream.h" | 22 #include "vm/datastream.h" |
| 23 #include "vm/debugger.h" | 23 #include "vm/debugger.h" |
| 24 #include "vm/deopt_instructions.h" | 24 #include "vm/deopt_instructions.h" |
| 25 #include "vm/disassembler.h" | |
| 26 #include "vm/double_conversion.h" | 25 #include "vm/double_conversion.h" |
| 27 #include "vm/exceptions.h" | 26 #include "vm/exceptions.h" |
| 28 #include "vm/flow_graph_builder.h" | 27 #include "vm/flow_graph_builder.h" |
| 29 #include "vm/growable_array.h" | 28 #include "vm/growable_array.h" |
| 30 #include "vm/heap.h" | 29 #include "vm/heap.h" |
| 31 #include "vm/intermediate_language.h" | 30 #include "vm/intermediate_language.h" |
| 32 #include "vm/intrinsifier.h" | 31 #include "vm/intrinsifier.h" |
| 33 #include "vm/longjump.h" | 32 #include "vm/longjump.h" |
| 34 #include "vm/object_store.h" | 33 #include "vm/object_store.h" |
| 35 #include "vm/parser.h" | 34 #include "vm/parser.h" |
| (...skipping 7249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7285 switch (DescriptorKind(index)) { | 7284 switch (DescriptorKind(index)) { |
| 7286 case PcDescriptors::kDeopt: return "deopt "; | 7285 case PcDescriptors::kDeopt: return "deopt "; |
| 7287 case PcDescriptors::kEntryPatch: return "entry-patch "; | 7286 case PcDescriptors::kEntryPatch: return "entry-patch "; |
| 7288 case PcDescriptors::kPatchCode: return "patch "; | 7287 case PcDescriptors::kPatchCode: return "patch "; |
| 7289 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt "; | 7288 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt "; |
| 7290 case PcDescriptors::kIcCall: return "ic-call "; | 7289 case PcDescriptors::kIcCall: return "ic-call "; |
| 7291 case PcDescriptors::kFuncCall: return "fn-call "; | 7290 case PcDescriptors::kFuncCall: return "fn-call "; |
| 7292 case PcDescriptors::kClosureCall: return "closure-call "; | 7291 case PcDescriptors::kClosureCall: return "closure-call "; |
| 7293 case PcDescriptors::kReturn: return "return "; | 7292 case PcDescriptors::kReturn: return "return "; |
| 7294 case PcDescriptors::kRuntimeCall: return "runtime-call "; | 7293 case PcDescriptors::kRuntimeCall: return "runtime-call "; |
| 7295 case PcDescriptors::kOsrEntry: return "osr-entry "; | |
| 7296 case PcDescriptors::kOther: return "other "; | 7294 case PcDescriptors::kOther: return "other "; |
| 7297 } | 7295 } |
| 7298 UNREACHABLE(); | 7296 UNREACHABLE(); |
| 7299 return ""; | 7297 return ""; |
| 7300 } | 7298 } |
| 7301 | 7299 |
| 7302 | 7300 |
| 7303 void PcDescriptors::PrintHeaderString() { | 7301 void PcDescriptors::PrintHeaderString() { |
| 7304 // 4 bits per hex digit + 2 for "0x". | 7302 // 4 bits per hex digit + 2 for "0x". |
| 7305 const int addr_width = (kBitsPerWord / 4) + 2; | 7303 const int addr_width = (kBitsPerWord / 4) + 2; |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7993 const intptr_t i = BinarySearchInSCallTable(pc); | 7991 const intptr_t i = BinarySearchInSCallTable(pc); |
| 7994 ASSERT(i >= 0); | 7992 ASSERT(i >= 0); |
| 7995 const Array& array = | 7993 const Array& array = |
| 7996 Array::Handle(raw_ptr()->static_calls_target_table_); | 7994 Array::Handle(raw_ptr()->static_calls_target_table_); |
| 7997 ASSERT(code.IsNull() || | 7995 ASSERT(code.IsNull() || |
| 7998 (code.function() == array.At(i + kSCallTableFunctionEntry))); | 7996 (code.function() == array.At(i + kSCallTableFunctionEntry))); |
| 7999 array.SetAt(i + kSCallTableCodeEntry, code); | 7997 array.SetAt(i + kSCallTableCodeEntry, code); |
| 8000 } | 7998 } |
| 8001 | 7999 |
| 8002 | 8000 |
| 8003 void Code::Disassemble() const { | |
| 8004 const Instructions& instr = Instructions::Handle(instructions()); | |
| 8005 uword start = instr.EntryPoint(); | |
| 8006 Disassembler::Disassemble(start, start + instr.size(), comments()); | |
| 8007 } | |
| 8008 | |
| 8009 | |
| 8010 const Code::Comments& Code::comments() const { | 8001 const Code::Comments& Code::comments() const { |
| 8011 Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments_)); | 8002 Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments_)); |
| 8012 return *comments; | 8003 return *comments; |
| 8013 } | 8004 } |
| 8014 | 8005 |
| 8015 | 8006 |
| 8016 void Code::set_comments(const Code::Comments& comments) const { | 8007 void Code::set_comments(const Code::Comments& comments) const { |
| 8017 StorePointer(&raw_ptr()->comments_, comments.comments_.raw()); | 8008 StorePointer(&raw_ptr()->comments_, comments.comments_.raw()); |
| 8018 } | 8009 } |
| 8019 | 8010 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8152 (descriptors.DescriptorKind(i) == kind)) { | 8143 (descriptors.DescriptorKind(i) == kind)) { |
| 8153 uword pc = descriptors.PC(i); | 8144 uword pc = descriptors.PC(i); |
| 8154 ASSERT(ContainsInstructionAt(pc)); | 8145 ASSERT(ContainsInstructionAt(pc)); |
| 8155 return pc; | 8146 return pc; |
| 8156 } | 8147 } |
| 8157 } | 8148 } |
| 8158 return 0; | 8149 return 0; |
| 8159 } | 8150 } |
| 8160 | 8151 |
| 8161 | 8152 |
| 8162 intptr_t Code::GetDeoptIdForOsr(uword pc) const { | |
| 8163 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | |
| 8164 for (intptr_t i = 0; i < descriptors.Length(); ++i) { | |
| 8165 if ((descriptors.PC(i) == pc) && | |
| 8166 (descriptors.DescriptorKind(i) == PcDescriptors::kOsrEntry)) { | |
| 8167 return descriptors.DeoptId(i); | |
| 8168 } | |
| 8169 } | |
| 8170 return Isolate::kNoDeoptId; | |
| 8171 } | |
| 8172 | |
| 8173 | |
| 8174 const char* Code::ToCString() const { | 8153 const char* Code::ToCString() const { |
| 8175 const char* kFormat = "Code entry:%p"; | 8154 const char* kFormat = "Code entry:%p"; |
| 8176 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; | 8155 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; |
| 8177 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 8156 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 8178 OS::SNPrint(chars, len, kFormat, EntryPoint()); | 8157 OS::SNPrint(chars, len, kFormat, EntryPoint()); |
| 8179 return chars; | 8158 return chars; |
| 8180 } | 8159 } |
| 8181 | 8160 |
| 8182 | 8161 |
| 8183 uword Code::GetPatchCodePc() const { | 8162 uword Code::GetPatchCodePc() const { |
| (...skipping 5376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13560 space); | 13539 space); |
| 13561 return reinterpret_cast<RawWeakProperty*>(raw); | 13540 return reinterpret_cast<RawWeakProperty*>(raw); |
| 13562 } | 13541 } |
| 13563 | 13542 |
| 13564 | 13543 |
| 13565 const char* WeakProperty::ToCString() const { | 13544 const char* WeakProperty::ToCString() const { |
| 13566 return "_WeakProperty"; | 13545 return "_WeakProperty"; |
| 13567 } | 13546 } |
| 13568 | 13547 |
| 13569 } // namespace dart | 13548 } // namespace dart |
| OLD | NEW |