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

Unified Diff: src/builtins.cc

Issue 2115493002: [builtins] Migrate Math.abs() to TurboFan builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comment back in Created 4 years, 6 months 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/builtins.h ('k') | src/compiler/code-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/builtins.h ('k') | src/compiler/code-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698