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

Unified Diff: src/codegen.cc

Issue 1468313004: Make fast_exp take an Isolate* paramter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codegen.h ('k') | src/crankshaft/hydrogen-instructions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen.cc
diff --git a/src/codegen.cc b/src/codegen.cc
index 1e806d2ae53da0391061b8c19f12443af0902ebf..47066887e00224d6362cbffb9ac0b7e4b75a428e 100644
--- a/src/codegen.cc
+++ b/src/codegen.cc
@@ -73,15 +73,32 @@ double fast_##name(double x) { \
return (*fast_##name##_function)(x); \
}
-UNARY_MATH_FUNCTION(exp, CreateExpFunction())
UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction())
#undef UNARY_MATH_FUNCTION
+static UnaryMathFunctionWithIsolate fast_exp_function = NULL;
-void lazily_initialize_fast_exp() {
- if (fast_exp_function == NULL) {
- init_fast_exp_function();
+
+double std_exp(double x, Isolate* isolate) {
+ return std::exp(x);
+}
+
+
+void init_fast_exp_function(Isolate* isolate) {
+ if (FLAG_fast_math) fast_exp_function = CreateExpFunction(isolate);
+ if (!fast_exp_function) fast_exp_function = std_exp;
+}
+
+
+double fast_exp(double x, Isolate* isolate) {
+ return (*fast_exp_function)(x, isolate);
+}
+
+
+void lazily_initialize_fast_exp(Isolate* isolate) {
+ if (fast_exp_function == nullptr) {
+ init_fast_exp_function(isolate);
}
}
« no previous file with comments | « src/codegen.h ('k') | src/crankshaft/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698