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 13 matching lines...) Expand all Loading... |
24 #include "vm/double_conversion.h" | 24 #include "vm/double_conversion.h" |
25 #include "vm/exceptions.h" | 25 #include "vm/exceptions.h" |
26 #include "vm/growable_array.h" | 26 #include "vm/growable_array.h" |
27 #include "vm/hash_table.h" | 27 #include "vm/hash_table.h" |
28 #include "vm/heap.h" | 28 #include "vm/heap.h" |
29 #include "vm/intrinsifier.h" | 29 #include "vm/intrinsifier.h" |
30 #include "vm/object_store.h" | 30 #include "vm/object_store.h" |
31 #include "vm/parser.h" | 31 #include "vm/parser.h" |
32 #include "vm/precompiler.h" | 32 #include "vm/precompiler.h" |
33 #include "vm/profiler.h" | 33 #include "vm/profiler.h" |
34 #include "vm/report.h" | |
35 #include "vm/reusable_handles.h" | 34 #include "vm/reusable_handles.h" |
36 #include "vm/runtime_entry.h" | 35 #include "vm/runtime_entry.h" |
37 #include "vm/scopes.h" | 36 #include "vm/scopes.h" |
38 #include "vm/stack_frame.h" | 37 #include "vm/stack_frame.h" |
39 #include "vm/symbols.h" | 38 #include "vm/symbols.h" |
40 #include "vm/tags.h" | 39 #include "vm/tags.h" |
41 #include "vm/thread_registry.h" | 40 #include "vm/thread_registry.h" |
42 #include "vm/timer.h" | 41 #include "vm/timer.h" |
43 #include "vm/unicode.h" | 42 #include "vm/unicode.h" |
44 #include "vm/verified_memory.h" | 43 #include "vm/verified_memory.h" |
(...skipping 12769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12814 | 12813 |
12815 // Copy the instructions into the instruction area and apply all fixups. | 12814 // Copy the instructions into the instruction area and apply all fixups. |
12816 // Embedded pointers are still in handles at this point. | 12815 // Embedded pointers are still in handles at this point. |
12817 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()), | 12816 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()), |
12818 instrs.size()); | 12817 instrs.size()); |
12819 assembler->FinalizeInstructions(region); | 12818 assembler->FinalizeInstructions(region); |
12820 VerifiedMemory::Accept(region.start(), region.size()); | 12819 VerifiedMemory::Accept(region.start(), region.size()); |
12821 CPU::FlushICache(instrs.EntryPoint(), instrs.size()); | 12820 CPU::FlushICache(instrs.EntryPoint(), instrs.size()); |
12822 | 12821 |
12823 code.set_compile_timestamp(OS::GetCurrentMonotonicMicros()); | 12822 code.set_compile_timestamp(OS::GetCurrentMonotonicMicros()); |
| 12823 #ifndef PRODUCT |
12824 CodeObservers::NotifyAll(name, | 12824 CodeObservers::NotifyAll(name, |
12825 instrs.EntryPoint(), | 12825 instrs.EntryPoint(), |
12826 assembler->prologue_offset(), | 12826 assembler->prologue_offset(), |
12827 instrs.size(), | 12827 instrs.size(), |
12828 optimized); | 12828 optimized); |
| 12829 #endif |
12829 { | 12830 { |
12830 NoSafepointScope no_safepoint; | 12831 NoSafepointScope no_safepoint; |
12831 const ZoneGrowableArray<intptr_t>& pointer_offsets = | 12832 const ZoneGrowableArray<intptr_t>& pointer_offsets = |
12832 assembler->GetPointerOffsets(); | 12833 assembler->GetPointerOffsets(); |
12833 ASSERT(pointer_offsets.length() == pointer_offset_count); | 12834 ASSERT(pointer_offsets.length() == pointer_offset_count); |
12834 ASSERT(code.pointer_offsets_length() == pointer_offsets.length()); | 12835 ASSERT(code.pointer_offsets_length() == pointer_offsets.length()); |
12835 | 12836 |
12836 // Set pointer offsets list in Code object and resolve all handles in | 12837 // Set pointer offsets list in Code object and resolve all handles in |
12837 // the instruction stream to raw objects. | 12838 // the instruction stream to raw objects. |
12838 for (intptr_t i = 0; i < pointer_offsets.length(); i++) { | 12839 for (intptr_t i = 0; i < pointer_offsets.length(); i++) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12875 total_code_size, code.comments().comments_.Length()); | 12876 total_code_size, code.comments().comments_.Length()); |
12876 return code.raw(); | 12877 return code.raw(); |
12877 } | 12878 } |
12878 | 12879 |
12879 | 12880 |
12880 RawCode* Code::FinalizeCode(const Function& function, | 12881 RawCode* Code::FinalizeCode(const Function& function, |
12881 Assembler* assembler, | 12882 Assembler* assembler, |
12882 bool optimized) { | 12883 bool optimized) { |
12883 // Calling ToLibNamePrefixedQualifiedCString is very expensive, | 12884 // Calling ToLibNamePrefixedQualifiedCString is very expensive, |
12884 // try to avoid it. | 12885 // try to avoid it. |
| 12886 #ifndef PRODUCT |
12885 if (CodeObservers::AreActive()) { | 12887 if (CodeObservers::AreActive()) { |
12886 return FinalizeCode(function.ToLibNamePrefixedQualifiedCString(), | 12888 return FinalizeCode(function.ToLibNamePrefixedQualifiedCString(), |
12887 assembler, | 12889 assembler, |
12888 optimized); | 12890 optimized); |
12889 } else { | |
12890 return FinalizeCode("", assembler, optimized); | |
12891 } | 12891 } |
| 12892 #endif // !PRODUCT |
| 12893 return FinalizeCode("", assembler, optimized); |
12892 } | 12894 } |
12893 | 12895 |
12894 | 12896 |
12895 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { | 12897 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { |
12896 return RawCode::ContainsPC(raw_obj, pc_); | 12898 return RawCode::ContainsPC(raw_obj, pc_); |
12897 } | 12899 } |
12898 | 12900 |
12899 | 12901 |
12900 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { | 12902 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { |
12901 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); | 12903 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); |
(...skipping 8530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21432 return UserTag::null(); | 21434 return UserTag::null(); |
21433 } | 21435 } |
21434 | 21436 |
21435 | 21437 |
21436 const char* UserTag::ToCString() const { | 21438 const char* UserTag::ToCString() const { |
21437 const String& tag_label = String::Handle(label()); | 21439 const String& tag_label = String::Handle(label()); |
21438 return tag_label.ToCString(); | 21440 return tag_label.ToCString(); |
21439 } | 21441 } |
21440 | 21442 |
21441 } // namespace dart | 21443 } // namespace dart |
OLD | NEW |