OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 c = getc(fp); | 316 c = getc(fp); |
317 } while ((c != EOF) && (c != '\n')); | 317 } while ((c != EOF) && (c != '\n')); |
318 if (c == EOF) break; | 318 if (c == EOF) break; |
319 } | 319 } |
320 } | 320 } |
321 free(lib_name); | 321 free(lib_name); |
322 fclose(fp); | 322 fclose(fp); |
323 } | 323 } |
324 | 324 |
325 | 325 |
326 static const char kGCFakeMmap[] = "/tmp/__v8_gc__"; | |
327 | |
328 | |
329 void OS::SignalCodeMovingGC() { | 326 void OS::SignalCodeMovingGC() { |
330 // Support for ll_prof.py. | 327 // Support for ll_prof.py. |
331 // | 328 // |
332 // The Linux profiler built into the kernel logs all mmap's with | 329 // The Linux profiler built into the kernel logs all mmap's with |
333 // PROT_EXEC so that analysis tools can properly attribute ticks. We | 330 // PROT_EXEC so that analysis tools can properly attribute ticks. We |
334 // do a mmap with a name known by ll_prof.py and immediately munmap | 331 // do a mmap with a name known by ll_prof.py and immediately munmap |
335 // it. This injects a GC marker into the stream of events generated | 332 // it. This injects a GC marker into the stream of events generated |
336 // by the kernel and allows us to synchronize V8 code log and the | 333 // by the kernel and allows us to synchronize V8 code log and the |
337 // kernel log. | 334 // kernel log. |
338 int size = sysconf(_SC_PAGESIZE); | 335 int size = sysconf(_SC_PAGESIZE); |
339 FILE* f = fopen(kGCFakeMmap, "w+"); | 336 FILE* f = fopen(FLAG_gc_fake_mmap, "w+"); |
340 void* addr = mmap(NULL, size, PROT_READ | PROT_EXEC, MAP_PRIVATE, | 337 void* addr = mmap(NULL, size, PROT_READ | PROT_EXEC, MAP_PRIVATE, |
341 fileno(f), 0); | 338 fileno(f), 0); |
342 ASSERT(addr != MAP_FAILED); | 339 ASSERT(addr != MAP_FAILED); |
343 OS::Free(addr, size); | 340 OS::Free(addr, size); |
344 fclose(f); | 341 fclose(f); |
345 } | 342 } |
346 | 343 |
347 | 344 |
348 int OS::StackWalk(Vector<OS::StackFrame> frames) { | 345 int OS::StackWalk(Vector<OS::StackFrame> frames) { |
349 // backtrace is a glibc extension. | 346 // backtrace is a glibc extension. |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 | 972 |
976 | 973 |
977 void Sampler::Stop() { | 974 void Sampler::Stop() { |
978 ASSERT(IsActive()); | 975 ASSERT(IsActive()); |
979 SignalSender::RemoveActiveSampler(this); | 976 SignalSender::RemoveActiveSampler(this); |
980 SetActive(false); | 977 SetActive(false); |
981 } | 978 } |
982 | 979 |
983 | 980 |
984 } } // namespace v8::internal | 981 } } // namespace v8::internal |
OLD | NEW |