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

Side by Side Diff: src/platform-linux.cc

Issue 6696042: Adding 'isolates' argument to LOG to get rid of multiple TLS fetches in profiling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/isolates
Patch Set: Created 9 years, 9 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 251
252 void* OS::Allocate(const size_t requested, 252 void* OS::Allocate(const size_t requested,
253 size_t* allocated, 253 size_t* allocated,
254 bool is_executable) { 254 bool is_executable) {
255 // TODO(805): Port randomization of allocated executable memory to Linux. 255 // TODO(805): Port randomization of allocated executable memory to Linux.
256 const size_t msize = RoundUp(requested, sysconf(_SC_PAGESIZE)); 256 const size_t msize = RoundUp(requested, sysconf(_SC_PAGESIZE));
257 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); 257 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
258 void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 258 void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
259 if (mbase == MAP_FAILED) { 259 if (mbase == MAP_FAILED) {
260 LOG(StringEvent("OS::Allocate", "mmap failed")); 260 LOG(ISOLATE,StringEvent("OS::Allocate", "mmap failed"));
261 return NULL; 261 return NULL;
262 } 262 }
263 *allocated = msize; 263 *allocated = msize;
264 UpdateAllocatedSpaceLimits(mbase, msize); 264 UpdateAllocatedSpaceLimits(mbase, msize);
265 return mbase; 265 return mbase;
266 } 266 }
267 267
268 268
269 void OS::Free(void* address, const size_t size) { 269 void OS::Free(void* address, const size_t size) {
270 // TODO(1240712): munmap has a return value which is ignored here. 270 // TODO(1240712): munmap has a return value which is ignored here.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 // This function assumes that the layout of the file is as follows: 371 // This function assumes that the layout of the file is as follows:
372 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] 372 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name]
373 // If we encounter an unexpected situation we abort scanning further entries. 373 // If we encounter an unexpected situation we abort scanning further entries.
374 FILE* fp = fopen("/proc/self/maps", "r"); 374 FILE* fp = fopen("/proc/self/maps", "r");
375 if (fp == NULL) return; 375 if (fp == NULL) return;
376 376
377 // Allocate enough room to be able to store a full file name. 377 // Allocate enough room to be able to store a full file name.
378 const int kLibNameLen = FILENAME_MAX + 1; 378 const int kLibNameLen = FILENAME_MAX + 1;
379 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen)); 379 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen));
380 380
381 i::Isolate* isolate = ISOLATE;
381 // This loop will terminate once the scanning hits an EOF. 382 // This loop will terminate once the scanning hits an EOF.
382 while (true) { 383 while (true) {
383 uintptr_t start, end; 384 uintptr_t start, end;
384 char attr_r, attr_w, attr_x, attr_p; 385 char attr_r, attr_w, attr_x, attr_p;
385 // Parse the addresses and permission bits at the beginning of the line. 386 // Parse the addresses and permission bits at the beginning of the line.
386 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break; 387 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break;
387 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break; 388 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break;
388 389
389 int c; 390 int c;
390 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') { 391 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') {
(...skipping 13 matching lines...) Expand all
404 405
405 // Drop the newline character read by fgets. We do not need to check 406 // Drop the newline character read by fgets. We do not need to check
406 // for a zero-length string because we know that we at least read the 407 // for a zero-length string because we know that we at least read the
407 // '/' character. 408 // '/' character.
408 lib_name[strlen(lib_name) - 1] = '\0'; 409 lib_name[strlen(lib_name) - 1] = '\0';
409 } else { 410 } else {
410 // No library name found, just record the raw address range. 411 // No library name found, just record the raw address range.
411 snprintf(lib_name, kLibNameLen, 412 snprintf(lib_name, kLibNameLen,
412 "%08" V8PRIxPTR "-%08" V8PRIxPTR, start, end); 413 "%08" V8PRIxPTR "-%08" V8PRIxPTR, start, end);
413 } 414 }
414 LOG(SharedLibraryEvent(lib_name, start, end)); 415 LOG(isolate, SharedLibraryEvent(lib_name, start, end));
415 } else { 416 } else {
416 // Entry not describing executable data. Skip to end of line to setup 417 // Entry not describing executable data. Skip to end of line to setup
417 // reading the next entry. 418 // reading the next entry.
418 do { 419 do {
419 c = getc(fp); 420 c = getc(fp);
420 } while ((c != EOF) && (c != '\n')); 421 } while ((c != EOF) && (c != '\n'));
421 if (c == EOF) break; 422 if (c == EOF) break;
422 } 423 }
423 } 424 }
424 free(lib_name); 425 free(lib_name);
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 1029
1029 void Sampler::Stop() { 1030 void Sampler::Stop() {
1030 ASSERT(IsActive()); 1031 ASSERT(IsActive());
1031 SignalSender::RemoveActiveSampler(this); 1032 SignalSender::RemoveActiveSampler(this);
1032 SetActive(false); 1033 SetActive(false);
1033 } 1034 }
1034 1035
1035 #endif // ENABLE_LOGGING_AND_PROFILING 1036 #endif // ENABLE_LOGGING_AND_PROFILING
1036 1037
1037 } } // namespace v8::internal 1038 } } // namespace v8::internal
OLDNEW
« src/compiler.cc ('K') | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698