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

Side by Side Diff: src/base/platform/platform.h

Issue 656143004: Remove (untested) code for unsupported compilers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix comment. Created 6 years, 2 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/base/compiler-specific.h ('k') | src/base/platform/platform-win32.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_BASE_PLATFORM_PLATFORM_H_ 21 #ifndef V8_BASE_PLATFORM_PLATFORM_H_
22 #define V8_BASE_PLATFORM_PLATFORM_H_ 22 #define V8_BASE_PLATFORM_PLATFORM_H_
23 23
24 #include <stdarg.h> 24 #include <cstdarg>
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/base/platform/mutex.h" 29 #include "src/base/platform/mutex.h"
30 #include "src/base/platform/semaphore.h" 30 #include "src/base/platform/semaphore.h"
31 31
32 #if V8_OS_QNX 32 #if V8_OS_QNX
33 #include "src/base/qnx-math.h" 33 #include "src/base/qnx-math.h"
34 #endif 34 #endif
35 35
36 // Microsoft Visual C++ specific stuff.
37 #if V8_LIBC_MSVCRT
38
39 #include "src/base/win32-headers.h"
40 #include "src/base/win32-math.h"
41
42 int strncasecmp(const char* s1, const char* s2, int n);
43
44 // Visual C++ 2013 and higher implement this function.
45 #if (_MSC_VER < 1800)
46 inline int lrint(double flt) {
47 int intgr;
48 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
49 __asm {
50 fld flt
51 fistp intgr
52 };
53 #else
54 intgr = static_cast<int>(flt + 0.5);
55 if ((intgr & 1) != 0 && intgr - flt == 0.5) {
56 // If the number is halfway between two integers, round to the even one.
57 intgr--;
58 }
59 #endif
60 return intgr;
61 }
62 #endif // _MSC_VER < 1800
63
64 #endif // V8_LIBC_MSVCRT
65
66 namespace v8 { 36 namespace v8 {
67 namespace base { 37 namespace base {
68 38
69 // ---------------------------------------------------------------------------- 39 // ----------------------------------------------------------------------------
70 // Fast TLS support 40 // Fast TLS support
71 41
72 #ifndef V8_NO_FAST_TLS 42 #ifndef V8_NO_FAST_TLS
73 43
74 #if defined(_MSC_VER) && (V8_HOST_ARCH_IA32) 44 #if V8_CC_MSVC && V8_HOST_ARCH_IA32
75 45
76 #define V8_FAST_TLS_SUPPORTED 1 46 #define V8_FAST_TLS_SUPPORTED 1
77 47
78 INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index)); 48 INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index));
79 49
80 inline intptr_t InternalGetExistingThreadLocal(intptr_t index) { 50 inline intptr_t InternalGetExistingThreadLocal(intptr_t index) {
81 const intptr_t kTibInlineTlsOffset = 0xE10; 51 const intptr_t kTibInlineTlsOffset = 0xE10;
82 const intptr_t kTibExtraTlsOffset = 0xF94; 52 const intptr_t kTibExtraTlsOffset = 0xF94;
83 const intptr_t kMaxInlineSlots = 64; 53 const intptr_t kMaxInlineSlots = 64;
84 const intptr_t kMaxSlots = kMaxInlineSlots + 1024; 54 const intptr_t kMaxSlots = kMaxInlineSlots + 1024;
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 char name_[kMaxThreadNameLength]; 469 char name_[kMaxThreadNameLength];
500 int stack_size_; 470 int stack_size_;
501 Semaphore* start_semaphore_; 471 Semaphore* start_semaphore_;
502 472
503 DISALLOW_COPY_AND_ASSIGN(Thread); 473 DISALLOW_COPY_AND_ASSIGN(Thread);
504 }; 474 };
505 475
506 } } // namespace v8::base 476 } } // namespace v8::base
507 477
508 #endif // V8_BASE_PLATFORM_PLATFORM_H_ 478 #endif // V8_BASE_PLATFORM_PLATFORM_H_
OLDNEW
« no previous file with comments | « src/base/compiler-specific.h ('k') | src/base/platform/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698