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

Side by Side Diff: src/platform.h

Issue 328343003: Remove dependency on Vector from platform files (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
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.
(...skipping 10 matching lines...) Expand all
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> 25 #include <string>
26 #include <vector> 26 #include <vector>
27 27
28 #include "src/base/build_config.h" 28 #include "src/base/build_config.h"
29 #include "src/platform/mutex.h" 29 #include "src/platform/mutex.h"
30 #include "src/platform/semaphore.h" 30 #include "src/platform/semaphore.h"
31 #include "src/vector.h"
32 31
33 #ifdef __sun 32 #ifdef __sun
34 # ifndef signbit 33 # ifndef signbit
35 namespace std { 34 namespace std {
36 int signbit(double x); 35 int signbit(double x);
37 } 36 }
38 # endif 37 # endif
39 #endif 38 #endif
40 39
41 #if V8_OS_QNX 40 #if V8_OS_QNX
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 public: 239 public:
241 static MemoryMappedFile* open(const char* name); 240 static MemoryMappedFile* open(const char* name);
242 static MemoryMappedFile* create(const char* name, int size, void* initial); 241 static MemoryMappedFile* create(const char* name, int size, void* initial);
243 virtual ~MemoryMappedFile() { } 242 virtual ~MemoryMappedFile() { }
244 virtual void* memory() = 0; 243 virtual void* memory() = 0;
245 virtual int size() = 0; 244 virtual int size() = 0;
246 }; 245 };
247 246
248 // Safe formatting print. Ensures that str is always null-terminated. 247 // Safe formatting print. Ensures that str is always null-terminated.
249 // Returns the number of chars written, or -1 if output was truncated. 248 // Returns the number of chars written, or -1 if output was truncated.
250 static int SNPrintF(Vector<char> str, const char* format, ...); 249 static int SNPrintF(char* str, int length, const char* format, ...);
251 static int VSNPrintF(Vector<char> str, 250 static int VSNPrintF(char* str,
251 int length,
252 const char* format, 252 const char* format,
253 va_list args); 253 va_list args);
254 254
255 static char* StrChr(char* str, int c); 255 static char* StrChr(char* str, int c);
256 static void StrNCpy(Vector<char> dest, const char* src, size_t n); 256 static void StrNCpy(char* dest, int length, const char* src, size_t n);
257 257
258 // Support for the profiler. Can do nothing, in which case ticks 258 // Support for the profiler. Can do nothing, in which case ticks
259 // occuring in shared libraries will not be properly accounted for. 259 // occuring in shared libraries will not be properly accounted for.
260 struct SharedLibraryAddress { 260 struct SharedLibraryAddress {
261 SharedLibraryAddress( 261 SharedLibraryAddress(
262 const std::string& library_path, uintptr_t start, uintptr_t end) 262 const std::string& library_path, uintptr_t start, uintptr_t end)
263 : library_path(library_path), start(start), end(end) {} 263 : library_path(library_path), start(start), end(end) {}
264 264
265 std::string library_path; 265 std::string library_path;
266 uintptr_t start; 266 uintptr_t start;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // Thread 401 // Thread
402 // 402 //
403 // Thread objects are used for creating and running threads. When the start() 403 // Thread objects are used for creating and running threads. When the start()
404 // method is called the new thread starts running the run() method in the new 404 // method is called the new thread starts running the run() method in the new
405 // thread. The Thread object should not be deallocated before the thread has 405 // thread. The Thread object should not be deallocated before the thread has
406 // terminated. 406 // terminated.
407 407
408 class Thread { 408 class Thread {
409 public: 409 public:
410 // Opaque data type for thread-local storage keys. 410 // Opaque data type for thread-local storage keys.
411 // LOCAL_STORAGE_KEY_MIN_VALUE and LOCAL_STORAGE_KEY_MAX_VALUE are specified 411 typedef int32_t LocalStorageKey;
412 // to ensure that enumeration type has correct value range (see Issue 830 for
413 // more details).
414 enum LocalStorageKey {
415 LOCAL_STORAGE_KEY_MIN_VALUE = kMinInt,
416 LOCAL_STORAGE_KEY_MAX_VALUE = kMaxInt
417 };
418 412
419 class Options { 413 class Options {
420 public: 414 public:
421 Options() : name_("v8:<unknown>"), stack_size_(0) {} 415 Options() : name_("v8:<unknown>"), stack_size_(0) {}
422 Options(const char* name, int stack_size = 0) 416 Options(const char* name, int stack_size = 0)
423 : name_(name), stack_size_(stack_size) {} 417 : name_(name), stack_size_(stack_size) {}
424 418
425 const char* name() const { return name_; } 419 const char* name() const { return name_; }
426 int stack_size() const { return stack_size_; } 420 int stack_size() const { return stack_size_; }
427 421
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 char name_[kMaxThreadNameLength]; 502 char name_[kMaxThreadNameLength];
509 int stack_size_; 503 int stack_size_;
510 Semaphore* start_semaphore_; 504 Semaphore* start_semaphore_;
511 505
512 DISALLOW_COPY_AND_ASSIGN(Thread); 506 DISALLOW_COPY_AND_ASSIGN(Thread);
513 }; 507 };
514 508
515 } } // namespace v8::internal 509 } } // namespace v8::internal
516 510
517 #endif // V8_PLATFORM_H_ 511 #endif // V8_PLATFORM_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/platform-posix.cc » ('j') | src/platform-solaris.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698