| 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 14463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14474 ASSERT(code.IsNull() || | 14474 ASSERT(code.IsNull() || |
| 14475 (code.function() == array.At(i + kSCallTableFunctionEntry))); | 14475 (code.function() == array.At(i + kSCallTableFunctionEntry))); |
| 14476 } | 14476 } |
| 14477 #endif | 14477 #endif |
| 14478 array.SetAt(i + kSCallTableCodeEntry, code); | 14478 array.SetAt(i + kSCallTableCodeEntry, code); |
| 14479 #endif | 14479 #endif |
| 14480 } | 14480 } |
| 14481 | 14481 |
| 14482 | 14482 |
| 14483 void Code::Disassemble(DisassemblyFormatter* formatter) const { | 14483 void Code::Disassemble(DisassemblyFormatter* formatter) const { |
| 14484 #ifndef PRODUCT | 14484 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 14485 if (!FLAG_support_disassembler) { | 14485 if (!FLAG_support_disassembler) { |
| 14486 return; | 14486 return; |
| 14487 } | 14487 } |
| 14488 const Instructions& instr = Instructions::Handle(instructions()); | 14488 const Instructions& instr = Instructions::Handle(instructions()); |
| 14489 uword start = instr.PayloadStart(); | 14489 uword start = instr.PayloadStart(); |
| 14490 if (formatter == NULL) { | 14490 if (formatter == NULL) { |
| 14491 Disassembler::Disassemble(start, start + instr.Size(), *this); | 14491 Disassembler::Disassemble(start, start + instr.Size(), *this); |
| 14492 } else { | 14492 } else { |
| 14493 Disassembler::Disassemble(start, start + instr.Size(), formatter, *this); | 14493 Disassembler::Disassemble(start, start + instr.Size(), formatter, *this); |
| 14494 } | 14494 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14571 result.set_is_optimized(false); | 14571 result.set_is_optimized(false); |
| 14572 result.set_is_alive(false); | 14572 result.set_is_alive(false); |
| 14573 result.set_comments(Comments::New(0)); | 14573 result.set_comments(Comments::New(0)); |
| 14574 result.set_compile_timestamp(0); | 14574 result.set_compile_timestamp(0); |
| 14575 result.set_pc_descriptors(Object::empty_descriptors()); | 14575 result.set_pc_descriptors(Object::empty_descriptors()); |
| 14576 } | 14576 } |
| 14577 return result.raw(); | 14577 return result.raw(); |
| 14578 } | 14578 } |
| 14579 | 14579 |
| 14580 | 14580 |
| 14581 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 14581 RawCode* Code::FinalizeCode(const char* name, | 14582 RawCode* Code::FinalizeCode(const char* name, |
| 14582 Assembler* assembler, | 14583 Assembler* assembler, |
| 14583 bool optimized) { | 14584 bool optimized) { |
| 14584 Isolate* isolate = Isolate::Current(); | 14585 Isolate* isolate = Isolate::Current(); |
| 14585 if (!isolate->compilation_allowed()) { | 14586 if (!isolate->compilation_allowed()) { |
| 14586 FATAL1("Precompilation missed code %s\n", name); | 14587 FATAL1("Precompilation missed code %s\n", name); |
| 14587 } | 14588 } |
| 14588 | 14589 |
| 14589 ASSERT(assembler != NULL); | 14590 ASSERT(assembler != NULL); |
| 14590 const ObjectPool& object_pool = | 14591 const ObjectPool& object_pool = |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14672 // Calling ToLibNamePrefixedQualifiedCString is very expensive, | 14673 // Calling ToLibNamePrefixedQualifiedCString is very expensive, |
| 14673 // try to avoid it. | 14674 // try to avoid it. |
| 14674 #ifndef PRODUCT | 14675 #ifndef PRODUCT |
| 14675 if (CodeObservers::AreActive()) { | 14676 if (CodeObservers::AreActive()) { |
| 14676 return FinalizeCode(function.ToLibNamePrefixedQualifiedCString(), assembler, | 14677 return FinalizeCode(function.ToLibNamePrefixedQualifiedCString(), assembler, |
| 14677 optimized); | 14678 optimized); |
| 14678 } | 14679 } |
| 14679 #endif // !PRODUCT | 14680 #endif // !PRODUCT |
| 14680 return FinalizeCode("", assembler, optimized); | 14681 return FinalizeCode("", assembler, optimized); |
| 14681 } | 14682 } |
| 14683 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 14682 | 14684 |
| 14683 | 14685 |
| 14684 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { | 14686 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { |
| 14685 return RawCode::ContainsPC(raw_obj, pc_); | 14687 return RawCode::ContainsPC(raw_obj, pc_); |
| 14686 } | 14688 } |
| 14687 | 14689 |
| 14688 | 14690 |
| 14689 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { | 14691 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { |
| 14690 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); | 14692 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); |
| 14691 if (isolate->heap() == NULL) { | 14693 if (isolate->heap() == NULL) { |
| (...skipping 8897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23589 return UserTag::null(); | 23591 return UserTag::null(); |
| 23590 } | 23592 } |
| 23591 | 23593 |
| 23592 | 23594 |
| 23593 const char* UserTag::ToCString() const { | 23595 const char* UserTag::ToCString() const { |
| 23594 const String& tag_label = String::Handle(label()); | 23596 const String& tag_label = String::Handle(label()); |
| 23595 return tag_label.ToCString(); | 23597 return tag_label.ToCString(); |
| 23596 } | 23598 } |
| 23597 | 23599 |
| 23598 } // namespace dart | 23600 } // namespace dart |
| OLD | NEW |