| 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" |
| 25 #include "vm/double_conversion.h" | 26 #include "vm/double_conversion.h" |
| 26 #include "vm/exceptions.h" | 27 #include "vm/exceptions.h" |
| 27 #include "vm/flow_graph_builder.h" | 28 #include "vm/flow_graph_builder.h" |
| 28 #include "vm/growable_array.h" | 29 #include "vm/growable_array.h" |
| 29 #include "vm/heap.h" | 30 #include "vm/heap.h" |
| 30 #include "vm/intermediate_language.h" | 31 #include "vm/intermediate_language.h" |
| 31 #include "vm/intrinsifier.h" | 32 #include "vm/intrinsifier.h" |
| 32 #include "vm/longjump.h" | 33 #include "vm/longjump.h" |
| 33 #include "vm/object_store.h" | 34 #include "vm/object_store.h" |
| 34 #include "vm/parser.h" | 35 #include "vm/parser.h" |
| (...skipping 7250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7285 switch (DescriptorKind(index)) { | 7286 switch (DescriptorKind(index)) { |
| 7286 case PcDescriptors::kDeopt: return "deopt "; | 7287 case PcDescriptors::kDeopt: return "deopt "; |
| 7287 case PcDescriptors::kEntryPatch: return "entry-patch "; | 7288 case PcDescriptors::kEntryPatch: return "entry-patch "; |
| 7288 case PcDescriptors::kPatchCode: return "patch "; | 7289 case PcDescriptors::kPatchCode: return "patch "; |
| 7289 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt "; | 7290 case PcDescriptors::kLazyDeoptJump: return "lazy-deopt "; |
| 7290 case PcDescriptors::kIcCall: return "ic-call "; | 7291 case PcDescriptors::kIcCall: return "ic-call "; |
| 7291 case PcDescriptors::kFuncCall: return "fn-call "; | 7292 case PcDescriptors::kFuncCall: return "fn-call "; |
| 7292 case PcDescriptors::kClosureCall: return "closure-call "; | 7293 case PcDescriptors::kClosureCall: return "closure-call "; |
| 7293 case PcDescriptors::kReturn: return "return "; | 7294 case PcDescriptors::kReturn: return "return "; |
| 7294 case PcDescriptors::kRuntimeCall: return "runtime-call "; | 7295 case PcDescriptors::kRuntimeCall: return "runtime-call "; |
| 7296 case PcDescriptors::kOsrEntry: return "osr-entry "; |
| 7295 case PcDescriptors::kOther: return "other "; | 7297 case PcDescriptors::kOther: return "other "; |
| 7296 } | 7298 } |
| 7297 UNREACHABLE(); | 7299 UNREACHABLE(); |
| 7298 return ""; | 7300 return ""; |
| 7299 } | 7301 } |
| 7300 | 7302 |
| 7301 | 7303 |
| 7302 void PcDescriptors::PrintHeaderString() { | 7304 void PcDescriptors::PrintHeaderString() { |
| 7303 // 4 bits per hex digit + 2 for "0x". | 7305 // 4 bits per hex digit + 2 for "0x". |
| 7304 const int addr_width = (kBitsPerWord / 4) + 2; | 7306 const int addr_width = (kBitsPerWord / 4) + 2; |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7992 const intptr_t i = BinarySearchInSCallTable(pc); | 7994 const intptr_t i = BinarySearchInSCallTable(pc); |
| 7993 ASSERT(i >= 0); | 7995 ASSERT(i >= 0); |
| 7994 const Array& array = | 7996 const Array& array = |
| 7995 Array::Handle(raw_ptr()->static_calls_target_table_); | 7997 Array::Handle(raw_ptr()->static_calls_target_table_); |
| 7996 ASSERT(code.IsNull() || | 7998 ASSERT(code.IsNull() || |
| 7997 (code.function() == array.At(i + kSCallTableFunctionEntry))); | 7999 (code.function() == array.At(i + kSCallTableFunctionEntry))); |
| 7998 array.SetAt(i + kSCallTableCodeEntry, code); | 8000 array.SetAt(i + kSCallTableCodeEntry, code); |
| 7999 } | 8001 } |
| 8000 | 8002 |
| 8001 | 8003 |
| 8004 void Code::Disassemble() const { |
| 8005 const Instructions& instr = Instructions::Handle(instructions()); |
| 8006 uword start = instr.EntryPoint(); |
| 8007 Disassembler::Disassemble(start, start + instr.size(), comments()); |
| 8008 } |
| 8009 |
| 8010 |
| 8002 const Code::Comments& Code::comments() const { | 8011 const Code::Comments& Code::comments() const { |
| 8003 Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments_)); | 8012 Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments_)); |
| 8004 return *comments; | 8013 return *comments; |
| 8005 } | 8014 } |
| 8006 | 8015 |
| 8007 | 8016 |
| 8008 void Code::set_comments(const Code::Comments& comments) const { | 8017 void Code::set_comments(const Code::Comments& comments) const { |
| 8009 StorePointer(&raw_ptr()->comments_, comments.comments_.raw()); | 8018 StorePointer(&raw_ptr()->comments_, comments.comments_.raw()); |
| 8010 } | 8019 } |
| 8011 | 8020 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8144 (descriptors.DescriptorKind(i) == kind)) { | 8153 (descriptors.DescriptorKind(i) == kind)) { |
| 8145 uword pc = descriptors.PC(i); | 8154 uword pc = descriptors.PC(i); |
| 8146 ASSERT(ContainsInstructionAt(pc)); | 8155 ASSERT(ContainsInstructionAt(pc)); |
| 8147 return pc; | 8156 return pc; |
| 8148 } | 8157 } |
| 8149 } | 8158 } |
| 8150 return 0; | 8159 return 0; |
| 8151 } | 8160 } |
| 8152 | 8161 |
| 8153 | 8162 |
| 8163 intptr_t Code::GetDeoptIdForOsr(uword pc) const { |
| 8164 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
| 8165 for (intptr_t i = 0; i < descriptors.Length(); ++i) { |
| 8166 if ((descriptors.PC(i) == pc) && |
| 8167 (descriptors.DescriptorKind(i) == PcDescriptors::kOsrEntry)) { |
| 8168 return descriptors.DeoptId(i); |
| 8169 } |
| 8170 } |
| 8171 return Isolate::kNoDeoptId; |
| 8172 } |
| 8173 |
| 8174 |
| 8154 const char* Code::ToCString() const { | 8175 const char* Code::ToCString() const { |
| 8155 const char* kFormat = "Code entry:%p"; | 8176 const char* kFormat = "Code entry:%p"; |
| 8156 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; | 8177 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; |
| 8157 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 8178 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 8158 OS::SNPrint(chars, len, kFormat, EntryPoint()); | 8179 OS::SNPrint(chars, len, kFormat, EntryPoint()); |
| 8159 return chars; | 8180 return chars; |
| 8160 } | 8181 } |
| 8161 | 8182 |
| 8162 | 8183 |
| 8163 uword Code::GetPatchCodePc() const { | 8184 uword Code::GetPatchCodePc() const { |
| (...skipping 5438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13602 space); | 13623 space); |
| 13603 return reinterpret_cast<RawWeakProperty*>(raw); | 13624 return reinterpret_cast<RawWeakProperty*>(raw); |
| 13604 } | 13625 } |
| 13605 | 13626 |
| 13606 | 13627 |
| 13607 const char* WeakProperty::ToCString() const { | 13628 const char* WeakProperty::ToCString() const { |
| 13608 return "_WeakProperty"; | 13629 return "_WeakProperty"; |
| 13609 } | 13630 } |
| 13610 | 13631 |
| 13611 } // namespace dart | 13632 } // namespace dart |
| OLD | NEW |