| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/codegen.h" | 5 #include "src/codegen.h" |
| 6 | 6 |
| 7 #if defined(V8_OS_AIX) | 7 #if defined(V8_OS_AIX) |
| 8 #include <fenv.h> // NOLINT(build/c++11) | 8 #include <fenv.h> // NOLINT(build/c++11) |
| 9 #endif | 9 #endif |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 #define UNARY_MATH_FUNCTION(name, generator) \ | 67 #define UNARY_MATH_FUNCTION(name, generator) \ |
| 68 static UnaryMathFunction fast_##name##_function = NULL; \ | 68 static UnaryMathFunction fast_##name##_function = NULL; \ |
| 69 void init_fast_##name##_function() { \ | 69 void init_fast_##name##_function() { \ |
| 70 fast_##name##_function = generator; \ | 70 fast_##name##_function = generator; \ |
| 71 } \ | 71 } \ |
| 72 double fast_##name(double x) { \ | 72 double fast_##name(double x) { \ |
| 73 return (*fast_##name##_function)(x); \ | 73 return (*fast_##name##_function)(x); \ |
| 74 } | 74 } |
| 75 | 75 |
| 76 UNARY_MATH_FUNCTION(exp, CreateExpFunction()) | |
| 77 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) | 76 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) |
| 78 | 77 |
| 79 #undef UNARY_MATH_FUNCTION | 78 #undef UNARY_MATH_FUNCTION |
| 80 | 79 |
| 80 static UnaryMathFunctionWithIsolate fast_exp_function = NULL; |
| 81 | 81 |
| 82 void lazily_initialize_fast_exp() { | 82 |
| 83 if (fast_exp_function == NULL) { | 83 double std_exp(double x, Isolate* isolate) { |
| 84 init_fast_exp_function(); | 84 return std::exp(x); |
| 85 } |
| 86 |
| 87 |
| 88 void init_fast_exp_function(Isolate* isolate) { |
| 89 if (FLAG_fast_math) fast_exp_function = CreateExpFunction(isolate); |
| 90 if (!fast_exp_function) fast_exp_function = std_exp; |
| 91 } |
| 92 |
| 93 |
| 94 double fast_exp(double x, Isolate* isolate) { |
| 95 return (*fast_exp_function)(x, isolate); |
| 96 } |
| 97 |
| 98 |
| 99 void lazily_initialize_fast_exp(Isolate* isolate) { |
| 100 if (fast_exp_function == nullptr) { |
| 101 init_fast_exp_function(isolate); |
| 85 } | 102 } |
| 86 } | 103 } |
| 87 | 104 |
| 88 | 105 |
| 89 #define __ ACCESS_MASM(masm_) | 106 #define __ ACCESS_MASM(masm_) |
| 90 | 107 |
| 91 #ifdef DEBUG | 108 #ifdef DEBUG |
| 92 | 109 |
| 93 Comment::Comment(MacroAssembler* masm, const char* msg) | 110 Comment::Comment(MacroAssembler* masm, const char* msg) |
| 94 : masm_(masm), msg_(msg) { | 111 : masm_(masm), msg_(msg) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 os << "source_position = " << literal->start_position() << "\n"; | 241 os << "source_position = " << literal->start_position() << "\n"; |
| 225 } | 242 } |
| 226 code->Disassemble(debug_name.get(), os); | 243 code->Disassemble(debug_name.get(), os); |
| 227 os << "--- End code ---\n"; | 244 os << "--- End code ---\n"; |
| 228 } | 245 } |
| 229 #endif // ENABLE_DISASSEMBLER | 246 #endif // ENABLE_DISASSEMBLER |
| 230 } | 247 } |
| 231 | 248 |
| 232 } // namespace internal | 249 } // namespace internal |
| 233 } // namespace v8 | 250 } // namespace v8 |
| OLD | NEW |