| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 #undef MAP_TYPE | 47 #undef MAP_TYPE |
| 48 | 48 |
| 49 #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) | 49 #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) |
| 50 #define LOG_TAG "v8" | 50 #define LOG_TAG "v8" |
| 51 #include <android/log.h> | 51 #include <android/log.h> |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 #include "v8.h" | 54 #include "v8.h" |
| 55 | 55 |
| 56 #include "codegen.h" | |
| 57 #include "platform.h" | 56 #include "platform.h" |
| 58 | 57 |
| 59 namespace v8 { | 58 namespace v8 { |
| 60 namespace internal { | 59 namespace internal { |
| 61 | 60 |
| 62 | 61 |
| 63 // Maximum size of the virtual memory. 0 means there is no artificial | 62 // Maximum size of the virtual memory. 0 means there is no artificial |
| 64 // limit. | 63 // limit. |
| 65 | 64 |
| 66 intptr_t OS::MaxVirtualMemory() { | 65 intptr_t OS::MaxVirtualMemory() { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 119 |
| 121 | 120 |
| 122 // ---------------------------------------------------------------------------- | 121 // ---------------------------------------------------------------------------- |
| 123 // Math functions | 122 // Math functions |
| 124 | 123 |
| 125 double modulo(double x, double y) { | 124 double modulo(double x, double y) { |
| 126 return fmod(x, y); | 125 return fmod(x, y); |
| 127 } | 126 } |
| 128 | 127 |
| 129 | 128 |
| 130 static Mutex* transcendental_function_mutex = OS::CreateMutex(); | |
| 131 | |
| 132 #define TRANSCENDENTAL_FUNCTION(name, type) \ | |
| 133 static TranscendentalFunction fast_##name##_function = NULL; \ | |
| 134 double fast_##name(double x) { \ | |
| 135 if (fast_##name##_function == NULL) { \ | |
| 136 ScopedLock lock(transcendental_function_mutex); \ | |
| 137 TranscendentalFunction temp = \ | |
| 138 CreateTranscendentalFunction(type); \ | |
| 139 MemoryBarrier(); \ | |
| 140 fast_##name##_function = temp; \ | |
| 141 } \ | |
| 142 return (*fast_##name##_function)(x); \ | |
| 143 } | |
| 144 | |
| 145 TRANSCENDENTAL_FUNCTION(sin, TranscendentalCache::SIN) | |
| 146 TRANSCENDENTAL_FUNCTION(cos, TranscendentalCache::COS) | |
| 147 TRANSCENDENTAL_FUNCTION(tan, TranscendentalCache::TAN) | |
| 148 TRANSCENDENTAL_FUNCTION(log, TranscendentalCache::LOG) | |
| 149 | |
| 150 #undef TRANSCENDENTAL_FUNCTION | |
| 151 | |
| 152 | |
| 153 double OS::nan_value() { | 129 double OS::nan_value() { |
| 154 // NAN from math.h is defined in C99 and not in POSIX. | 130 // NAN from math.h is defined in C99 and not in POSIX. |
| 155 return NAN; | 131 return NAN; |
| 156 } | 132 } |
| 157 | 133 |
| 158 | 134 |
| 159 // ---------------------------------------------------------------------------- | 135 // ---------------------------------------------------------------------------- |
| 160 // POSIX date/time support. | 136 // POSIX date/time support. |
| 161 // | 137 // |
| 162 | 138 |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 return ntohl(value); | 491 return ntohl(value); |
| 516 } | 492 } |
| 517 | 493 |
| 518 | 494 |
| 519 Socket* OS::CreateSocket() { | 495 Socket* OS::CreateSocket() { |
| 520 return new POSIXSocket(); | 496 return new POSIXSocket(); |
| 521 } | 497 } |
| 522 | 498 |
| 523 | 499 |
| 524 } } // namespace v8::internal | 500 } } // namespace v8::internal |
| OLD | NEW |