| 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 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 Context::New(0, Heap::kOld)); | 1633 Context::New(0, Heap::kOld)); |
| 1634 object_store->set_empty_context(context); | 1634 object_store->set_empty_context(context); |
| 1635 | 1635 |
| 1636 #endif // defined(DART_NO_SNAPSHOT). | 1636 #endif // defined(DART_NO_SNAPSHOT). |
| 1637 | 1637 |
| 1638 return Error::null(); | 1638 return Error::null(); |
| 1639 } | 1639 } |
| 1640 | 1640 |
| 1641 | 1641 |
| 1642 void Object::Print() const { | 1642 void Object::Print() const { |
| 1643 ISL_Print("%s\n", ToCString()); | 1643 THR_Print("%s\n", ToCString()); |
| 1644 } | 1644 } |
| 1645 | 1645 |
| 1646 | 1646 |
| 1647 static void AddNameProperties(JSONObject* jsobj, | 1647 static void AddNameProperties(JSONObject* jsobj, |
| 1648 const String& name, | 1648 const String& name, |
| 1649 const String& vm_name) { | 1649 const String& vm_name) { |
| 1650 jsobj->AddProperty("name", name.ToCString()); | 1650 jsobj->AddProperty("name", name.ToCString()); |
| 1651 if (!name.Equals(vm_name)) { | 1651 if (!name.Equals(vm_name)) { |
| 1652 jsobj->AddProperty("_vmName", vm_name.ToCString()); | 1652 jsobj->AddProperty("_vmName", vm_name.ToCString()); |
| 1653 } | 1653 } |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2724 } | 2724 } |
| 2725 | 2725 |
| 2726 virtual void UpdateArrayTo(const Array& value) { | 2726 virtual void UpdateArrayTo(const Array& value) { |
| 2727 // TODO(fschneider): Fails for classes in the VM isolate. | 2727 // TODO(fschneider): Fails for classes in the VM isolate. |
| 2728 cls_.set_cha_codes(value); | 2728 cls_.set_cha_codes(value); |
| 2729 } | 2729 } |
| 2730 | 2730 |
| 2731 virtual void ReportDeoptimization(const Code& code) { | 2731 virtual void ReportDeoptimization(const Code& code) { |
| 2732 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 2732 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| 2733 Function& function = Function::Handle(code.function()); | 2733 Function& function = Function::Handle(code.function()); |
| 2734 ISL_Print("Deoptimizing %s because CHA optimized (%s).\n", | 2734 THR_Print("Deoptimizing %s because CHA optimized (%s).\n", |
| 2735 function.ToFullyQualifiedCString(), | 2735 function.ToFullyQualifiedCString(), |
| 2736 cls_.ToCString()); | 2736 cls_.ToCString()); |
| 2737 } | 2737 } |
| 2738 } | 2738 } |
| 2739 | 2739 |
| 2740 virtual void ReportSwitchingCode(const Code& code) { | 2740 virtual void ReportSwitchingCode(const Code& code) { |
| 2741 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 2741 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| 2742 Function& function = Function::Handle(code.function()); | 2742 Function& function = Function::Handle(code.function()); |
| 2743 ISL_Print("Switching %s to unoptimized code because CHA invalid" | 2743 THR_Print("Switching %s to unoptimized code because CHA invalid" |
| 2744 " (%s)\n", | 2744 " (%s)\n", |
| 2745 function.ToFullyQualifiedCString(), | 2745 function.ToFullyQualifiedCString(), |
| 2746 cls_.ToCString()); | 2746 cls_.ToCString()); |
| 2747 } | 2747 } |
| 2748 } | 2748 } |
| 2749 | 2749 |
| 2750 private: | 2750 private: |
| 2751 const Class& cls_; | 2751 const Class& cls_; |
| 2752 DISALLOW_COPY_AND_ASSIGN(CHACodeArray); | 2752 DISALLOW_COPY_AND_ASSIGN(CHACodeArray); |
| 2753 }; | 2753 }; |
| 2754 | 2754 |
| 2755 | 2755 |
| 2756 void Class::RegisterCHACode(const Code& code) { | 2756 void Class::RegisterCHACode(const Code& code) { |
| 2757 if (FLAG_trace_cha) { | 2757 if (FLAG_trace_cha) { |
| 2758 ISL_Print("RegisterCHACode %s class %s\n", | 2758 THR_Print("RegisterCHACode %s class %s\n", |
| 2759 Function::Handle(code.function()).ToQualifiedCString(), ToCString()); | 2759 Function::Handle(code.function()).ToQualifiedCString(), ToCString()); |
| 2760 } | 2760 } |
| 2761 ASSERT(code.is_optimized()); | 2761 ASSERT(code.is_optimized()); |
| 2762 CHACodeArray a(*this); | 2762 CHACodeArray a(*this); |
| 2763 a.Register(code); | 2763 a.Register(code); |
| 2764 } | 2764 } |
| 2765 | 2765 |
| 2766 | 2766 |
| 2767 void Class::DisableCHAOptimizedCode() { | 2767 void Class::DisableCHAOptimizedCode() { |
| 2768 CHACodeArray a(*this); | 2768 CHACodeArray a(*this); |
| (...skipping 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5264 | 5264 |
| 5265 | 5265 |
| 5266 void Function::SwitchToUnoptimizedCode() const { | 5266 void Function::SwitchToUnoptimizedCode() const { |
| 5267 ASSERT(HasOptimizedCode()); | 5267 ASSERT(HasOptimizedCode()); |
| 5268 Thread* thread = Thread::Current(); | 5268 Thread* thread = Thread::Current(); |
| 5269 Isolate* isolate = thread->isolate(); | 5269 Isolate* isolate = thread->isolate(); |
| 5270 Zone* zone = thread->zone(); | 5270 Zone* zone = thread->zone(); |
| 5271 const Code& current_code = Code::Handle(zone, CurrentCode()); | 5271 const Code& current_code = Code::Handle(zone, CurrentCode()); |
| 5272 | 5272 |
| 5273 if (FLAG_trace_deoptimization_verbose) { | 5273 if (FLAG_trace_deoptimization_verbose) { |
| 5274 ISL_Print("Disabling optimized code: '%s' entry: %#" Px "\n", | 5274 THR_Print("Disabling optimized code: '%s' entry: %#" Px "\n", |
| 5275 ToFullyQualifiedCString(), | 5275 ToFullyQualifiedCString(), |
| 5276 current_code.EntryPoint()); | 5276 current_code.EntryPoint()); |
| 5277 } | 5277 } |
| 5278 // Patch entry of the optimized code. | 5278 // Patch entry of the optimized code. |
| 5279 CodePatcher::PatchEntry(current_code); | 5279 CodePatcher::PatchEntry(current_code); |
| 5280 const Error& error = Error::Handle(zone, | 5280 const Error& error = Error::Handle(zone, |
| 5281 Compiler::EnsureUnoptimizedCode(thread, *this)); | 5281 Compiler::EnsureUnoptimizedCode(thread, *this)); |
| 5282 if (!error.IsNull()) { | 5282 if (!error.IsNull()) { |
| 5283 Exceptions::PropagateError(error); | 5283 Exceptions::PropagateError(error); |
| 5284 } | 5284 } |
| (...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6958 | 6958 |
| 6959 | 6959 |
| 6960 bool Function::CheckSourceFingerprint(const char* prefix, int32_t fp) const { | 6960 bool Function::CheckSourceFingerprint(const char* prefix, int32_t fp) const { |
| 6961 if (SourceFingerprint() != fp) { | 6961 if (SourceFingerprint() != fp) { |
| 6962 const bool recalculatingFingerprints = false; | 6962 const bool recalculatingFingerprints = false; |
| 6963 if (recalculatingFingerprints) { | 6963 if (recalculatingFingerprints) { |
| 6964 // This output can be copied into a file, then used with sed | 6964 // This output can be copied into a file, then used with sed |
| 6965 // to replace the old values. | 6965 // to replace the old values. |
| 6966 // sed -i .bak -f /tmp/newkeys runtime/vm/method_recognizer.h | 6966 // sed -i .bak -f /tmp/newkeys runtime/vm/method_recognizer.h |
| 6967 // sed -i .bak -f /tmp/newkeys runtime/vm/flow_graph_builder.h | 6967 // sed -i .bak -f /tmp/newkeys runtime/vm/flow_graph_builder.h |
| 6968 ISL_Print("s/V(%s, %d)/V(%s, %d)/\n", | 6968 THR_Print("s/V(%s, %d)/V(%s, %d)/\n", |
| 6969 prefix, fp, prefix, SourceFingerprint()); | 6969 prefix, fp, prefix, SourceFingerprint()); |
| 6970 } else { | 6970 } else { |
| 6971 ISL_Print("FP mismatch while recognizing method %s:" | 6971 THR_Print("FP mismatch while recognizing method %s:" |
| 6972 " expecting %d found %d\n", | 6972 " expecting %d found %d\n", |
| 6973 ToFullyQualifiedCString(), | 6973 ToFullyQualifiedCString(), |
| 6974 fp, | 6974 fp, |
| 6975 SourceFingerprint()); | 6975 SourceFingerprint()); |
| 6976 return false; | 6976 return false; |
| 6977 } | 6977 } |
| 6978 } | 6978 } |
| 6979 return true; | 6979 return true; |
| 6980 } | 6980 } |
| 6981 | 6981 |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7562 : WeakCodeReferences(Array::Handle(field.dependent_code())), | 7562 : WeakCodeReferences(Array::Handle(field.dependent_code())), |
| 7563 field_(field) {} | 7563 field_(field) {} |
| 7564 | 7564 |
| 7565 virtual void UpdateArrayTo(const Array& value) { | 7565 virtual void UpdateArrayTo(const Array& value) { |
| 7566 field_.set_dependent_code(value); | 7566 field_.set_dependent_code(value); |
| 7567 } | 7567 } |
| 7568 | 7568 |
| 7569 virtual void ReportDeoptimization(const Code& code) { | 7569 virtual void ReportDeoptimization(const Code& code) { |
| 7570 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 7570 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| 7571 Function& function = Function::Handle(code.function()); | 7571 Function& function = Function::Handle(code.function()); |
| 7572 ISL_Print("Deoptimizing %s because guard on field %s failed.\n", | 7572 THR_Print("Deoptimizing %s because guard on field %s failed.\n", |
| 7573 function.ToFullyQualifiedCString(), field_.ToCString()); | 7573 function.ToFullyQualifiedCString(), field_.ToCString()); |
| 7574 } | 7574 } |
| 7575 } | 7575 } |
| 7576 | 7576 |
| 7577 virtual void ReportSwitchingCode(const Code& code) { | 7577 virtual void ReportSwitchingCode(const Code& code) { |
| 7578 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 7578 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| 7579 Function& function = Function::Handle(code.function()); | 7579 Function& function = Function::Handle(code.function()); |
| 7580 ISL_Print("Switching %s to unoptimized code because guard" | 7580 THR_Print("Switching %s to unoptimized code because guard" |
| 7581 " on field %s was violated.\n", | 7581 " on field %s was violated.\n", |
| 7582 function.ToFullyQualifiedCString(), | 7582 function.ToFullyQualifiedCString(), |
| 7583 field_.ToCString()); | 7583 field_.ToCString()); |
| 7584 } | 7584 } |
| 7585 } | 7585 } |
| 7586 | 7586 |
| 7587 private: | 7587 private: |
| 7588 const Field& field_; | 7588 const Field& field_; |
| 7589 DISALLOW_COPY_AND_ASSIGN(FieldDependentArray); | 7589 DISALLOW_COPY_AND_ASSIGN(FieldDependentArray); |
| 7590 }; | 7590 }; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7748 // Start tracking length if needed. | 7748 // Start tracking length if needed. |
| 7749 ASSERT((guarded_list_length() == Field::kUnknownFixedLength) || | 7749 ASSERT((guarded_list_length() == Field::kUnknownFixedLength) || |
| 7750 (guarded_list_length() == Field::kNoFixedLength)); | 7750 (guarded_list_length() == Field::kNoFixedLength)); |
| 7751 if (needs_length_check()) { | 7751 if (needs_length_check()) { |
| 7752 ASSERT(guarded_list_length() == Field::kUnknownFixedLength); | 7752 ASSERT(guarded_list_length() == Field::kUnknownFixedLength); |
| 7753 set_guarded_list_length(GetListLength(value)); | 7753 set_guarded_list_length(GetListLength(value)); |
| 7754 InitializeGuardedListLengthInObjectOffset(); | 7754 InitializeGuardedListLengthInObjectOffset(); |
| 7755 } | 7755 } |
| 7756 | 7756 |
| 7757 if (FLAG_trace_field_guards) { | 7757 if (FLAG_trace_field_guards) { |
| 7758 ISL_Print(" => %s\n", GuardedPropertiesAsCString()); | 7758 THR_Print(" => %s\n", GuardedPropertiesAsCString()); |
| 7759 } | 7759 } |
| 7760 | 7760 |
| 7761 return false; | 7761 return false; |
| 7762 } | 7762 } |
| 7763 | 7763 |
| 7764 if ((cid == guarded_cid()) || ((cid == kNullCid) && is_nullable())) { | 7764 if ((cid == guarded_cid()) || ((cid == kNullCid) && is_nullable())) { |
| 7765 // Class id of the assigned value matches expected class id and nullability. | 7765 // Class id of the assigned value matches expected class id and nullability. |
| 7766 | 7766 |
| 7767 // If we are tracking length check if it has matches. | 7767 // If we are tracking length check if it has matches. |
| 7768 if (needs_length_check() && | 7768 if (needs_length_check() && |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7803 return true; | 7803 return true; |
| 7804 } | 7804 } |
| 7805 | 7805 |
| 7806 | 7806 |
| 7807 void Field::RecordStore(const Object& value) const { | 7807 void Field::RecordStore(const Object& value) const { |
| 7808 if (!FLAG_use_field_guards) { | 7808 if (!FLAG_use_field_guards) { |
| 7809 return; | 7809 return; |
| 7810 } | 7810 } |
| 7811 | 7811 |
| 7812 if (FLAG_trace_field_guards) { | 7812 if (FLAG_trace_field_guards) { |
| 7813 ISL_Print("Store %s %s <- %s\n", | 7813 THR_Print("Store %s %s <- %s\n", |
| 7814 ToCString(), | 7814 ToCString(), |
| 7815 GuardedPropertiesAsCString(), | 7815 GuardedPropertiesAsCString(), |
| 7816 value.ToCString()); | 7816 value.ToCString()); |
| 7817 } | 7817 } |
| 7818 | 7818 |
| 7819 if (UpdateGuardedCidAndLength(value)) { | 7819 if (UpdateGuardedCidAndLength(value)) { |
| 7820 if (FLAG_trace_field_guards) { | 7820 if (FLAG_trace_field_guards) { |
| 7821 ISL_Print(" => %s\n", GuardedPropertiesAsCString()); | 7821 THR_Print(" => %s\n", GuardedPropertiesAsCString()); |
| 7822 } | 7822 } |
| 7823 | 7823 |
| 7824 DeoptimizeDependentCode(); | 7824 DeoptimizeDependentCode(); |
| 7825 } | 7825 } |
| 7826 } | 7826 } |
| 7827 | 7827 |
| 7828 | 7828 |
| 7829 void LiteralToken::set_literal(const String& literal) const { | 7829 void LiteralToken::set_literal(const String& literal) const { |
| 7830 StorePointer(&raw_ptr()->literal_, literal.raw()); | 7830 StorePointer(&raw_ptr()->literal_, literal.raw()); |
| 7831 } | 7831 } |
| (...skipping 2697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10529 virtual void ReportDeoptimization(const Code& code) { | 10529 virtual void ReportDeoptimization(const Code& code) { |
| 10530 // This gets called when the code object is on the stack | 10530 // This gets called when the code object is on the stack |
| 10531 // while nuking code that depends on a prefix. We don't expect | 10531 // while nuking code that depends on a prefix. We don't expect |
| 10532 // this to happen, so make sure we die loudly if we find | 10532 // this to happen, so make sure we die loudly if we find |
| 10533 // ourselves here. | 10533 // ourselves here. |
| 10534 UNIMPLEMENTED(); | 10534 UNIMPLEMENTED(); |
| 10535 } | 10535 } |
| 10536 | 10536 |
| 10537 virtual void ReportSwitchingCode(const Code& code) { | 10537 virtual void ReportSwitchingCode(const Code& code) { |
| 10538 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 10538 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| 10539 ISL_Print("Prefix '%s': disabling %s code for %s function '%s'\n", | 10539 THR_Print("Prefix '%s': disabling %s code for %s function '%s'\n", |
| 10540 String::Handle(prefix_.name()).ToCString(), | 10540 String::Handle(prefix_.name()).ToCString(), |
| 10541 code.is_optimized() ? "optimized" : "unoptimized", | 10541 code.is_optimized() ? "optimized" : "unoptimized", |
| 10542 CodePatcher::IsEntryPatched(code) ? "patched" : "unpatched", | 10542 CodePatcher::IsEntryPatched(code) ? "patched" : "unpatched", |
| 10543 Function::Handle(code.function()).ToCString()); | 10543 Function::Handle(code.function()).ToCString()); |
| 10544 } | 10544 } |
| 10545 } | 10545 } |
| 10546 | 10546 |
| 10547 private: | 10547 private: |
| 10548 const LibraryPrefix& prefix_; | 10548 const LibraryPrefix& prefix_; |
| 10549 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray); | 10549 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray); |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11077 | 11077 |
| 11078 if (addr == NativeEntry::LinkNativeCallLabel().address()) { | 11078 if (addr == NativeEntry::LinkNativeCallLabel().address()) { |
| 11079 return "link native"; | 11079 return "link native"; |
| 11080 } | 11080 } |
| 11081 | 11081 |
| 11082 return "UNKNOWN"; | 11082 return "UNKNOWN"; |
| 11083 } | 11083 } |
| 11084 | 11084 |
| 11085 | 11085 |
| 11086 void ObjectPool::DebugPrint() const { | 11086 void ObjectPool::DebugPrint() const { |
| 11087 ISL_Print("Object Pool: {\n"); | 11087 THR_Print("Object Pool: {\n"); |
| 11088 for (intptr_t i = 0; i < Length(); i++) { | 11088 for (intptr_t i = 0; i < Length(); i++) { |
| 11089 intptr_t offset = OffsetFromIndex(i); | 11089 intptr_t offset = OffsetFromIndex(i); |
| 11090 ISL_Print(" %" Pd " PP+0x%" Px ": ", i, offset); | 11090 THR_Print(" %" Pd " PP+0x%" Px ": ", i, offset); |
| 11091 if (InfoAt(i) == kTaggedObject) { | 11091 if (InfoAt(i) == kTaggedObject) { |
| 11092 RawObject* obj = ObjectAt(i); | 11092 RawObject* obj = ObjectAt(i); |
| 11093 ISL_Print("0x%" Px " %s (obj)\n", | 11093 THR_Print("0x%" Px " %s (obj)\n", |
| 11094 reinterpret_cast<uword>(obj), | 11094 reinterpret_cast<uword>(obj), |
| 11095 Object::Handle(obj).ToCString()); | 11095 Object::Handle(obj).ToCString()); |
| 11096 } else if (InfoAt(i) == kExternalLabel) { | 11096 } else if (InfoAt(i) == kExternalLabel) { |
| 11097 uword addr = RawValueAt(i); | 11097 uword addr = RawValueAt(i); |
| 11098 ISL_Print("0x%" Px " (external label: %s)\n", | 11098 THR_Print("0x%" Px " (external label: %s)\n", |
| 11099 addr, DescribeExternalLabel(addr)); | 11099 addr, DescribeExternalLabel(addr)); |
| 11100 } else { | 11100 } else { |
| 11101 ISL_Print("0x%" Px " (raw)\n", RawValueAt(i)); | 11101 THR_Print("0x%" Px " (raw)\n", RawValueAt(i)); |
| 11102 } | 11102 } |
| 11103 } | 11103 } |
| 11104 ISL_Print("}\n"); | 11104 THR_Print("}\n"); |
| 11105 } | 11105 } |
| 11106 | 11106 |
| 11107 | 11107 |
| 11108 intptr_t PcDescriptors::Length() const { | 11108 intptr_t PcDescriptors::Length() const { |
| 11109 return raw_ptr()->length_; | 11109 return raw_ptr()->length_; |
| 11110 } | 11110 } |
| 11111 | 11111 |
| 11112 | 11112 |
| 11113 void PcDescriptors::SetLength(intptr_t value) const { | 11113 void PcDescriptors::SetLength(intptr_t value) const { |
| 11114 StoreNonPointer(&raw_ptr()->length_, value); | 11114 StoreNonPointer(&raw_ptr()->length_, value); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11176 UNREACHABLE(); | 11176 UNREACHABLE(); |
| 11177 return ""; | 11177 return ""; |
| 11178 } | 11178 } |
| 11179 | 11179 |
| 11180 | 11180 |
| 11181 void PcDescriptors::PrintHeaderString() { | 11181 void PcDescriptors::PrintHeaderString() { |
| 11182 // 4 bits per hex digit + 2 for "0x". | 11182 // 4 bits per hex digit + 2 for "0x". |
| 11183 const int addr_width = (kBitsPerWord / 4) + 2; | 11183 const int addr_width = (kBitsPerWord / 4) + 2; |
| 11184 // "*" in a printf format specifier tells it to read the field width from | 11184 // "*" in a printf format specifier tells it to read the field width from |
| 11185 // the printf argument list. | 11185 // the printf argument list. |
| 11186 ISL_Print("%-*s\tkind \tdeopt-id\ttok-ix\ttry-ix\n", | 11186 THR_Print("%-*s\tkind \tdeopt-id\ttok-ix\ttry-ix\n", |
| 11187 addr_width, "pc"); | 11187 addr_width, "pc"); |
| 11188 } | 11188 } |
| 11189 | 11189 |
| 11190 | 11190 |
| 11191 const char* PcDescriptors::ToCString() const { | 11191 const char* PcDescriptors::ToCString() const { |
| 11192 if (Length() == 0) { | 11192 if (Length() == 0) { |
| 11193 return "empty PcDescriptors\n"; | 11193 return "empty PcDescriptors\n"; |
| 11194 } | 11194 } |
| 11195 // 4 bits per hex digit. | 11195 // 4 bits per hex digit. |
| 11196 const int addr_width = kBitsPerWord / 4; | 11196 const int addr_width = kBitsPerWord / 4; |
| (...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13484 Function& function = Function::ZoneHandle(); | 13484 Function& function = Function::ZoneHandle(); |
| 13485 function ^= id_map.At(inlining_id); | 13485 function ^= id_map.At(inlining_id); |
| 13486 fs->Add(&function); | 13486 fs->Add(&function); |
| 13487 inlining_id = caller_id; | 13487 inlining_id = caller_id; |
| 13488 caller_id = GetCallerId(inlining_id); | 13488 caller_id = GetCallerId(inlining_id); |
| 13489 } | 13489 } |
| 13490 } | 13490 } |
| 13491 | 13491 |
| 13492 | 13492 |
| 13493 void Code::DumpInlinedIntervals() const { | 13493 void Code::DumpInlinedIntervals() const { |
| 13494 LogBlock lb(Isolate::Current()); | 13494 LogBlock lb; |
| 13495 ISL_Print("Inlined intervals:\n"); | 13495 THR_Print("Inlined intervals:\n"); |
| 13496 const Array& intervals = Array::Handle(GetInlinedIntervals()); | 13496 const Array& intervals = Array::Handle(GetInlinedIntervals()); |
| 13497 if (intervals.IsNull() || (intervals.Length() == 0)) return; | 13497 if (intervals.IsNull() || (intervals.Length() == 0)) return; |
| 13498 Smi& start = Smi::Handle(); | 13498 Smi& start = Smi::Handle(); |
| 13499 Smi& inlining_id = Smi::Handle(); | 13499 Smi& inlining_id = Smi::Handle(); |
| 13500 GrowableArray<Function*> inlined_functions; | 13500 GrowableArray<Function*> inlined_functions; |
| 13501 const Function& inliner = Function::Handle(function()); | 13501 const Function& inliner = Function::Handle(function()); |
| 13502 for (intptr_t i = 0; i < intervals.Length(); i += Code::kInlIntNumEntries) { | 13502 for (intptr_t i = 0; i < intervals.Length(); i += Code::kInlIntNumEntries) { |
| 13503 start ^= intervals.At(i + Code::kInlIntStart); | 13503 start ^= intervals.At(i + Code::kInlIntStart); |
| 13504 ASSERT(!start.IsNull()); | 13504 ASSERT(!start.IsNull()); |
| 13505 if (start.IsNull()) continue; | 13505 if (start.IsNull()) continue; |
| 13506 inlining_id ^= intervals.At(i + Code::kInlIntInliningId); | 13506 inlining_id ^= intervals.At(i + Code::kInlIntInliningId); |
| 13507 ISL_Print(" %" Px " iid: %" Pd " ; ", start.Value(), inlining_id.Value()); | 13507 THR_Print(" %" Px " iid: %" Pd " ; ", start.Value(), inlining_id.Value()); |
| 13508 inlined_functions.Clear(); | 13508 inlined_functions.Clear(); |
| 13509 | 13509 |
| 13510 ISL_Print("inlined: "); | 13510 THR_Print("inlined: "); |
| 13511 GetInlinedFunctionsAt(start.Value(), &inlined_functions); | 13511 GetInlinedFunctionsAt(start.Value(), &inlined_functions); |
| 13512 | 13512 |
| 13513 for (intptr_t j = 0; j < inlined_functions.length(); j++) { | 13513 for (intptr_t j = 0; j < inlined_functions.length(); j++) { |
| 13514 const char* name = inlined_functions[j]->ToQualifiedCString(); | 13514 const char* name = inlined_functions[j]->ToQualifiedCString(); |
| 13515 ISL_Print(" %s <-", name); | 13515 THR_Print(" %s <-", name); |
| 13516 } | 13516 } |
| 13517 if (inlined_functions[inlined_functions.length() - 1]->raw() != | 13517 if (inlined_functions[inlined_functions.length() - 1]->raw() != |
| 13518 inliner.raw()) { | 13518 inliner.raw()) { |
| 13519 ISL_Print(" (ERROR, missing inliner)\n"); | 13519 THR_Print(" (ERROR, missing inliner)\n"); |
| 13520 } else { | 13520 } else { |
| 13521 ISL_Print("\n"); | 13521 THR_Print("\n"); |
| 13522 } | 13522 } |
| 13523 } | 13523 } |
| 13524 ISL_Print("Inlined ids:\n"); | 13524 THR_Print("Inlined ids:\n"); |
| 13525 const Array& id_map = Array::Handle(GetInlinedIdToFunction()); | 13525 const Array& id_map = Array::Handle(GetInlinedIdToFunction()); |
| 13526 Function& function = Function::Handle(); | 13526 Function& function = Function::Handle(); |
| 13527 for (intptr_t i = 0; i < id_map.Length(); i++) { | 13527 for (intptr_t i = 0; i < id_map.Length(); i++) { |
| 13528 function ^= id_map.At(i); | 13528 function ^= id_map.At(i); |
| 13529 if (!function.IsNull()) { | 13529 if (!function.IsNull()) { |
| 13530 ISL_Print(" %" Pd ": %s\n", i, function.ToQualifiedCString()); | 13530 THR_Print(" %" Pd ": %s\n", i, function.ToQualifiedCString()); |
| 13531 } | 13531 } |
| 13532 } | 13532 } |
| 13533 ISL_Print("Caller Inlining Ids:\n"); | 13533 THR_Print("Caller Inlining Ids:\n"); |
| 13534 const Array& caller_map = Array::Handle(GetInlinedCallerIdMap()); | 13534 const Array& caller_map = Array::Handle(GetInlinedCallerIdMap()); |
| 13535 Smi& smi = Smi::Handle(); | 13535 Smi& smi = Smi::Handle(); |
| 13536 for (intptr_t i = 0; i < caller_map.Length(); i++) { | 13536 for (intptr_t i = 0; i < caller_map.Length(); i++) { |
| 13537 smi ^= caller_map.At(i); | 13537 smi ^= caller_map.At(i); |
| 13538 ISL_Print(" iid: %" Pd " caller iid: %" Pd "\n", i, smi.Value()); | 13538 THR_Print(" iid: %" Pd " caller iid: %" Pd "\n", i, smi.Value()); |
| 13539 } | 13539 } |
| 13540 } | 13540 } |
| 13541 | 13541 |
| 13542 | 13542 |
| 13543 RawContext* Context::New(intptr_t num_variables, Heap::Space space) { | 13543 RawContext* Context::New(intptr_t num_variables, Heap::Space space) { |
| 13544 ASSERT(num_variables >= 0); | 13544 ASSERT(num_variables >= 0); |
| 13545 ASSERT(Object::context_class() != Class::null()); | 13545 ASSERT(Object::context_class() != Class::null()); |
| 13546 | 13546 |
| 13547 if (num_variables < 0 || num_variables > kMaxElements) { | 13547 if (num_variables < 0 || num_variables > kMaxElements) { |
| 13548 // This should be caught before we reach here. | 13548 // This should be caught before we reach here. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 13575 const char* parent_str = parent_ctx.ToCString(); | 13575 const char* parent_str = parent_ctx.ToCString(); |
| 13576 return zone->PrintToString( | 13576 return zone->PrintToString( |
| 13577 "Context@%p num_variables:% " Pd " parent:{ %s }", | 13577 "Context@%p num_variables:% " Pd " parent:{ %s }", |
| 13578 this->raw(), num_variables(), parent_str); | 13578 this->raw(), num_variables(), parent_str); |
| 13579 } | 13579 } |
| 13580 } | 13580 } |
| 13581 | 13581 |
| 13582 | 13582 |
| 13583 static void IndentN(int count) { | 13583 static void IndentN(int count) { |
| 13584 for (int i = 0; i < count; i++) { | 13584 for (int i = 0; i < count; i++) { |
| 13585 ISL_Print(" "); | 13585 THR_Print(" "); |
| 13586 } | 13586 } |
| 13587 } | 13587 } |
| 13588 | 13588 |
| 13589 | 13589 |
| 13590 void Context::Dump(int indent) const { | 13590 void Context::Dump(int indent) const { |
| 13591 if (IsNull()) { | 13591 if (IsNull()) { |
| 13592 IndentN(indent); | 13592 IndentN(indent); |
| 13593 ISL_Print("Context@null\n"); | 13593 THR_Print("Context@null\n"); |
| 13594 return; | 13594 return; |
| 13595 } | 13595 } |
| 13596 | 13596 |
| 13597 IndentN(indent); | 13597 IndentN(indent); |
| 13598 ISL_Print("Context@%p vars(%" Pd ") {\n", this->raw(), num_variables()); | 13598 THR_Print("Context@%p vars(%" Pd ") {\n", this->raw(), num_variables()); |
| 13599 Object& obj = Object::Handle(); | 13599 Object& obj = Object::Handle(); |
| 13600 for (intptr_t i = 0; i < num_variables(); i++) { | 13600 for (intptr_t i = 0; i < num_variables(); i++) { |
| 13601 IndentN(indent + 2); | 13601 IndentN(indent + 2); |
| 13602 obj = At(i); | 13602 obj = At(i); |
| 13603 ISL_Print("[%" Pd "] = %s\n", i, obj.ToCString()); | 13603 THR_Print("[%" Pd "] = %s\n", i, obj.ToCString()); |
| 13604 } | 13604 } |
| 13605 | 13605 |
| 13606 const Context& parent_ctx = Context::Handle(parent()); | 13606 const Context& parent_ctx = Context::Handle(parent()); |
| 13607 if (!parent_ctx.IsNull()) { | 13607 if (!parent_ctx.IsNull()) { |
| 13608 parent_ctx.Dump(indent + 2); | 13608 parent_ctx.Dump(indent + 2); |
| 13609 } | 13609 } |
| 13610 IndentN(indent); | 13610 IndentN(indent); |
| 13611 ISL_Print("}\n"); | 13611 THR_Print("}\n"); |
| 13612 } | 13612 } |
| 13613 | 13613 |
| 13614 | 13614 |
| 13615 void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { | 13615 void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 13616 JSONObject jsobj(stream); | 13616 JSONObject jsobj(stream); |
| 13617 // TODO(turnidge): Should the user level type for Context be Context | 13617 // TODO(turnidge): Should the user level type for Context be Context |
| 13618 // or Object? | 13618 // or Object? |
| 13619 AddCommonObjectProperties(&jsobj, "Context", ref); | 13619 AddCommonObjectProperties(&jsobj, "Context", ref); |
| 13620 jsobj.AddServiceId(*this); | 13620 jsobj.AddServiceId(*this); |
| 13621 | 13621 |
| (...skipping 7923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21545 return tag_label.ToCString(); | 21545 return tag_label.ToCString(); |
| 21546 } | 21546 } |
| 21547 | 21547 |
| 21548 | 21548 |
| 21549 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21549 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21550 Instance::PrintJSONImpl(stream, ref); | 21550 Instance::PrintJSONImpl(stream, ref); |
| 21551 } | 21551 } |
| 21552 | 21552 |
| 21553 | 21553 |
| 21554 } // namespace dart | 21554 } // namespace dart |
| OLD | NEW |