thread isolate for logging calls
R=svenpanne@chromium.org BUG= Review URL: https://codereview.chromium.org/23710025 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16646 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
8656dfdff9
commit
bf503d5f76
@ -866,7 +866,7 @@ void Isolate::PrintStack(FILE* out) {
|
||||
PrintStack(&accumulator);
|
||||
accumulator.OutputToFile(out);
|
||||
InitializeLoggingAndCounters();
|
||||
accumulator.Log();
|
||||
accumulator.Log(this);
|
||||
incomplete_message_ = NULL;
|
||||
stack_trace_nesting_level_ = 0;
|
||||
if (preallocated_message_space_ == NULL) {
|
||||
|
@ -656,7 +656,7 @@ void Profiler::Engage() {
|
||||
if (engaged_) return;
|
||||
engaged_ = true;
|
||||
|
||||
OS::LogSharedLibraryAddresses();
|
||||
OS::LogSharedLibraryAddresses(isolate_);
|
||||
|
||||
// Start thread processing the profiler buffer.
|
||||
running_ = true;
|
||||
|
@ -126,7 +126,7 @@ PosixMemoryMappedFile::~PosixMemoryMappedFile() {
|
||||
}
|
||||
|
||||
|
||||
void OS::LogSharedLibraryAddresses() {
|
||||
void OS::LogSharedLibraryAddresses(Isolate* isolate) {
|
||||
// This function assumes that the layout of the file is as follows:
|
||||
// hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name]
|
||||
// If we encounter an unexpected situation we abort scanning further entries.
|
||||
@ -137,7 +137,6 @@ void OS::LogSharedLibraryAddresses() {
|
||||
const int kLibNameLen = FILENAME_MAX + 1;
|
||||
char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen));
|
||||
|
||||
i::Isolate* isolate = Isolate::Current();
|
||||
// This loop will terminate once the scanning hits an EOF.
|
||||
while (true) {
|
||||
uintptr_t start, end;
|
||||
|
@ -139,7 +139,7 @@ static unsigned StringToLong(char* buffer) {
|
||||
}
|
||||
|
||||
|
||||
void OS::LogSharedLibraryAddresses() {
|
||||
void OS::LogSharedLibraryAddresses(Isolate* isolate) {
|
||||
static const int MAP_LENGTH = 1024;
|
||||
int fd = open("/proc/self/maps", O_RDONLY);
|
||||
if (fd < 0) return;
|
||||
@ -173,7 +173,7 @@ void OS::LogSharedLibraryAddresses() {
|
||||
// There may be no filename in this line. Skip to next.
|
||||
if (start_of_path == NULL) continue;
|
||||
buffer[bytes_read] = 0;
|
||||
LOG(i::Isolate::Current(), SharedLibraryEvent(start_of_path, start, end));
|
||||
LOG(isolate SharedLibraryEvent(start_of_path, start, end));
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ PosixMemoryMappedFile::~PosixMemoryMappedFile() {
|
||||
}
|
||||
|
||||
|
||||
void OS::LogSharedLibraryAddresses() {
|
||||
void OS::LogSharedLibraryAddresses(Isolate* isolate) {
|
||||
// This function assumes that the layout of the file is as follows:
|
||||
// hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name]
|
||||
// If we encounter an unexpected situation we abort scanning further entries.
|
||||
@ -224,7 +224,6 @@ void OS::LogSharedLibraryAddresses() {
|
||||
const int kLibNameLen = FILENAME_MAX + 1;
|
||||
char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen));
|
||||
|
||||
i::Isolate* isolate = Isolate::Current();
|
||||
// This loop will terminate once the scanning hits an EOF.
|
||||
while (true) {
|
||||
uintptr_t start, end;
|
||||
|
@ -145,7 +145,7 @@ PosixMemoryMappedFile::~PosixMemoryMappedFile() {
|
||||
}
|
||||
|
||||
|
||||
void OS::LogSharedLibraryAddresses() {
|
||||
void OS::LogSharedLibraryAddresses(Isolate* isolate) {
|
||||
unsigned int images_count = _dyld_image_count();
|
||||
for (unsigned int i = 0; i < images_count; ++i) {
|
||||
const mach_header* header = _dyld_get_image_header(i);
|
||||
@ -164,7 +164,7 @@ void OS::LogSharedLibraryAddresses() {
|
||||
if (code_ptr == NULL) continue;
|
||||
const uintptr_t slide = _dyld_get_image_vmaddr_slide(i);
|
||||
const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide;
|
||||
LOG(Isolate::Current(),
|
||||
LOG(isolate,
|
||||
SharedLibraryEvent(_dyld_get_image_name(i), start, start + size));
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ PosixMemoryMappedFile::~PosixMemoryMappedFile() {
|
||||
}
|
||||
|
||||
|
||||
void OS::LogSharedLibraryAddresses() {
|
||||
void OS::LogSharedLibraryAddresses(Isolate* isolate) {
|
||||
// This function assumes that the layout of the file is as follows:
|
||||
// hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name]
|
||||
// If we encounter an unexpected situation we abort scanning further entries.
|
||||
@ -143,7 +143,6 @@ void OS::LogSharedLibraryAddresses() {
|
||||
const int kLibNameLen = FILENAME_MAX + 1;
|
||||
char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen));
|
||||
|
||||
i::Isolate* isolate = Isolate::Current();
|
||||
// This loop will terminate once the scanning hits an EOF.
|
||||
while (true) {
|
||||
uintptr_t start, end;
|
||||
|
@ -149,7 +149,7 @@ PosixMemoryMappedFile::~PosixMemoryMappedFile() {
|
||||
}
|
||||
|
||||
|
||||
void OS::LogSharedLibraryAddresses() {
|
||||
void OS::LogSharedLibraryAddresses(Isolate* isolate) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -998,7 +998,7 @@ TLHELP32_FUNCTION_LIST(DLL_FUNC_LOADED)
|
||||
|
||||
|
||||
// Load the symbols for generating stack traces.
|
||||
static bool LoadSymbols(HANDLE process_handle) {
|
||||
static bool LoadSymbols(Isolate* isolate, HANDLE process_handle) {
|
||||
static bool symbols_loaded = false;
|
||||
|
||||
if (symbols_loaded) return true;
|
||||
@ -1047,7 +1047,7 @@ static bool LoadSymbols(HANDLE process_handle) {
|
||||
if (err != ERROR_MOD_NOT_FOUND &&
|
||||
err != ERROR_INVALID_HANDLE) return false;
|
||||
}
|
||||
LOG(i::Isolate::Current(),
|
||||
LOG(isolate,
|
||||
SharedLibraryEvent(
|
||||
module_entry.szExePath,
|
||||
reinterpret_cast<unsigned int>(module_entry.modBaseAddr),
|
||||
@ -1062,14 +1062,14 @@ static bool LoadSymbols(HANDLE process_handle) {
|
||||
}
|
||||
|
||||
|
||||
void OS::LogSharedLibraryAddresses() {
|
||||
void OS::LogSharedLibraryAddresses(Isolate* isolate) {
|
||||
// SharedLibraryEvents are logged when loading symbol information.
|
||||
// Only the shared libraries loaded at the time of the call to
|
||||
// LogSharedLibraryAddresses are logged. DLLs loaded after
|
||||
// initialization are not accounted for.
|
||||
if (!LoadDbgHelpAndTlHelp32()) return;
|
||||
HANDLE process_handle = GetCurrentProcess();
|
||||
LoadSymbols(process_handle);
|
||||
LoadSymbols(isolate, process_handle);
|
||||
}
|
||||
|
||||
|
||||
@ -1095,7 +1095,7 @@ int OS::StackWalk(Vector<OS::StackFrame> frames) {
|
||||
HANDLE thread_handle = GetCurrentThread();
|
||||
|
||||
// Read the symbols.
|
||||
if (!LoadSymbols(process_handle)) return kStackWalkError;
|
||||
if (!LoadSymbols(Isolate::Current(), process_handle)) return kStackWalkError;
|
||||
|
||||
// Capture current context.
|
||||
CONTEXT context;
|
||||
@ -1201,7 +1201,7 @@ int OS::StackWalk(Vector<OS::StackFrame> frames) {
|
||||
#pragma warning(pop)
|
||||
|
||||
#else // __MINGW32__
|
||||
void OS::LogSharedLibraryAddresses() { }
|
||||
void OS::LogSharedLibraryAddresses(Isolate* isolate) { }
|
||||
void OS::SignalCodeMovingGC() { }
|
||||
int OS::StackWalk(Vector<OS::StackFrame> frames) { return 0; }
|
||||
#endif // __MINGW32__
|
||||
|
@ -263,7 +263,7 @@ class OS {
|
||||
|
||||
// Support for the profiler. Can do nothing, in which case ticks
|
||||
// occuring in shared libraries will not be properly accounted for.
|
||||
static void LogSharedLibraryAddresses();
|
||||
static void LogSharedLibraryAddresses(Isolate* isolate);
|
||||
|
||||
// Support for the profiler. Notifies the external profiling
|
||||
// process that a code moving garbage collection starts. Can do
|
||||
|
@ -269,8 +269,8 @@ SmartArrayPointer<const char> StringStream::ToCString() const {
|
||||
}
|
||||
|
||||
|
||||
void StringStream::Log() {
|
||||
LOG(Isolate::Current(), StringEvent("StackDump", buffer_));
|
||||
void StringStream::Log(Isolate* isolate) {
|
||||
LOG(isolate, StringEvent("StackDump", buffer_));
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,7 +147,7 @@ class StringStream {
|
||||
// Getting the message out.
|
||||
void OutputToFile(FILE* out);
|
||||
void OutputToStdOut() { OutputToFile(stdout); }
|
||||
void Log();
|
||||
void Log(Isolate* isolate);
|
||||
Handle<String> ToString(Isolate* isolate);
|
||||
SmartArrayPointer<const char> ToCString() const;
|
||||
int length() const { return length_; }
|
||||
|
Loading…
Reference in New Issue
Block a user