Ignore:
Timestamp:
Sep 19, 2016, 5:48:39 PM (9 years ago)
Author:
[email protected]
Message:

[JSC] Make the rounding-related nodes support any type
https://bugs.webkit.org/show_bug.cgi?id=161895

Patch by Benjamin Poulain <[email protected]> on 2016-09-19
Reviewed by Geoffrey Garen.

JSTests:

  • stress/arith-ceil-on-various-types.js: Added.
  • stress/arith-floor-on-various-types.js: Added.
  • stress/arith-round-on-various-types.js: Added.
  • stress/arith-trunc-on-various-types.js: Added.

Source/JavaScriptCore:

This patch changes ArithRound, ArithFloor, ArithCeil and ArithTrunc
to support polymorphic input without exiting on entry.

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
The 4 functions ignore any input past the first argument. It is okay
to use the nodes with the first argument and let the Phantoms keep
the remaining arguments live.

  • dfg/DFGClobberize.h:

(JSC::DFG::clobberize):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):
Our fixup had the issue we have seen on previous nodes: unaryArithShouldSpeculateInt32()
prevents us from picking a good type if we do not see any double.

  • dfg/DFGNodeType.h:
  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGPredictionPropagationPhase.cpp:

Prediction propagation of those nodes are fully determined
from their flags and results's prediction. They are moved
to the invariant processing.

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileArithRounding):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileArithRound):
(JSC::FTL::DFG::LowerDFGToB3::compileArithFloor):
(JSC::FTL::DFG::LowerDFGToB3::compileArithCeil):
(JSC::FTL::DFG::LowerDFGToB3::compileArithTrunc):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r206065 r206134  
    5353#include "JSWASMModule.h"
    5454#include "LLIntData.h"
     55#include "ObjectConstructor.h"
    5556#include "ParserError.h"
    5657#include "ProfilerDatabase.h"
     
    6970#include <string.h>
    7071#include <thread>
     72#include <type_traits>
    7173#include <wtf/CurrentTime.h>
    7274#include <wtf/MainThread.h>
     
    613615static EncodedJSValue JSC_HOST_CALL functionOptimizeNextInvocation(ExecState*);
    614616static EncodedJSValue JSC_HOST_CALL functionNumberOfDFGCompiles(ExecState*);
     617static EncodedJSValue JSC_HOST_CALL functionJSCOptions(ExecState*);
    615618static EncodedJSValue JSC_HOST_CALL functionReoptimizationRetryCount(ExecState*);
    616619static EncodedJSValue JSC_HOST_CALL functionTransferArrayBuffer(ExecState*);
     
    818821        addFunction(vm, "noOSRExitFuzzing", functionNoOSRExitFuzzing, 1);
    819822        addFunction(vm, "numberOfDFGCompiles", functionNumberOfDFGCompiles, 1);
     823        addFunction(vm, "jscOptions", functionJSCOptions, 0);
    820824        addFunction(vm, "optimizeNextInvocation", functionOptimizeNextInvocation, 1);
    821825        addFunction(vm, "reoptimizationRetryCount", functionReoptimizationRetryCount, 1);
     
    17161720}
    17171721
     1722template<typename ValueType>
     1723typename std::enable_if<!std::is_fundamental<ValueType>::value>::type addOption(VM&, JSObject*, Identifier, ValueType) { }
     1724
     1725template<typename ValueType>
     1726typename std::enable_if<std::is_fundamental<ValueType>::value>::type addOption(VM& vm, JSObject* optionsObject, Identifier identifier, ValueType value)
     1727{
     1728    optionsObject->putDirect(vm, identifier, JSValue(value));
     1729}
     1730
     1731EncodedJSValue JSC_HOST_CALL functionJSCOptions(ExecState* exec)
     1732{
     1733    JSObject* optionsObject = constructEmptyObject(exec);
     1734#define FOR_EACH_OPTION(type_, name_, defaultValue_, availability_, description_) \
     1735    addOption(exec->vm(), optionsObject, Identifier::fromString(exec, #name_), Options::name_());
     1736    JSC_OPTIONS(FOR_EACH_OPTION)
     1737#undef FOR_EACH_OPTION
     1738    return JSValue::encode(optionsObject);
     1739}
     1740
    17181741EncodedJSValue JSC_HOST_CALL functionReoptimizationRetryCount(ExecState* exec)
    17191742{
Note: See TracChangeset for help on using the changeset viewer.