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

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

Issue 16107002: Prevent segfault if file cannot be opened when --ll_prof is used. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | « no previous file | src/platform-openbsd.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 // Support for ll_prof.py. 584 // Support for ll_prof.py.
585 // 585 //
586 // The Linux profiler built into the kernel logs all mmap's with 586 // The Linux profiler built into the kernel logs all mmap's with
587 // PROT_EXEC so that analysis tools can properly attribute ticks. We 587 // PROT_EXEC so that analysis tools can properly attribute ticks. We
588 // do a mmap with a name known by ll_prof.py and immediately munmap 588 // do a mmap with a name known by ll_prof.py and immediately munmap
589 // it. This injects a GC marker into the stream of events generated 589 // it. This injects a GC marker into the stream of events generated
590 // by the kernel and allows us to synchronize V8 code log and the 590 // by the kernel and allows us to synchronize V8 code log and the
591 // kernel log. 591 // kernel log.
592 int size = sysconf(_SC_PAGESIZE); 592 int size = sysconf(_SC_PAGESIZE);
593 FILE* f = fopen(FLAG_gc_fake_mmap, "w+"); 593 FILE* f = fopen(FLAG_gc_fake_mmap, "w+");
594 if (f == NULL) {
595 OS::PrintError("Failed to open %s\n", FLAG_gc_fake_mmap);
596 OS::Abort();
597 }
594 void* addr = mmap(OS::GetRandomMmapAddr(), 598 void* addr = mmap(OS::GetRandomMmapAddr(),
595 size, 599 size,
596 PROT_READ | PROT_EXEC, 600 PROT_READ | PROT_EXEC,
597 MAP_PRIVATE, 601 MAP_PRIVATE,
598 fileno(f), 602 fileno(f),
599 0); 603 0);
600 ASSERT(addr != MAP_FAILED); 604 ASSERT(addr != MAP_FAILED);
601 OS::Free(addr, size); 605 OS::Free(addr, size);
602 fclose(f); 606 fclose(f);
603 } 607 }
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 limit_mutex = CreateMutex(); 1000 limit_mutex = CreateMutex();
997 } 1001 }
998 1002
999 1003
1000 void OS::TearDown() { 1004 void OS::TearDown() {
1001 delete limit_mutex; 1005 delete limit_mutex;
1002 } 1006 }
1003 1007
1004 1008
1005 } } // namespace v8::internal 1009 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/platform-openbsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698