| 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 13981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13992 } else { | 13992 } else { |
| 13993 ASSERT(code.IsNull() || | 13993 ASSERT(code.IsNull() || |
| 13994 (code.function() == array.At(i + kSCallTableFunctionEntry))); | 13994 (code.function() == array.At(i + kSCallTableFunctionEntry))); |
| 13995 } | 13995 } |
| 13996 #endif | 13996 #endif |
| 13997 array.SetAt(i + kSCallTableCodeEntry, code); | 13997 array.SetAt(i + kSCallTableCodeEntry, code); |
| 13998 #endif | 13998 #endif |
| 13999 } | 13999 } |
| 14000 | 14000 |
| 14001 void Code::Disassemble(DisassemblyFormatter* formatter) const { | 14001 void Code::Disassemble(DisassemblyFormatter* formatter) const { |
| 14002 #ifndef PRODUCT | 14002 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) |
| 14003 if (!FLAG_support_disassembler) { | 14003 if (!FLAG_support_disassembler) { |
| 14004 return; | 14004 return; |
| 14005 } | 14005 } |
| 14006 const Instructions& instr = Instructions::Handle(instructions()); | 14006 const Instructions& instr = Instructions::Handle(instructions()); |
| 14007 uword start = instr.PayloadStart(); | 14007 uword start = instr.PayloadStart(); |
| 14008 if (formatter == NULL) { | 14008 if (formatter == NULL) { |
| 14009 Disassembler::Disassemble(start, start + instr.Size(), *this); | 14009 Disassembler::Disassemble(start, start + instr.Size(), *this); |
| 14010 } else { | 14010 } else { |
| 14011 Disassembler::Disassemble(start, start + instr.Size(), formatter, *this); | 14011 Disassembler::Disassemble(start, start + instr.Size(), formatter, *this); |
| 14012 } | 14012 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14081 result.set_pointer_offsets_length(pointer_offsets_length); | 14081 result.set_pointer_offsets_length(pointer_offsets_length); |
| 14082 result.set_is_optimized(false); | 14082 result.set_is_optimized(false); |
| 14083 result.set_is_alive(false); | 14083 result.set_is_alive(false); |
| 14084 result.set_comments(Comments::New(0)); | 14084 result.set_comments(Comments::New(0)); |
| 14085 result.set_compile_timestamp(0); | 14085 result.set_compile_timestamp(0); |
| 14086 result.set_pc_descriptors(Object::empty_descriptors()); | 14086 result.set_pc_descriptors(Object::empty_descriptors()); |
| 14087 } | 14087 } |
| 14088 return result.raw(); | 14088 return result.raw(); |
| 14089 } | 14089 } |
| 14090 | 14090 |
| 14091 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 14091 RawCode* Code::FinalizeCode(const char* name, | 14092 RawCode* Code::FinalizeCode(const char* name, |
| 14092 Assembler* assembler, | 14093 Assembler* assembler, |
| 14093 bool optimized) { | 14094 bool optimized) { |
| 14094 Isolate* isolate = Isolate::Current(); | 14095 Isolate* isolate = Isolate::Current(); |
| 14095 if (!isolate->compilation_allowed()) { | 14096 if (!isolate->compilation_allowed()) { |
| 14096 FATAL1("Precompilation missed code %s\n", name); | 14097 FATAL1("Precompilation missed code %s\n", name); |
| 14097 } | 14098 } |
| 14098 | 14099 |
| 14099 ASSERT(assembler != NULL); | 14100 ASSERT(assembler != NULL); |
| 14100 const ObjectPool& object_pool = | 14101 const ObjectPool& object_pool = |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14181 // Calling ToLibNamePrefixedQualifiedCString is very expensive, | 14182 // Calling ToLibNamePrefixedQualifiedCString is very expensive, |
| 14182 // try to avoid it. | 14183 // try to avoid it. |
| 14183 #ifndef PRODUCT | 14184 #ifndef PRODUCT |
| 14184 if (CodeObservers::AreActive()) { | 14185 if (CodeObservers::AreActive()) { |
| 14185 return FinalizeCode(function.ToLibNamePrefixedQualifiedCString(), assembler, | 14186 return FinalizeCode(function.ToLibNamePrefixedQualifiedCString(), assembler, |
| 14186 optimized); | 14187 optimized); |
| 14187 } | 14188 } |
| 14188 #endif // !PRODUCT | 14189 #endif // !PRODUCT |
| 14189 return FinalizeCode("", assembler, optimized); | 14190 return FinalizeCode("", assembler, optimized); |
| 14190 } | 14191 } |
| 14192 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 14191 | 14193 |
| 14192 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { | 14194 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { |
| 14193 return RawCode::ContainsPC(raw_obj, pc_); | 14195 return RawCode::ContainsPC(raw_obj, pc_); |
| 14194 } | 14196 } |
| 14195 | 14197 |
| 14196 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { | 14198 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { |
| 14197 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); | 14199 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); |
| 14198 if (isolate->heap() == NULL) { | 14200 if (isolate->heap() == NULL) { |
| 14199 return Code::null(); | 14201 return Code::null(); |
| 14200 } | 14202 } |
| (...skipping 8283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22484 } | 22486 } |
| 22485 return UserTag::null(); | 22487 return UserTag::null(); |
| 22486 } | 22488 } |
| 22487 | 22489 |
| 22488 const char* UserTag::ToCString() const { | 22490 const char* UserTag::ToCString() const { |
| 22489 const String& tag_label = String::Handle(label()); | 22491 const String& tag_label = String::Handle(label()); |
| 22490 return tag_label.ToCString(); | 22492 return tag_label.ToCString(); |
| 22491 } | 22493 } |
| 22492 | 22494 |
| 22493 } // namespace dart | 22495 } // namespace dart |
| OLD | NEW |