Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Side by Side Diff: runtime/vm/object.cc

Issue 11028143: Mark optimized functions with a * in the perf event symbol output. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 6962 matching lines...) Expand 10 before | Expand all | Expand 10 after
6973 result ^= raw; 6973 result ^= raw;
6974 result.set_pointer_offsets_length(pointer_offsets_length); 6974 result.set_pointer_offsets_length(pointer_offsets_length);
6975 result.set_is_optimized(false); 6975 result.set_is_optimized(false);
6976 result.set_is_alive(true); 6976 result.set_is_alive(true);
6977 result.set_comments(Comments::New(0)); 6977 result.set_comments(Comments::New(0));
6978 } 6978 }
6979 return result.raw(); 6979 return result.raw();
6980 } 6980 }
6981 6981
6982 6982
6983 RawCode* Code::FinalizeCode(const char* name, Assembler* assembler) { 6983 RawCode* Code::FinalizeCode(const char* name,
6984 Assembler* assembler,
6985 bool optimized) {
6984 ASSERT(assembler != NULL); 6986 ASSERT(assembler != NULL);
6985 6987
6986 // Allocate the Instructions object. 6988 // Allocate the Instructions object.
6987 Instructions& instrs = 6989 Instructions& instrs =
6988 Instructions::ZoneHandle(Instructions::New(assembler->CodeSize())); 6990 Instructions::ZoneHandle(Instructions::New(assembler->CodeSize()));
6989 6991
6990 // Copy the instructions into the instruction area and apply all fixups. 6992 // Copy the instructions into the instruction area and apply all fixups.
6991 // Embedded pointers are still in handles at this point. 6993 // Embedded pointers are still in handles at this point.
6992 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()), 6994 MemoryRegion region(reinterpret_cast<void*>(instrs.EntryPoint()),
6993 instrs.size()); 6995 instrs.size());
6994 assembler->FinalizeInstructions(region); 6996 assembler->FinalizeInstructions(region);
6995 Dart_FileWriterFunction perf_events_writer = Dart::perf_events_writer(); 6997 Dart_FileWriterFunction perf_events_writer = Dart::perf_events_writer();
6996 if (perf_events_writer != NULL) { 6998 if (perf_events_writer != NULL) {
6997 const char* format = "%"Px" %"Px" %s\n"; 6999 const char* format = "%"Px" %"Px" %s%s\n";
6998 uword addr = instrs.EntryPoint(); 7000 uword addr = instrs.EntryPoint();
6999 uword size = instrs.size(); 7001 uword size = instrs.size();
7000 intptr_t len = OS::SNPrint(NULL, 0, format, addr, size, name); 7002 const char* marker = optimized ? "*" : "";
7003 intptr_t len = OS::SNPrint(NULL, 0, format, addr, size, marker, name);
7001 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len + 1); 7004 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len + 1);
7002 OS::SNPrint(buffer, len + 1, format, addr, size, name); 7005 OS::SNPrint(buffer, len + 1, format, addr, size, marker, name);
7003 (*perf_events_writer)(buffer, len); 7006 (*perf_events_writer)(buffer, len);
7004 } 7007 }
7005 DebugInfo* pprof_symbol_generator = Dart::pprof_symbol_generator(); 7008 DebugInfo* pprof_symbol_generator = Dart::pprof_symbol_generator();
7006 if (pprof_symbol_generator != NULL) { 7009 if (pprof_symbol_generator != NULL) {
7007 ASSERT(strlen(name) != 0); 7010 ASSERT(strlen(name) != 0);
7008 pprof_symbol_generator->AddCode(instrs.EntryPoint(), instrs.size()); 7011 pprof_symbol_generator->AddCode(instrs.EntryPoint(), instrs.size());
7009 pprof_symbol_generator->AddCodeRegion(name, 7012 pprof_symbol_generator->AddCodeRegion(name,
7010 instrs.EntryPoint(), 7013 instrs.EntryPoint(),
7011 instrs.size()); 7014 instrs.size());
7012 } 7015 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
7051 } 7054 }
7052 7055
7053 // Hook up Code and Instruction objects. 7056 // Hook up Code and Instruction objects.
7054 instrs.set_code(code.raw()); 7057 instrs.set_code(code.raw());
7055 code.set_instructions(instrs.raw()); 7058 code.set_instructions(instrs.raw());
7056 } 7059 }
7057 return code.raw(); 7060 return code.raw();
7058 } 7061 }
7059 7062
7060 7063
7061 RawCode* Code::FinalizeCode(const Function& function, Assembler* assembler) { 7064 RawCode* Code::FinalizeCode(const Function& function,
7065 Assembler* assembler,
7066 bool optimized) {
7062 // Calling ToFullyQualifiedCString is very expensive, try to avoid it. 7067 // Calling ToFullyQualifiedCString is very expensive, try to avoid it.
7063 if (FLAG_generate_gdb_symbols || 7068 if (FLAG_generate_gdb_symbols ||
7064 Dart::perf_events_writer() != NULL || 7069 Dart::perf_events_writer() != NULL ||
7065 Dart::pprof_symbol_generator() != NULL) { 7070 Dart::pprof_symbol_generator() != NULL) {
7066 return FinalizeCode(function.ToFullyQualifiedCString(), assembler); 7071 return FinalizeCode(function.ToFullyQualifiedCString(),
7072 assembler,
7073 optimized);
7067 } else { 7074 } else {
7068 return FinalizeCode("", assembler); 7075 return FinalizeCode("", assembler);
7069 } 7076 }
7070 } 7077 }
7071 7078
7072 7079
7073 // Check if object matches find condition. 7080 // Check if object matches find condition.
7074 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) { 7081 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) {
7075 return RawInstructions::ContainsPC(obj, pc_); 7082 return RawInstructions::ContainsPC(obj, pc_);
7076 } 7083 }
(...skipping 5121 matching lines...) Expand 10 before | Expand all | Expand 10 after
12198 } 12205 }
12199 return result.raw(); 12206 return result.raw();
12200 } 12207 }
12201 12208
12202 12209
12203 const char* WeakProperty::ToCString() const { 12210 const char* WeakProperty::ToCString() const {
12204 return "_WeakProperty"; 12211 return "_WeakProperty";
12205 } 12212 }
12206 12213
12207 } // namespace dart 12214 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698