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-posix.cc

Issue 9873023: Fix performance regressions due to lazy initialization. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 129
130 #define UNARY_MATH_FUNCTION(name, generator) \ 130 #define UNARY_MATH_FUNCTION(name, generator) \
131 static UnaryMathFunction fast_##name##_function = NULL; \ 131 static UnaryMathFunction fast_##name##_function = NULL; \
132 V8_DECLARE_ONCE(fast_##name##_init_once); \ 132 V8_DECLARE_ONCE(fast_##name##_init_once); \
133 void init_fast_##name##_function() { \ 133 void init_fast_##name##_function() { \
134 fast_##name##_function = generator; \ 134 fast_##name##_function = generator; \
135 } \ 135 } \
136 double fast_##name(double x) { \ 136 double fast_##name(double x) { \
137 CallOnce(&fast_##name##_init_once, \ 137 if (!fast_##name##_function) { \
danno 2012/03/29 07:45:17 Since this is also could be called frequently, per
Philippe 2012/03/29 09:00:48 I tried to do that initially by calling these init
danno 2012/03/29 09:07:20 Calling it from OS::PostSetUp seems fine. I would
Philippe 2012/03/29 09:26:53 Done.
138 &init_fast_##name##_function); \ 138 CallOnce(&fast_##name##_init_once, \
139 &init_fast_##name##_function); \
140 } \
139 return (*fast_##name##_function)(x); \ 141 return (*fast_##name##_function)(x); \
140 } 142 }
141 143
142 UNARY_MATH_FUNCTION(sin, CreateTranscendentalFunction(TranscendentalCache::SIN)) 144 UNARY_MATH_FUNCTION(sin, CreateTranscendentalFunction(TranscendentalCache::SIN))
143 UNARY_MATH_FUNCTION(cos, CreateTranscendentalFunction(TranscendentalCache::COS)) 145 UNARY_MATH_FUNCTION(cos, CreateTranscendentalFunction(TranscendentalCache::COS))
144 UNARY_MATH_FUNCTION(tan, CreateTranscendentalFunction(TranscendentalCache::TAN)) 146 UNARY_MATH_FUNCTION(tan, CreateTranscendentalFunction(TranscendentalCache::TAN))
145 UNARY_MATH_FUNCTION(log, CreateTranscendentalFunction(TranscendentalCache::LOG)) 147 UNARY_MATH_FUNCTION(log, CreateTranscendentalFunction(TranscendentalCache::LOG))
146 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) 148 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction())
147 149
148 #undef MATH_FUNCTION 150 #undef MATH_FUNCTION
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 return ntohl(value); 515 return ntohl(value);
514 } 516 }
515 517
516 518
517 Socket* OS::CreateSocket() { 519 Socket* OS::CreateSocket() {
518 return new POSIXSocket(); 520 return new POSIXSocket();
519 } 521 }
520 522
521 523
522 } } // namespace v8::internal 524 } } // namespace v8::internal
OLDNEW
« src/lazy-instance.h ('K') | « src/mksnapshot.cc ('k') | src/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698