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

Side by Side Diff: src/platform.h

Issue 328993003: Drop dependency on Isolate* from platform.h (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 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 | « src/log.cc ('k') | src/platform-cygwin.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This module contains the platform-specific code. This make the rest of the 5 // This module contains the platform-specific code. This make the rest of the
6 // code less dependent on operating system, compilers and runtime libraries. 6 // code less dependent on operating system, compilers and runtime libraries.
7 // This module does specifically not deal with differences between different 7 // This module does specifically not deal with differences between different
8 // processor architecture. 8 // processor architecture.
9 // The platform classes have the same definition for all platforms. The 9 // The platform classes have the same definition for all platforms. The
10 // implementation for a particular platform is put in platform_<os>.cc. 10 // implementation for a particular platform is put in platform_<os>.cc.
11 // The build system then uses the implementation for the target platform. 11 // The build system then uses the implementation for the target platform.
12 // 12 //
13 // This design has been chosen because it is simple and fast. Alternatively, 13 // This design has been chosen because it is simple and fast. Alternatively,
14 // the platform dependent classes could have been implemented using abstract 14 // the platform dependent classes could have been implemented using abstract
15 // superclasses with virtual methods and having specializations for each 15 // superclasses with virtual methods and having specializations for each
16 // platform. This design was rejected because it was more complicated and 16 // platform. This design was rejected because it was more complicated and
17 // slower. It would require factory methods for selecting the right 17 // slower. It would require factory methods for selecting the right
18 // implementation and the overhead of virtual methods for performance 18 // implementation and the overhead of virtual methods for performance
19 // sensitive like mutex locking/unlocking. 19 // sensitive like mutex locking/unlocking.
20 20
21 #ifndef V8_PLATFORM_H_ 21 #ifndef V8_PLATFORM_H_
22 #define V8_PLATFORM_H_ 22 #define V8_PLATFORM_H_
23 23
24 #include <stdarg.h> 24 #include <stdarg.h>
25 #include <string>
26 #include <vector>
25 27
26 #include "src/base/build_config.h" 28 #include "src/base/build_config.h"
27 #include "src/platform/mutex.h" 29 #include "src/platform/mutex.h"
28 #include "src/platform/semaphore.h" 30 #include "src/platform/semaphore.h"
29 #include "src/vector.h" 31 #include "src/vector.h"
30 32
31 #ifdef __sun 33 #ifdef __sun
32 # ifndef signbit 34 # ifndef signbit
33 namespace std { 35 namespace std {
34 int signbit(double x); 36 int signbit(double x);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 static int SNPrintF(Vector<char> str, const char* format, ...); 250 static int SNPrintF(Vector<char> str, const char* format, ...);
249 static int VSNPrintF(Vector<char> str, 251 static int VSNPrintF(Vector<char> str,
250 const char* format, 252 const char* format,
251 va_list args); 253 va_list args);
252 254
253 static char* StrChr(char* str, int c); 255 static char* StrChr(char* str, int c);
254 static void StrNCpy(Vector<char> dest, const char* src, size_t n); 256 static void StrNCpy(Vector<char> dest, const char* src, size_t n);
255 257
256 // Support for the profiler. Can do nothing, in which case ticks 258 // Support for the profiler. Can do nothing, in which case ticks
257 // occuring in shared libraries will not be properly accounted for. 259 // occuring in shared libraries will not be properly accounted for.
258 static void LogSharedLibraryAddresses(Isolate* isolate); 260 struct SharedLibraryAddress {
261 SharedLibraryAddress(
262 const std::string& library_path, uintptr_t start, uintptr_t end)
263 : library_path(library_path), start(start), end(end) {}
264
265 std::string library_path;
266 uintptr_t start;
267 uintptr_t end;
268 };
269
270 static std::vector<SharedLibraryAddress> GetSharedLibraryAddresses();
259 271
260 // Support for the profiler. Notifies the external profiling 272 // Support for the profiler. Notifies the external profiling
261 // process that a code moving garbage collection starts. Can do 273 // process that a code moving garbage collection starts. Can do
262 // nothing, in which case the code objects must not move (e.g., by 274 // nothing, in which case the code objects must not move (e.g., by
263 // using --never-compact) if accurate profiling is desired. 275 // using --never-compact) if accurate profiling is desired.
264 static void SignalCodeMovingGC(); 276 static void SignalCodeMovingGC();
265 277
266 // Returns the number of processors online. 278 // Returns the number of processors online.
267 static int NumberOfProcessorsOnline(); 279 static int NumberOfProcessorsOnline();
268 280
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 char name_[kMaxThreadNameLength]; 508 char name_[kMaxThreadNameLength];
497 int stack_size_; 509 int stack_size_;
498 Semaphore* start_semaphore_; 510 Semaphore* start_semaphore_;
499 511
500 DISALLOW_COPY_AND_ASSIGN(Thread); 512 DISALLOW_COPY_AND_ASSIGN(Thread);
501 }; 513 };
502 514
503 } } // namespace v8::internal 515 } } // namespace v8::internal
504 516
505 #endif // V8_PLATFORM_H_ 517 #endif // V8_PLATFORM_H_
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/platform-cygwin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698