Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index 43ab23a24f9ee7ccd6a4910319ddee8f3d2fc078..e5af799cd973ea5b4971ff3572e653cdba0cc4fa 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -2239,6 +2239,16 @@ BUILTIN(JsonStringify) { |
// ----------------------------------------------------------------------------- |
// ES6 section 20.2.2 Function Properties of the Math Object |
+// ES6 section - 20.2.2.1 Math.abs ( x ) |
+void Builtins::Generate_MathAbs(CodeStubAssembler* assembler) { |
+ using compiler::Node; |
+ Node* x = assembler->Parameter(1); |
+ Node* context = assembler->Parameter(4); |
+ Node* x_value = assembler->TruncateTaggedToFloat64(context, x); |
+ Node* value = assembler->Float64Abs(x_value); |
+ Node* result = assembler->ChangeFloat64ToTagged(value); |
+ assembler->Return(result); |
+} |
// ES6 section 20.2.2.2 Math.acos ( x ) |
BUILTIN(MathAcos) { |
@@ -2249,7 +2259,6 @@ BUILTIN(MathAcos) { |
return *isolate->factory()->NewHeapNumber(std::acos(x->Number())); |
} |
- |
// ES6 section 20.2.2.4 Math.asin ( x ) |
BUILTIN(MathAsin) { |
HandleScope scope(isolate); |