| OLD | NEW |
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 // Microsoft Visual C++ specific stuff. | 62 // Microsoft Visual C++ specific stuff. |
| 63 #if V8_CC_MSVC | 63 #if V8_CC_MSVC |
| 64 | 64 |
| 65 #include "win32-headers.h" | 65 #include "win32-headers.h" |
| 66 #include "win32-math.h" | 66 #include "win32-math.h" |
| 67 | 67 |
| 68 int strncasecmp(const char* s1, const char* s2, int n); | 68 int strncasecmp(const char* s1, const char* s2, int n); |
| 69 | 69 |
| 70 // Visual C++ 2013 and higher implement this function. | |
| 71 #if (_MSC_VER < 1800) | |
| 72 inline int lrint(double flt) { | 70 inline int lrint(double flt) { |
| 73 int intgr; | 71 int intgr; |
| 74 #if V8_TARGET_ARCH_IA32 | 72 #if V8_TARGET_ARCH_IA32 |
| 75 __asm { | 73 __asm { |
| 76 fld flt | 74 fld flt |
| 77 fistp intgr | 75 fistp intgr |
| 78 }; | 76 }; |
| 79 #else | 77 #else |
| 80 intgr = static_cast<int>(flt + 0.5); | 78 intgr = static_cast<int>(flt + 0.5); |
| 81 if ((intgr & 1) != 0 && intgr - flt == 0.5) { | 79 if ((intgr & 1) != 0 && intgr - flt == 0.5) { |
| 82 // If the number is halfway between two integers, round to the even one. | 80 // If the number is halfway between two integers, round to the even one. |
| 83 intgr--; | 81 intgr--; |
| 84 } | 82 } |
| 85 #endif | 83 #endif |
| 86 return intgr; | 84 return intgr; |
| 87 } | 85 } |
| 88 | 86 |
| 89 #endif // _MSC_VER < 1800 | |
| 90 | |
| 91 #endif // V8_CC_MSVC | 87 #endif // V8_CC_MSVC |
| 92 | 88 |
| 93 namespace v8 { | 89 namespace v8 { |
| 94 namespace internal { | 90 namespace internal { |
| 95 | 91 |
| 96 double ceiling(double x); | 92 double ceiling(double x); |
| 97 double modulo(double x, double y); | 93 double modulo(double x, double y); |
| 98 | 94 |
| 99 // Custom implementation of math functions. | 95 // Custom implementation of math functions. |
| 100 double fast_sin(double input); | 96 double fast_sin(double input); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 257 |
| 262 // Walk the stack. | 258 // Walk the stack. |
| 263 static const int kStackWalkError = -1; | 259 static const int kStackWalkError = -1; |
| 264 static const int kStackWalkMaxNameLen = 256; | 260 static const int kStackWalkMaxNameLen = 256; |
| 265 static const int kStackWalkMaxTextLen = 256; | 261 static const int kStackWalkMaxTextLen = 256; |
| 266 struct StackFrame { | 262 struct StackFrame { |
| 267 void* address; | 263 void* address; |
| 268 char text[kStackWalkMaxTextLen]; | 264 char text[kStackWalkMaxTextLen]; |
| 269 }; | 265 }; |
| 270 | 266 |
| 267 static int StackWalk(Vector<StackFrame> frames); |
| 268 |
| 271 class MemoryMappedFile { | 269 class MemoryMappedFile { |
| 272 public: | 270 public: |
| 273 static MemoryMappedFile* open(const char* name); | 271 static MemoryMappedFile* open(const char* name); |
| 274 static MemoryMappedFile* create(const char* name, int size, void* initial); | 272 static MemoryMappedFile* create(const char* name, int size, void* initial); |
| 275 virtual ~MemoryMappedFile() { } | 273 virtual ~MemoryMappedFile() { } |
| 276 virtual void* memory() = 0; | 274 virtual void* memory() = 0; |
| 277 virtual int size() = 0; | 275 virtual int size() = 0; |
| 278 }; | 276 }; |
| 279 | 277 |
| 280 // Safe formatting print. Ensures that str is always null-terminated. | 278 // Safe formatting print. Ensures that str is always null-terminated. |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 char name_[kMaxThreadNameLength]; | 590 char name_[kMaxThreadNameLength]; |
| 593 int stack_size_; | 591 int stack_size_; |
| 594 Semaphore* start_semaphore_; | 592 Semaphore* start_semaphore_; |
| 595 | 593 |
| 596 DISALLOW_COPY_AND_ASSIGN(Thread); | 594 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 597 }; | 595 }; |
| 598 | 596 |
| 599 } } // namespace v8::internal | 597 } } // namespace v8::internal |
| 600 | 598 |
| 601 #endif // V8_PLATFORM_H_ | 599 #endif // V8_PLATFORM_H_ |
| OLD | NEW |