[builtins] Port various Math builtins to torque.
This patch ports the following builtins to torque: - Math.acos() - Math.acosh() - Math.asin() - Math.asinh() - Math.atan() - Math.atan2() - Math.atanh() - Math.cbrt() - Math.cos() - Math.cosh() - Math.exp() - Math.expm1() - Math.fround() - Math.log() - Math.log1p() - Math.log10() - Math.log2() - Math.sin() - Math.sinh() - Math.sqrt() - Math.tan() - Math.tanh() Change-Id: Ia7b0246744e4b0cace696dc309622e287397be1f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1584169 Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#61168}
This commit is contained in:
parent
393f788c1f
commit
e8986a4e06
1
AUTHORS
1
AUTHORS
@ -45,6 +45,7 @@ Alessandro Pignotti <alessandro@leaningtech.com>
|
||||
Alex Kodat <akodat@rocketsoftware.com>
|
||||
Alexander Botero-Lowry <alexbl@FreeBSD.org>
|
||||
Alexander Karpinsky <homm86@gmail.com>
|
||||
Alexander Neville <dark@volatile.bz>
|
||||
Alexandre Vassalotti <avassalotti@gmail.com>
|
||||
Alexis Campailla <alexis@janeasystems.com>
|
||||
Allan Sandfeld Jensen <allan.jensen@qt.io>
|
||||
|
2
BUILD.gn
2
BUILD.gn
@ -940,6 +940,7 @@ torque_files = [
|
||||
"src/builtins/extras-utils.tq",
|
||||
"src/builtins/internal-coverage.tq",
|
||||
"src/builtins/iterator.tq",
|
||||
"src/builtins/math.tq",
|
||||
"src/builtins/object-fromentries.tq",
|
||||
"src/builtins/proxy.tq",
|
||||
"src/builtins/proxy-constructor.tq",
|
||||
@ -997,6 +998,7 @@ torque_namespaces = [
|
||||
"growable-fixed-array",
|
||||
"internal-coverage",
|
||||
"iterator",
|
||||
"math",
|
||||
"object",
|
||||
"proxy",
|
||||
"regexp",
|
||||
|
@ -1749,6 +1749,7 @@ extern macro ChangeFloat64ToUintPtr(float64): uintptr;
|
||||
extern macro ChangeInt32ToIntPtr(int32): intptr; // Sign-extends.
|
||||
extern macro ChangeUint32ToWord(uint32): uintptr; // Doesn't sign-extend.
|
||||
extern macro LoadNativeContext(Context): NativeContext;
|
||||
extern macro TruncateFloat64ToFloat32(float64): float32;
|
||||
extern macro LoadJSArrayElementsMap(constexpr ElementsKind, Context): Map;
|
||||
extern macro LoadJSArrayElementsMap(ElementsKind, Context): Map;
|
||||
extern macro ChangeNonnegativeNumberToUintPtr(Number): uintptr;
|
||||
@ -1944,6 +1945,12 @@ Convert<uintptr, Number>(n: Number): uintptr {
|
||||
Convert<float64, float32>(f: float32): float64 {
|
||||
return ChangeFloat32ToFloat64(f);
|
||||
}
|
||||
Convert<float32, float64>(f: float64): float32 {
|
||||
return TruncateFloat64ToFloat32(f);
|
||||
}
|
||||
Convert<float32, Number>(n: Number): float32 {
|
||||
return Convert<float32>(ChangeNumberToFloat64(n));
|
||||
}
|
||||
Convert<Number, float64>(d: float64): Number {
|
||||
return AllocateHeapNumberWithValue(d);
|
||||
}
|
||||
|
@ -643,50 +643,16 @@ namespace internal {
|
||||
/* Math */ \
|
||||
/* ES6 #sec-math.abs */ \
|
||||
TFJ(MathAbs, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.acos */ \
|
||||
TFJ(MathAcos, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.acosh */ \
|
||||
TFJ(MathAcosh, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.asin */ \
|
||||
TFJ(MathAsin, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.asinh */ \
|
||||
TFJ(MathAsinh, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.atan */ \
|
||||
TFJ(MathAtan, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.atanh */ \
|
||||
TFJ(MathAtanh, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.atan2 */ \
|
||||
TFJ(MathAtan2, 2, kReceiver, kY, kX) \
|
||||
/* ES6 #sec-math.cbrt */ \
|
||||
TFJ(MathCbrt, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.ceil */ \
|
||||
TFJ(MathCeil, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.clz32 */ \
|
||||
TFJ(MathClz32, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.cos */ \
|
||||
TFJ(MathCos, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.cosh */ \
|
||||
TFJ(MathCosh, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.exp */ \
|
||||
TFJ(MathExp, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.expm1 */ \
|
||||
TFJ(MathExpm1, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.floor */ \
|
||||
TFJ(MathFloor, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.fround */ \
|
||||
TFJ(MathFround, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.hypot */ \
|
||||
CPP(MathHypot) \
|
||||
/* ES6 #sec-math.imul */ \
|
||||
TFJ(MathImul, 2, kReceiver, kX, kY) \
|
||||
/* ES6 #sec-math.log */ \
|
||||
TFJ(MathLog, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.log1p */ \
|
||||
TFJ(MathLog1p, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.log10 */ \
|
||||
TFJ(MathLog10, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.log2 */ \
|
||||
TFJ(MathLog2, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.max */ \
|
||||
TFJ(MathMax, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
|
||||
/* ES6 #sec-math.min */ \
|
||||
@ -699,16 +665,6 @@ namespace internal {
|
||||
TFJ(MathRound, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.sign */ \
|
||||
TFJ(MathSign, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.sin */ \
|
||||
TFJ(MathSin, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.sinh */ \
|
||||
TFJ(MathSinh, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.sqrt */ \
|
||||
TFJ(MathTan, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.tan */ \
|
||||
TFJ(MathTanh, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.tanh */ \
|
||||
TFJ(MathSqrt, 1, kReceiver, kX) \
|
||||
/* ES6 #sec-math.trunc */ \
|
||||
TFJ(MathTrunc, 1, kReceiver, kX) \
|
||||
\
|
||||
|
@ -141,15 +141,6 @@ void MathBuiltinsAssembler::MathRoundingOperation(
|
||||
}
|
||||
}
|
||||
|
||||
void MathBuiltinsAssembler::MathUnaryOperation(
|
||||
Node* context, Node* x,
|
||||
TNode<Float64T> (CodeStubAssembler::*float64op)(SloppyTNode<Float64T>)) {
|
||||
Node* x_value = TruncateTaggedToFloat64(context, x);
|
||||
Node* value = (this->*float64op)(x_value);
|
||||
Node* result = AllocateHeapNumberWithValue(value);
|
||||
Return(result);
|
||||
}
|
||||
|
||||
void MathBuiltinsAssembler::MathMaxMin(
|
||||
Node* context, Node* argc,
|
||||
TNode<Float64T> (CodeStubAssembler::*float64op)(SloppyTNode<Float64T>,
|
||||
@ -170,60 +161,6 @@ void MathBuiltinsAssembler::MathMaxMin(
|
||||
arguments.PopAndReturn(ChangeFloat64ToTagged(result.value()));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.acos
|
||||
TF_BUILTIN(MathAcos, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Acos);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.acosh
|
||||
TF_BUILTIN(MathAcosh, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Acosh);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.asin
|
||||
TF_BUILTIN(MathAsin, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Asin);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.asinh
|
||||
TF_BUILTIN(MathAsinh, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Asinh);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.atan
|
||||
TF_BUILTIN(MathAtan, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Atan);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.atanh
|
||||
TF_BUILTIN(MathAtanh, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Atanh);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.atan2
|
||||
TF_BUILTIN(MathAtan2, CodeStubAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* y = Parameter(Descriptor::kY);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
|
||||
Node* y_value = TruncateTaggedToFloat64(context, y);
|
||||
Node* x_value = TruncateTaggedToFloat64(context, x);
|
||||
Node* value = Float64Atan2(y_value, x_value);
|
||||
Node* result = AllocateHeapNumberWithValue(value);
|
||||
Return(result);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.ceil
|
||||
TF_BUILTIN(MathCeil, MathBuiltinsAssembler) {
|
||||
@ -232,13 +169,6 @@ TF_BUILTIN(MathCeil, MathBuiltinsAssembler) {
|
||||
MathRoundingOperation(context, x, &CodeStubAssembler::Float64Ceil);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.cbrt
|
||||
TF_BUILTIN(MathCbrt, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Cbrt);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.clz32
|
||||
TF_BUILTIN(MathClz32, CodeStubAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
@ -297,34 +227,6 @@ TF_BUILTIN(MathClz32, CodeStubAssembler) {
|
||||
}
|
||||
}
|
||||
|
||||
// ES6 #sec-math.cos
|
||||
TF_BUILTIN(MathCos, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Cos);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.cosh
|
||||
TF_BUILTIN(MathCosh, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Cosh);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.exp
|
||||
TF_BUILTIN(MathExp, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Exp);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.expm1
|
||||
TF_BUILTIN(MathExpm1, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Expm1);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.floor
|
||||
TF_BUILTIN(MathFloor, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
@ -332,17 +234,6 @@ TF_BUILTIN(MathFloor, MathBuiltinsAssembler) {
|
||||
MathRoundingOperation(context, x, &CodeStubAssembler::Float64Floor);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.fround
|
||||
TF_BUILTIN(MathFround, CodeStubAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
Node* x_value = TruncateTaggedToFloat64(context, x);
|
||||
Node* value32 = TruncateFloat64ToFloat32(x_value);
|
||||
Node* value = ChangeFloat32ToFloat64(value32);
|
||||
Node* result = AllocateHeapNumberWithValue(value);
|
||||
Return(result);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.imul
|
||||
TF_BUILTIN(MathImul, CodeStubAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
@ -355,34 +246,6 @@ TF_BUILTIN(MathImul, CodeStubAssembler) {
|
||||
Return(result);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.log
|
||||
TF_BUILTIN(MathLog, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Log);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.log1p
|
||||
TF_BUILTIN(MathLog1p, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Log1p);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.log10
|
||||
TF_BUILTIN(MathLog10, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Log10);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.log2
|
||||
TF_BUILTIN(MathLog2, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Log2);
|
||||
}
|
||||
|
||||
CodeStubAssembler::Node* MathBuiltinsAssembler::MathPow(Node* context,
|
||||
Node* base,
|
||||
Node* exponent) {
|
||||
@ -466,41 +329,6 @@ TF_BUILTIN(MathSign, CodeStubAssembler) {
|
||||
Return(SmiConstant(1));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.sin
|
||||
TF_BUILTIN(MathSin, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Sin);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.sinh
|
||||
TF_BUILTIN(MathSinh, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Sinh);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.sqrt
|
||||
TF_BUILTIN(MathSqrt, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Sqrt);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.tan
|
||||
TF_BUILTIN(MathTan, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Tan);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.tanh
|
||||
TF_BUILTIN(MathTanh, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* x = Parameter(Descriptor::kX);
|
||||
MathUnaryOperation(context, x, &CodeStubAssembler::Float64Tanh);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.trunc
|
||||
TF_BUILTIN(MathTrunc, MathBuiltinsAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
|
@ -21,9 +21,6 @@ class MathBuiltinsAssembler : public CodeStubAssembler {
|
||||
void MathRoundingOperation(
|
||||
Node* context, Node* x,
|
||||
TNode<Float64T> (CodeStubAssembler::*float64op)(SloppyTNode<Float64T>));
|
||||
void MathUnaryOperation(
|
||||
Node* context, Node* x,
|
||||
TNode<Float64T> (CodeStubAssembler::*float64op)(SloppyTNode<Float64T>));
|
||||
void MathMaxMin(Node* context, Node* argc,
|
||||
TNode<Float64T> (CodeStubAssembler::*float64op)(
|
||||
SloppyTNode<Float64T>, SloppyTNode<Float64T>),
|
||||
|
@ -527,7 +527,6 @@ namespace data_view {
|
||||
|
||||
extern macro ToNumber(Context, Object): Number;
|
||||
extern macro ToBigInt(Context, Object): BigInt;
|
||||
extern macro TruncateFloat64ToFloat32(float64): float32;
|
||||
extern macro TruncateFloat64ToWord32(float64): uint32;
|
||||
|
||||
extern macro DataViewBuiltinsAssembler::StoreWord8(RawPtr, uintptr, uint32):
|
||||
|
203
src/builtins/math.tq
Normal file
203
src/builtins/math.tq
Normal file
@ -0,0 +1,203 @@
|
||||
// Copyright 2019 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.
|
||||
|
||||
namespace math {
|
||||
// ES6 #sec-math.acos
|
||||
extern macro Float64Acos(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathAcos(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Acos(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.acosh
|
||||
extern macro Float64Acosh(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathAcosh(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Acosh(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.asin
|
||||
extern macro Float64Asin(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathAsin(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Asin(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.asinh
|
||||
extern macro Float64Asinh(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathAsinh(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Asinh(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.atan
|
||||
extern macro Float64Atan(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathAtan(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Atan(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.atan2
|
||||
extern macro Float64Atan2(float64, float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathAtan2(context: Context, receiver: Object, y: Object, x: Object): Number {
|
||||
const yValue = Convert<float64>(ToNumber_Inline(context, y));
|
||||
const xValue = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Atan2(yValue, xValue));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.atanh
|
||||
extern macro Float64Atanh(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathAtanh(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Atanh(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.cbrt
|
||||
extern macro Float64Cbrt(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathCbrt(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Cbrt(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.cos
|
||||
extern macro Float64Cos(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathCos(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Cos(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.cosh
|
||||
extern macro Float64Cosh(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathCosh(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Cosh(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.exp
|
||||
extern macro Float64Exp(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathExp(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Exp(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.expm1
|
||||
extern macro Float64Expm1(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathExpm1(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Expm1(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.fround
|
||||
transitioning javascript builtin
|
||||
MathFround(context: Context, receiver: Object, x: Object): Number {
|
||||
const x32 = Convert<float32>(ToNumber_Inline(context, x));
|
||||
const x64 = Convert<float64>(x32);
|
||||
return Convert<Number>(x64);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.log
|
||||
extern macro Float64Log(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathLog(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Log(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.log1p
|
||||
extern macro Float64Log1p(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathLog1p(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Log1p(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.log10
|
||||
extern macro Float64Log10(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathLog10(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Log10(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.log2
|
||||
extern macro Float64Log2(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathLog2(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Log2(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.sin
|
||||
extern macro Float64Sin(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathSin(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Sin(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.sinh
|
||||
extern macro Float64Sinh(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathSinh(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Sinh(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.sqrt
|
||||
extern macro Float64Sqrt(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathSqrt(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Sqrt(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.tan
|
||||
extern macro Float64Tan(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathTan(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Tan(value));
|
||||
}
|
||||
|
||||
// ES6 #sec-math.tanh
|
||||
extern macro Float64Tanh(float64): float64;
|
||||
|
||||
transitioning javascript builtin
|
||||
MathTanh(context: Context, receiver: Object, x: Object): Number {
|
||||
const value = Convert<float64>(ToNumber_Inline(context, x));
|
||||
return Convert<Number>(Float64Tanh(value));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user