| 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/become.h" | 10 #include "vm/become.h" |
| (...skipping 13911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13922 } else { | 13922 } else { |
| 13923 ASSERT(code.IsNull() || | 13923 ASSERT(code.IsNull() || |
| 13924 (code.function() == array.At(i + kSCallTableFunctionEntry))); | 13924 (code.function() == array.At(i + kSCallTableFunctionEntry))); |
| 13925 } | 13925 } |
| 13926 #endif | 13926 #endif |
| 13927 array.SetAt(i + kSCallTableCodeEntry, code); | 13927 array.SetAt(i + kSCallTableCodeEntry, code); |
| 13928 #endif | 13928 #endif |
| 13929 } | 13929 } |
| 13930 | 13930 |
| 13931 void Code::Disassemble(DisassemblyFormatter* formatter) const { | 13931 void Code::Disassemble(DisassemblyFormatter* formatter) const { |
| 13932 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) | 13932 #ifndef PRODUCT |
| 13933 if (!FLAG_support_disassembler) { | 13933 if (!FLAG_support_disassembler) { |
| 13934 return; | 13934 return; |
| 13935 } | 13935 } |
| 13936 const Instructions& instr = Instructions::Handle(instructions()); | 13936 const Instructions& instr = Instructions::Handle(instructions()); |
| 13937 uword start = instr.PayloadStart(); | 13937 uword start = instr.PayloadStart(); |
| 13938 if (formatter == NULL) { | 13938 if (formatter == NULL) { |
| 13939 Disassembler::Disassemble(start, start + instr.Size(), *this); | 13939 Disassembler::Disassemble(start, start + instr.Size(), *this); |
| 13940 } else { | 13940 } else { |
| 13941 Disassembler::Disassemble(start, start + instr.Size(), formatter, *this); | 13941 Disassembler::Disassemble(start, start + instr.Size(), formatter, *this); |
| 13942 } | 13942 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14011 result.set_pointer_offsets_length(pointer_offsets_length); | 14011 result.set_pointer_offsets_length(pointer_offsets_length); |
| 14012 result.set_is_optimized(false); | 14012 result.set_is_optimized(false); |
| 14013 result.set_is_alive(false); | 14013 result.set_is_alive(false); |
| 14014 result.set_comments(Comments::New(0)); | 14014 result.set_comments(Comments::New(0)); |
| 14015 result.set_compile_timestamp(0); | 14015 result.set_compile_timestamp(0); |
| 14016 result.set_pc_descriptors(Object::empty_descriptors()); | 14016 result.set_pc_descriptors(Object::empty_descriptors()); |
| 14017 } | 14017 } |
| 14018 return result.raw(); | 14018 return result.raw(); |
| 14019 } | 14019 } |
| 14020 | 14020 |
| 14021 #if !defined(DART_PRECOMPILED_RUNTIME) | |
| 14022 RawCode* Code::FinalizeCode(const char* name, | 14021 RawCode* Code::FinalizeCode(const char* name, |
| 14023 Assembler* assembler, | 14022 Assembler* assembler, |
| 14024 bool optimized) { | 14023 bool optimized) { |
| 14025 Isolate* isolate = Isolate::Current(); | 14024 Isolate* isolate = Isolate::Current(); |
| 14026 if (!isolate->compilation_allowed()) { | 14025 if (!isolate->compilation_allowed()) { |
| 14027 FATAL1("Precompilation missed code %s\n", name); | 14026 FATAL1("Precompilation missed code %s\n", name); |
| 14028 } | 14027 } |
| 14029 | 14028 |
| 14030 ASSERT(assembler != NULL); | 14029 ASSERT(assembler != NULL); |
| 14031 const ObjectPool& object_pool = | 14030 const ObjectPool& object_pool = |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14112 // Calling ToLibNamePrefixedQualifiedCString is very expensive, | 14111 // Calling ToLibNamePrefixedQualifiedCString is very expensive, |
| 14113 // try to avoid it. | 14112 // try to avoid it. |
| 14114 #ifndef PRODUCT | 14113 #ifndef PRODUCT |
| 14115 if (CodeObservers::AreActive()) { | 14114 if (CodeObservers::AreActive()) { |
| 14116 return FinalizeCode(function.ToLibNamePrefixedQualifiedCString(), assembler, | 14115 return FinalizeCode(function.ToLibNamePrefixedQualifiedCString(), assembler, |
| 14117 optimized); | 14116 optimized); |
| 14118 } | 14117 } |
| 14119 #endif // !PRODUCT | 14118 #endif // !PRODUCT |
| 14120 return FinalizeCode("", assembler, optimized); | 14119 return FinalizeCode("", assembler, optimized); |
| 14121 } | 14120 } |
| 14122 #endif // !defined(DART_PRECOMPILED_RUNTIME) | |
| 14123 | 14121 |
| 14124 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { | 14122 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { |
| 14125 return RawCode::ContainsPC(raw_obj, pc_); | 14123 return RawCode::ContainsPC(raw_obj, pc_); |
| 14126 } | 14124 } |
| 14127 | 14125 |
| 14128 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { | 14126 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { |
| 14129 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); | 14127 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); |
| 14130 if (isolate->heap() == NULL) { | 14128 if (isolate->heap() == NULL) { |
| 14131 return Code::null(); | 14129 return Code::null(); |
| 14132 } | 14130 } |
| (...skipping 8417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22550 } | 22548 } |
| 22551 return UserTag::null(); | 22549 return UserTag::null(); |
| 22552 } | 22550 } |
| 22553 | 22551 |
| 22554 const char* UserTag::ToCString() const { | 22552 const char* UserTag::ToCString() const { |
| 22555 const String& tag_label = String::Handle(label()); | 22553 const String& tag_label = String::Handle(label()); |
| 22556 return tag_label.ToCString(); | 22554 return tag_label.ToCString(); |
| 22557 } | 22555 } |
| 22558 | 22556 |
| 22559 } // namespace dart | 22557 } // namespace dart |
| OLD | NEW |