v8/src/codegen.cc
Toon Verwaest 4cb88e3ab4 Cleanup codegen.h includes
Bug: 
Change-Id: I67cfd5634e86472425c161b461684bd975e58a41
Reviewed-on: https://chromium-review.googlesource.com/730204
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48783}
2017-10-20 11:56:01 +00:00

35 lines
1.3 KiB
C++

// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/codegen.h"
#include <cmath>
#include <memory>
#include "src/flags.h"
namespace v8 {
namespace internal {
#define UNARY_MATH_FUNCTION(name, generator) \
static UnaryMathFunctionWithIsolate fast_##name##_function = nullptr; \
double std_##name(double x, Isolate* isolate) { return std::name(x); } \
void init_fast_##name##_function(Isolate* isolate) { \
if (FLAG_fast_math) fast_##name##_function = generator(isolate); \
if (!fast_##name##_function) fast_##name##_function = std_##name; \
} \
void lazily_initialize_fast_##name(Isolate* isolate) { \
if (!fast_##name##_function) init_fast_##name##_function(isolate); \
} \
double fast_##name(double x, Isolate* isolate) { \
return (*fast_##name##_function)(x, isolate); \
}
UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction)
#undef UNARY_MATH_FUNCTION
} // namespace internal
} // namespace v8