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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // Support for ll_prof.py. | 337 // Support for ll_prof.py. |
338 // | 338 // |
339 // The Linux profiler built into the kernel logs all mmap's with | 339 // The Linux profiler built into the kernel logs all mmap's with |
340 // PROT_EXEC so that analysis tools can properly attribute ticks. We | 340 // PROT_EXEC so that analysis tools can properly attribute ticks. We |
341 // do a mmap with a name known by ll_prof.py and immediately munmap | 341 // do a mmap with a name known by ll_prof.py and immediately munmap |
342 // it. This injects a GC marker into the stream of events generated | 342 // it. This injects a GC marker into the stream of events generated |
343 // by the kernel and allows us to synchronize V8 code log and the | 343 // by the kernel and allows us to synchronize V8 code log and the |
344 // kernel log. | 344 // kernel log. |
345 int size = sysconf(_SC_PAGESIZE); | 345 int size = sysconf(_SC_PAGESIZE); |
346 FILE* f = fopen(FLAG_gc_fake_mmap, "w+"); | 346 FILE* f = fopen(FLAG_gc_fake_mmap, "w+"); |
| 347 if (f == NULL) { |
| 348 OS::PrintError("Failed to open %s\n", FLAG_gc_fake_mmap); |
| 349 OS::Abort(); |
| 350 } |
347 void* addr = mmap(NULL, size, PROT_READ | PROT_EXEC, MAP_PRIVATE, | 351 void* addr = mmap(NULL, size, PROT_READ | PROT_EXEC, MAP_PRIVATE, |
348 fileno(f), 0); | 352 fileno(f), 0); |
349 ASSERT(addr != MAP_FAILED); | 353 ASSERT(addr != MAP_FAILED); |
350 OS::Free(addr, size); | 354 OS::Free(addr, size); |
351 fclose(f); | 355 fclose(f); |
352 } | 356 } |
353 | 357 |
354 | 358 |
355 int OS::StackWalk(Vector<OS::StackFrame> frames) { | 359 int OS::StackWalk(Vector<OS::StackFrame> frames) { |
356 // backtrace is a glibc extension. | 360 // backtrace is a glibc extension. |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 limit_mutex = CreateMutex(); | 739 limit_mutex = CreateMutex(); |
736 } | 740 } |
737 | 741 |
738 | 742 |
739 void OS::TearDown() { | 743 void OS::TearDown() { |
740 delete limit_mutex; | 744 delete limit_mutex; |
741 } | 745 } |
742 | 746 |
743 | 747 |
744 } } // namespace v8::internal | 748 } } // namespace v8::internal |
OLD | NEW |