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

Side by Side Diff: src/platform-posix.cc

Issue 11418149: Faster implementation of Math.exp() (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Win build Created 8 years 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/platform.h ('k') | src/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 // 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 fast_##name##_function = generator; \ 135 fast_##name##_function = generator; \
136 } \ 136 } \
137 double fast_##name(double x) { \ 137 double fast_##name(double x) { \
138 return (*fast_##name##_function)(x); \ 138 return (*fast_##name##_function)(x); \
139 } 139 }
140 140
141 UNARY_MATH_FUNCTION(sin, CreateTranscendentalFunction(TranscendentalCache::SIN)) 141 UNARY_MATH_FUNCTION(sin, CreateTranscendentalFunction(TranscendentalCache::SIN))
142 UNARY_MATH_FUNCTION(cos, CreateTranscendentalFunction(TranscendentalCache::COS)) 142 UNARY_MATH_FUNCTION(cos, CreateTranscendentalFunction(TranscendentalCache::COS))
143 UNARY_MATH_FUNCTION(tan, CreateTranscendentalFunction(TranscendentalCache::TAN)) 143 UNARY_MATH_FUNCTION(tan, CreateTranscendentalFunction(TranscendentalCache::TAN))
144 UNARY_MATH_FUNCTION(log, CreateTranscendentalFunction(TranscendentalCache::LOG)) 144 UNARY_MATH_FUNCTION(log, CreateTranscendentalFunction(TranscendentalCache::LOG))
145 UNARY_MATH_FUNCTION(exp, CreateExpFunction())
145 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) 146 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction())
146 147
147 #undef MATH_FUNCTION 148 #undef MATH_FUNCTION
148 149
149 150
151 void lazily_initialize_fast_exp() {
152 if (fast_exp_function == NULL) {
153 init_fast_exp_function();
154 }
155 }
156
157
150 double OS::nan_value() { 158 double OS::nan_value() {
151 // NAN from math.h is defined in C99 and not in POSIX. 159 // NAN from math.h is defined in C99 and not in POSIX.
152 return NAN; 160 return NAN;
153 } 161 }
154 162
155 163
156 int OS::GetCurrentProcessId() { 164 int OS::GetCurrentProcessId() {
157 return static_cast<int>(getpid()); 165 return static_cast<int>(getpid());
158 } 166 }
159 167
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 333
326 334
327 void POSIXPostSetUp() { 335 void POSIXPostSetUp() {
328 #if defined(V8_TARGET_ARCH_IA32) 336 #if defined(V8_TARGET_ARCH_IA32)
329 memcopy_function = CreateMemCopyFunction(); 337 memcopy_function = CreateMemCopyFunction();
330 #endif 338 #endif
331 init_fast_sin_function(); 339 init_fast_sin_function();
332 init_fast_cos_function(); 340 init_fast_cos_function();
333 init_fast_tan_function(); 341 init_fast_tan_function();
334 init_fast_log_function(); 342 init_fast_log_function();
343 // fast_exp is initialized lazily.
335 init_fast_sqrt_function(); 344 init_fast_sqrt_function();
336 } 345 }
337 346
338 // ---------------------------------------------------------------------------- 347 // ----------------------------------------------------------------------------
339 // POSIX string support. 348 // POSIX string support.
340 // 349 //
341 350
342 char* OS::StrChr(char* str, int c) { 351 char* OS::StrChr(char* str, int c) {
343 return strchr(str, c); 352 return strchr(str, c);
344 } 353 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 return ntohl(value); 550 return ntohl(value);
542 } 551 }
543 552
544 553
545 Socket* OS::CreateSocket() { 554 Socket* OS::CreateSocket() {
546 return new POSIXSocket(); 555 return new POSIXSocket();
547 } 556 }
548 557
549 558
550 } } // namespace v8::internal 559 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform.h ('k') | src/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698