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 13900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13911 } else { | 13911 } else { |
13912 ASSERT(code.IsNull() || | 13912 ASSERT(code.IsNull() || |
13913 (code.function() == array.At(i + kSCallTableFunctionEntry))); | 13913 (code.function() == array.At(i + kSCallTableFunctionEntry))); |
13914 } | 13914 } |
13915 #endif | 13915 #endif |
13916 array.SetAt(i + kSCallTableCodeEntry, code); | 13916 array.SetAt(i + kSCallTableCodeEntry, code); |
13917 #endif | 13917 #endif |
13918 } | 13918 } |
13919 | 13919 |
13920 void Code::Disassemble(DisassemblyFormatter* formatter) const { | 13920 void Code::Disassemble(DisassemblyFormatter* formatter) const { |
13921 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) | 13921 #ifndef PRODUCT |
13922 if (!FLAG_support_disassembler) { | 13922 if (!FLAG_support_disassembler) { |
13923 return; | 13923 return; |
13924 } | 13924 } |
13925 const Instructions& instr = Instructions::Handle(instructions()); | 13925 const Instructions& instr = Instructions::Handle(instructions()); |
13926 uword start = instr.PayloadStart(); | 13926 uword start = instr.PayloadStart(); |
13927 if (formatter == NULL) { | 13927 if (formatter == NULL) { |
13928 Disassembler::Disassemble(start, start + instr.Size(), *this); | 13928 Disassembler::Disassemble(start, start + instr.Size(), *this); |
13929 } else { | 13929 } else { |
13930 Disassembler::Disassemble(start, start + instr.Size(), formatter, *this); | 13930 Disassembler::Disassemble(start, start + instr.Size(), formatter, *this); |
13931 } | 13931 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14000 result.set_pointer_offsets_length(pointer_offsets_length); | 14000 result.set_pointer_offsets_length(pointer_offsets_length); |
14001 result.set_is_optimized(false); | 14001 result.set_is_optimized(false); |
14002 result.set_is_alive(false); | 14002 result.set_is_alive(false); |
14003 result.set_comments(Comments::New(0)); | 14003 result.set_comments(Comments::New(0)); |
14004 result.set_compile_timestamp(0); | 14004 result.set_compile_timestamp(0); |
14005 result.set_pc_descriptors(Object::empty_descriptors()); | 14005 result.set_pc_descriptors(Object::empty_descriptors()); |
14006 } | 14006 } |
14007 return result.raw(); | 14007 return result.raw(); |
14008 } | 14008 } |
14009 | 14009 |
14010 #if !defined(DART_PRECOMPILED_RUNTIME) | |
14011 RawCode* Code::FinalizeCode(const char* name, | 14010 RawCode* Code::FinalizeCode(const char* name, |
14012 Assembler* assembler, | 14011 Assembler* assembler, |
14013 bool optimized) { | 14012 bool optimized) { |
14014 Isolate* isolate = Isolate::Current(); | 14013 Isolate* isolate = Isolate::Current(); |
14015 if (!isolate->compilation_allowed()) { | 14014 if (!isolate->compilation_allowed()) { |
14016 FATAL1("Precompilation missed code %s\n", name); | 14015 FATAL1("Precompilation missed code %s\n", name); |
14017 } | 14016 } |
14018 | 14017 |
14019 ASSERT(assembler != NULL); | 14018 ASSERT(assembler != NULL); |
14020 const ObjectPool& object_pool = | 14019 const ObjectPool& object_pool = |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14101 // Calling ToLibNamePrefixedQualifiedCString is very expensive, | 14100 // Calling ToLibNamePrefixedQualifiedCString is very expensive, |
14102 // try to avoid it. | 14101 // try to avoid it. |
14103 #ifndef PRODUCT | 14102 #ifndef PRODUCT |
14104 if (CodeObservers::AreActive()) { | 14103 if (CodeObservers::AreActive()) { |
14105 return FinalizeCode(function.ToLibNamePrefixedQualifiedCString(), assembler, | 14104 return FinalizeCode(function.ToLibNamePrefixedQualifiedCString(), assembler, |
14106 optimized); | 14105 optimized); |
14107 } | 14106 } |
14108 #endif // !PRODUCT | 14107 #endif // !PRODUCT |
14109 return FinalizeCode("", assembler, optimized); | 14108 return FinalizeCode("", assembler, optimized); |
14110 } | 14109 } |
14111 #endif // !defined(DART_PRECOMPILED_RUNTIME) | |
14112 | 14110 |
14113 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { | 14111 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { |
14114 return RawCode::ContainsPC(raw_obj, pc_); | 14112 return RawCode::ContainsPC(raw_obj, pc_); |
14115 } | 14113 } |
14116 | 14114 |
14117 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { | 14115 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { |
14118 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); | 14116 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); |
14119 if (isolate->heap() == NULL) { | 14117 if (isolate->heap() == NULL) { |
14120 return Code::null(); | 14118 return Code::null(); |
14121 } | 14119 } |
(...skipping 8417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22539 } | 22537 } |
22540 return UserTag::null(); | 22538 return UserTag::null(); |
22541 } | 22539 } |
22542 | 22540 |
22543 const char* UserTag::ToCString() const { | 22541 const char* UserTag::ToCString() const { |
22544 const String& tag_label = String::Handle(label()); | 22542 const String& tag_label = String::Handle(label()); |
22545 return tag_label.ToCString(); | 22543 return tag_label.ToCString(); |
22546 } | 22544 } |
22547 | 22545 |
22548 } // namespace dart | 22546 } // namespace dart |
OLD | NEW |