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

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

Issue 9873023: Fix performance regressions due to lazy initialization. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make init traits non-template structs. Created 8 years, 8 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 | « src/platform-linux.cc ('k') | src/platform-nullos.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include <sys/sysctl.h> 51 #include <sys/sysctl.h>
52 #include <stdarg.h> 52 #include <stdarg.h>
53 #include <stdlib.h> 53 #include <stdlib.h>
54 #include <string.h> 54 #include <string.h>
55 #include <errno.h> 55 #include <errno.h>
56 56
57 #undef MAP_TYPE 57 #undef MAP_TYPE
58 58
59 #include "v8.h" 59 #include "v8.h"
60 60
61 #include "platform-posix.h"
61 #include "platform.h" 62 #include "platform.h"
62 #include "vm-state-inl.h" 63 #include "vm-state-inl.h"
63 64
64 // Manually define these here as weak imports, rather than including execinfo.h. 65 // Manually define these here as weak imports, rather than including execinfo.h.
65 // This lets us launch on 10.4 which does not have these calls. 66 // This lets us launch on 10.4 which does not have these calls.
66 extern "C" { 67 extern "C" {
67 extern int backtrace(void**, int) __attribute__((weak_import)); 68 extern int backtrace(void**, int) __attribute__((weak_import));
68 extern char** backtrace_symbols(void* const*, int) 69 extern char** backtrace_symbols(void* const*, int)
69 __attribute__((weak_import)); 70 __attribute__((weak_import));
70 extern void backtrace_symbols_fd(void* const*, int, int) 71 extern void backtrace_symbols_fd(void* const*, int, int)
(...skipping 23 matching lines...) Expand all
94 95
95 96
96 void OS::SetUp() { 97 void OS::SetUp() {
97 // Seed the random number generator. We preserve microsecond resolution. 98 // Seed the random number generator. We preserve microsecond resolution.
98 uint64_t seed = Ticks() ^ (getpid() << 16); 99 uint64_t seed = Ticks() ^ (getpid() << 16);
99 srandom(static_cast<unsigned int>(seed)); 100 srandom(static_cast<unsigned int>(seed));
100 limit_mutex = CreateMutex(); 101 limit_mutex = CreateMutex();
101 } 102 }
102 103
103 104
105 void OS::PostSetUp() {
106 // Math functions depend on CPU features therefore they are initialized after
107 // CPU.
108 MathSetup();
109 }
110
111
104 // We keep the lowest and highest addresses mapped as a quick way of 112 // We keep the lowest and highest addresses mapped as a quick way of
105 // determining that pointers are outside the heap (used mostly in assertions 113 // determining that pointers are outside the heap (used mostly in assertions
106 // and verification). The estimate is conservative, i.e., not all addresses in 114 // and verification). The estimate is conservative, i.e., not all addresses in
107 // 'allocated' space are actually allocated to our heap. The range is 115 // 'allocated' space are actually allocated to our heap. The range is
108 // [lowest, highest), inclusive on the low and and exclusive on the high end. 116 // [lowest, highest), inclusive on the low and and exclusive on the high end.
109 static void* lowest_ever_allocated = reinterpret_cast<void*>(-1); 117 static void* lowest_ever_allocated = reinterpret_cast<void*>(-1);
110 static void* highest_ever_allocated = reinterpret_cast<void*>(0); 118 static void* highest_ever_allocated = reinterpret_cast<void*>(0);
111 119
112 120
113 static void UpdateAllocatedSpaceLimits(void* address, int size) { 121 static void UpdateAllocatedSpaceLimits(void* address, int size) {
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 900
893 901
894 void Sampler::Stop() { 902 void Sampler::Stop() {
895 ASSERT(IsActive()); 903 ASSERT(IsActive());
896 SamplerThread::RemoveActiveSampler(this); 904 SamplerThread::RemoveActiveSampler(this);
897 SetActive(false); 905 SetActive(false);
898 } 906 }
899 907
900 908
901 } } // namespace v8::internal 909 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-linux.cc ('k') | src/platform-nullos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698