[JSC] Make FRound work with any type
https://bugs.webkit.org/show_bug.cgi?id=161129

Reviewed by Geoffrey Garen.

JSTests:

* stress/arith-fround-on-various-types.js: Added.

Source/JavaScriptCore:

Math.fround() does nothing with arguments past the first one
(https://tc39.github.io/ecma262/#sec-math.fround).
We can unify ArithFRound with the other single-input intrinsics.

Everything else is same old: if the input type is not a number,
be pessimistic about everything and do a C call.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileArithFRound):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileArithFRound):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@204947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/dfg/DFGOperations.cpp b/Source/JavaScriptCore/dfg/DFGOperations.cpp
index 7cf6870..ce20d28 100644
--- a/Source/JavaScriptCore/dfg/DFGOperations.cpp
+++ b/Source/JavaScriptCore/dfg/DFGOperations.cpp
@@ -334,6 +334,18 @@
     return cos(a);
 }
 
+double JIT_OPERATION operationArithFRound(ExecState* exec, EncodedJSValue encodedOp1)
+{
+    VM* vm = &exec->vm();
+    NativeCallFrameTracer tracer(vm, exec);
+
+    JSValue op1 = JSValue::decode(encodedOp1);
+    double a = op1.toNumber(exec);
+    if (UNLIKELY(vm->exception()))
+        return JSValue::encode(JSValue());
+    return static_cast<float>(a);
+}
+
 double JIT_OPERATION operationArithLog(ExecState* exec, EncodedJSValue encodedOp1)
 {
     VM* vm = &exec->vm();