mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 18:47:55 +00:00
[vm] Remove obsolete --[no-]unbox_doubles flag
All our target platforms support unboxed doubles and this obsolete option is no longer used. TEST=ci Change-Id: I1d9214b49e875bc52e4f25650dacf8446a2e40a4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371980 Reviewed-by: Siva Annamalai <asiva@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
6226568fa5
commit
4d3689138e
|
@ -651,10 +651,6 @@ bool AotCallSpecializer::TryOptimizeDoubleOperation(TemplateDartCall<0>* instr,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!FlowGraphCompiler::SupportsUnboxedDoubles()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Definition* replacement = nullptr;
|
||||
|
||||
if (instr->ArgumentCount() == 2) {
|
||||
|
|
|
@ -916,8 +916,7 @@ void ConstantPropagator::VisitInstanceOf(InstanceOfInstr* instr) {
|
|||
Representation rep = def->representation();
|
||||
if ((checked_type.IsFloat32x4Type() && (rep == kUnboxedFloat32x4)) ||
|
||||
(checked_type.IsInt32x4Type() && (rep == kUnboxedInt32x4)) ||
|
||||
(checked_type.IsDoubleType() && (rep == kUnboxedDouble) &&
|
||||
FlowGraphCompiler::SupportsUnboxedDoubles()) ||
|
||||
(checked_type.IsDoubleType() && (rep == kUnboxedDouble)) ||
|
||||
(checked_type.IsIntType() && (rep == kUnboxedInt64))) {
|
||||
// Ensure that compile time type matches representation.
|
||||
ASSERT(((rep == kUnboxedFloat32x4) && (value_cid == kFloat32x4Cid)) ||
|
||||
|
|
|
@ -1930,10 +1930,6 @@ static bool ShouldInlineSimd() {
|
|||
return FlowGraphCompiler::SupportsUnboxedSimd128();
|
||||
}
|
||||
|
||||
static bool CanUnboxDouble() {
|
||||
return FlowGraphCompiler::SupportsUnboxedDoubles();
|
||||
}
|
||||
|
||||
static bool CanConvertInt64ToDouble() {
|
||||
return FlowGraphCompiler::CanConvertInt64ToDouble();
|
||||
}
|
||||
|
@ -1975,7 +1971,6 @@ void FlowGraph::InsertConversion(Representation from,
|
|||
const intptr_t deopt_id = (deopt_target != nullptr)
|
||||
? deopt_target->DeoptimizationTarget()
|
||||
: DeoptId::kNone;
|
||||
ASSERT(CanUnboxDouble());
|
||||
converted = new Int64ToDoubleInstr(use->CopyWithType(), deopt_id);
|
||||
} else if ((from == kTagged) && Boxing::Supports(to)) {
|
||||
const intptr_t deopt_id = (deopt_target != nullptr)
|
||||
|
@ -2129,7 +2124,6 @@ class PhiUnboxingHeuristic : public ValueObject {
|
|||
auto new_representation = phi->representation();
|
||||
switch (phi->Type()->ToCid()) {
|
||||
case kDoubleCid:
|
||||
if (CanUnboxDouble()) {
|
||||
new_representation = DetermineIfAnyIncomingUnboxedFloats(phi)
|
||||
? kUnboxedFloat
|
||||
: kUnboxedDouble;
|
||||
|
@ -2140,7 +2134,6 @@ class PhiUnboxingHeuristic : public ValueObject {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case kFloat32x4Cid:
|
||||
if (ShouldInlineSimd()) {
|
||||
|
|
|
@ -392,7 +392,6 @@ class FlowGraphCompiler : public ValueObject {
|
|||
|
||||
~FlowGraphCompiler();
|
||||
|
||||
static bool SupportsUnboxedDoubles();
|
||||
static bool SupportsUnboxedSimd128();
|
||||
static bool CanConvertInt64ToDouble();
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
namespace dart {
|
||||
|
||||
DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization.");
|
||||
DEFINE_FLAG(bool, unbox_doubles, true, "Optimize double arithmetic.");
|
||||
DECLARE_FLAG(bool, enable_simd_inline);
|
||||
|
||||
void FlowGraphCompiler::ArchSpecificInitialization() {
|
||||
|
@ -66,10 +65,6 @@ FlowGraphCompiler::~FlowGraphCompiler() {
|
|||
}
|
||||
}
|
||||
|
||||
bool FlowGraphCompiler::SupportsUnboxedDoubles() {
|
||||
return FLAG_unbox_doubles;
|
||||
}
|
||||
|
||||
bool FlowGraphCompiler::SupportsUnboxedSimd128() {
|
||||
return TargetCPUFeatures::neon_supported() && FLAG_enable_simd_inline;
|
||||
}
|
||||
|
|
|
@ -62,10 +62,6 @@ FlowGraphCompiler::~FlowGraphCompiler() {
|
|||
}
|
||||
}
|
||||
|
||||
bool FlowGraphCompiler::SupportsUnboxedDoubles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FlowGraphCompiler::SupportsUnboxedSimd128() {
|
||||
return FLAG_enable_simd_inline;
|
||||
}
|
||||
|
|
|
@ -41,10 +41,6 @@ FlowGraphCompiler::~FlowGraphCompiler() {
|
|||
}
|
||||
}
|
||||
|
||||
bool FlowGraphCompiler::SupportsUnboxedDoubles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FlowGraphCompiler::SupportsUnboxedSimd128() {
|
||||
return FLAG_enable_simd_inline;
|
||||
}
|
||||
|
|
|
@ -43,10 +43,6 @@ FlowGraphCompiler::~FlowGraphCompiler() {
|
|||
}
|
||||
}
|
||||
|
||||
bool FlowGraphCompiler::SupportsUnboxedDoubles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FlowGraphCompiler::SupportsUnboxedSimd128() {
|
||||
// TODO(riscv): Dynamically test for the vector extension and otherwise
|
||||
// allocate SIMD values to register-pairs or quads?
|
||||
|
|
|
@ -63,10 +63,6 @@ FlowGraphCompiler::~FlowGraphCompiler() {
|
|||
}
|
||||
}
|
||||
|
||||
bool FlowGraphCompiler::SupportsUnboxedDoubles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FlowGraphCompiler::SupportsUnboxedSimd128() {
|
||||
return FLAG_enable_simd_inline;
|
||||
}
|
||||
|
|
|
@ -296,10 +296,6 @@ ISOLATE_UNIT_TEST_CASE(FlowGraph_LargeFrame_Float64x2) {
|
|||
}
|
||||
|
||||
ISOLATE_UNIT_TEST_CASE(FlowGraph_PhiUnboxingHeuristic_Double) {
|
||||
if (!FlowGraphCompiler::SupportsUnboxedDoubles()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const char* kScript = R"(
|
||||
double foo(double sum, int n) {
|
||||
if (sum == null) return 0.0;
|
||||
|
|
|
@ -4058,7 +4058,6 @@ UnboxInstr* UnboxInstr::Create(Representation to,
|
|||
case kUnboxedFloat32x4:
|
||||
case kUnboxedFloat64x2:
|
||||
case kUnboxedInt32x4:
|
||||
ASSERT(FlowGraphCompiler::SupportsUnboxedDoubles());
|
||||
return new UnboxInstr(to, value, deopt_id, speculative_mode);
|
||||
|
||||
default:
|
||||
|
|
|
@ -30,10 +30,6 @@ static bool ShouldInlineSimd() {
|
|||
return FlowGraphCompiler::SupportsUnboxedSimd128();
|
||||
}
|
||||
|
||||
static bool CanUnboxDouble() {
|
||||
return FlowGraphCompiler::SupportsUnboxedDoubles();
|
||||
}
|
||||
|
||||
static bool CanConvertInt64ToDouble() {
|
||||
return FlowGraphCompiler::CanConvertInt64ToDouble();
|
||||
}
|
||||
|
@ -43,11 +39,6 @@ static bool IsNumberCid(intptr_t cid) {
|
|||
}
|
||||
|
||||
static bool ShouldSpecializeForDouble(const BinaryFeedback& binary_feedback) {
|
||||
// Don't specialize for double if we can't unbox them.
|
||||
if (!CanUnboxDouble()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Unboxed double operation can't handle case of two smis.
|
||||
if (binary_feedback.IncludesOperands(kSmiCid)) {
|
||||
return false;
|
||||
|
@ -394,7 +385,7 @@ bool CallSpecializer::TryReplaceWithEqualityOp(InstanceCallInstr* call,
|
|||
cid = kSmiCid;
|
||||
} else if (binary_feedback.OperandsAreSmiOrMint()) {
|
||||
cid = kMintCid;
|
||||
} else if (binary_feedback.OperandsAreSmiOrDouble() && CanUnboxDouble()) {
|
||||
} else if (binary_feedback.OperandsAreSmiOrDouble()) {
|
||||
// Use double comparison.
|
||||
if (SmiFitsInDouble()) {
|
||||
cid = kDoubleCid;
|
||||
|
@ -469,7 +460,7 @@ bool CallSpecializer::TryReplaceWithRelationalOp(InstanceCallInstr* call,
|
|||
cid = kSmiCid;
|
||||
} else if (binary_feedback.OperandsAreSmiOrMint()) {
|
||||
cid = kMintCid;
|
||||
} else if (binary_feedback.OperandsAreSmiOrDouble() && CanUnboxDouble()) {
|
||||
} else if (binary_feedback.OperandsAreSmiOrDouble()) {
|
||||
// Use double comparison.
|
||||
if (SmiFitsInDouble()) {
|
||||
cid = kDoubleCid;
|
||||
|
@ -605,9 +596,6 @@ bool CallSpecializer::TryReplaceWithBinaryOp(InstanceCallInstr* call,
|
|||
Definition* left = call->ArgumentAt(0);
|
||||
Definition* right = call->ArgumentAt(1);
|
||||
if (operands_type == kDoubleCid) {
|
||||
if (!CanUnboxDouble()) {
|
||||
return false;
|
||||
}
|
||||
// Check that either left or right are not a smi. Result of a
|
||||
// binary operation with two smis is a smi not a double, except '/' which
|
||||
// returns a double for two smis.
|
||||
|
@ -704,7 +692,7 @@ bool CallSpecializer::TryReplaceWithUnaryOp(InstanceCallInstr* call,
|
|||
unary_op = new (Z)
|
||||
UnaryInt64OpInstr(op_kind, new (Z) Value(input), call->deopt_id());
|
||||
} else if (call->Targets().ReceiverIs(kDoubleCid) &&
|
||||
(op_kind == Token::kNEGATE) && CanUnboxDouble()) {
|
||||
(op_kind == Token::kNEGATE)) {
|
||||
AddReceiverCheck(call);
|
||||
unary_op = new (Z) UnaryDoubleOpInstr(Token::kNEGATE, new (Z) Value(input),
|
||||
call->deopt_id());
|
||||
|
@ -976,8 +964,7 @@ bool CallSpecializer::TryInlineInstanceMethod(InstanceCallInstr* call) {
|
|||
intptr_t receiver_cid = targets.MonomorphicReceiverCid();
|
||||
MethodRecognizer::Kind recognized_kind = target.recognized_kind();
|
||||
|
||||
if (CanUnboxDouble() &&
|
||||
(recognized_kind == MethodRecognizer::kIntegerToDouble)) {
|
||||
if (recognized_kind == MethodRecognizer::kIntegerToDouble) {
|
||||
if (receiver_cid == kSmiCid) {
|
||||
AddReceiverCheck(call);
|
||||
ReplaceCall(call,
|
||||
|
@ -994,9 +981,6 @@ bool CallSpecializer::TryInlineInstanceMethod(InstanceCallInstr* call) {
|
|||
}
|
||||
|
||||
if (receiver_cid == kDoubleCid) {
|
||||
if (!CanUnboxDouble()) {
|
||||
return false;
|
||||
}
|
||||
switch (recognized_kind) {
|
||||
case MethodRecognizer::kDoubleToInteger: {
|
||||
AddReceiverCheck(call);
|
||||
|
@ -1292,8 +1276,7 @@ void CallSpecializer::VisitStaticCall(StaticCallInstr* call) {
|
|||
case MethodRecognizer::kMathMax: {
|
||||
// We can handle only monomorphic min/max call sites with both arguments
|
||||
// being either doubles or smis.
|
||||
if (CanUnboxDouble() && targets.IsMonomorphic() &&
|
||||
(call->FirstArgIndex() == 0)) {
|
||||
if (targets.IsMonomorphic() && (call->FirstArgIndex() == 0)) {
|
||||
intptr_t result_cid = kIllegalCid;
|
||||
if (binary_feedback.IncludesOperands(kDoubleCid)) {
|
||||
result_cid = kDoubleCid;
|
||||
|
@ -1319,7 +1302,6 @@ void CallSpecializer::VisitStaticCall(StaticCallInstr* call) {
|
|||
case MethodRecognizer::kDoubleFromInteger: {
|
||||
if (call->HasICData() && targets.IsMonomorphic() &&
|
||||
(call->FirstArgIndex() == 0)) {
|
||||
if (CanUnboxDouble()) {
|
||||
if (binary_feedback.ArgumentIs(kSmiCid)) {
|
||||
Definition* arg = call->ArgumentAt(1);
|
||||
AddCheckSmi(arg, call->deopt_id(), call->env(), call);
|
||||
|
@ -1334,7 +1316,6 @@ void CallSpecializer::VisitStaticCall(StaticCallInstr* call) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1521,15 +1502,10 @@ void TypedDataSpecializer::TryInlineCall(TemplateDartCall<0>* call) {
|
|||
|
||||
auto const rep =
|
||||
RepresentationUtils::RepresentationOfArrayElement(variant.array_cid);
|
||||
const bool is_float_access = rep == kUnboxedFloat || rep == kUnboxedDouble;
|
||||
const bool is_simd_access = rep == kUnboxedInt32x4 ||
|
||||
rep == kUnboxedFloat32x4 ||
|
||||
rep == kUnboxedFloat64x2;
|
||||
|
||||
if (is_float_access && !FlowGraphCompiler::SupportsUnboxedDoubles()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_simd_access && !FlowGraphCompiler::SupportsUnboxedSimd128()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1984,9 +1960,6 @@ static bool InlineDoubleOp(FlowGraph* flow_graph,
|
|||
FunctionEntryInstr** entry,
|
||||
Instruction** last,
|
||||
Definition** result) {
|
||||
if (!CanUnboxDouble()) {
|
||||
return false;
|
||||
}
|
||||
Definition* left = receiver;
|
||||
Definition* right = call->ArgumentAt(1);
|
||||
|
||||
|
@ -2013,10 +1986,6 @@ static bool InlineDoubleTestOp(FlowGraph* flow_graph,
|
|||
FunctionEntryInstr** entry,
|
||||
Instruction** last,
|
||||
Definition** result) {
|
||||
if (!CanUnboxDouble()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*entry =
|
||||
new (Z) FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
|
||||
call->GetBlock()->try_index(), DeoptId::kNone);
|
||||
|
@ -3183,9 +3152,6 @@ bool CallSpecializer::TryInlineRecognizedMethod(
|
|||
call, receiver, graph_entry, entry, last, result);
|
||||
case MethodRecognizer::kFloat32ArrayGetIndexed:
|
||||
case MethodRecognizer::kFloat64ArrayGetIndexed:
|
||||
if (!CanUnboxDouble()) {
|
||||
return false;
|
||||
}
|
||||
return InlineGetIndexed(flow_graph, can_speculate, is_dynamic_call, kind,
|
||||
call, receiver, graph_entry, entry, last, result);
|
||||
case MethodRecognizer::kFloat32x4ArrayGetIndexed:
|
||||
|
@ -3241,9 +3207,6 @@ bool CallSpecializer::TryInlineRecognizedMethod(
|
|||
|
||||
case MethodRecognizer::kFloat32ArraySetIndexed:
|
||||
case MethodRecognizer::kFloat64ArraySetIndexed: {
|
||||
if (!CanUnboxDouble()) {
|
||||
return false;
|
||||
}
|
||||
return InlineSetIndexed(flow_graph, kind, target, call, receiver, source,
|
||||
exactness, graph_entry, entry, last, result);
|
||||
}
|
||||
|
|
|
@ -869,9 +869,6 @@ Fragment FlowGraphBuilder::NativeFunctionBody(const Function& function,
|
|||
|
||||
static bool CanUnboxElements(classid_t cid) {
|
||||
switch (RepresentationUtils::RepresentationOfArrayElement(cid)) {
|
||||
case kUnboxedFloat:
|
||||
case kUnboxedDouble:
|
||||
return FlowGraphCompiler::SupportsUnboxedDoubles();
|
||||
case kUnboxedInt32x4:
|
||||
case kUnboxedFloat32x4:
|
||||
case kUnboxedFloat64x2:
|
||||
|
@ -1142,10 +1139,9 @@ bool FlowGraphBuilder::IsRecognizedMethodForFlowGraph(
|
|||
case MethodRecognizer::kMathExp:
|
||||
case MethodRecognizer::kMathLog:
|
||||
case MethodRecognizer::kMathSqrt:
|
||||
return FlowGraphCompiler::SupportsUnboxedDoubles();
|
||||
return true;
|
||||
case MethodRecognizer::kDoubleCeilToInt:
|
||||
case MethodRecognizer::kDoubleFloorToInt:
|
||||
if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false;
|
||||
#if defined(TARGET_ARCH_X64)
|
||||
return CompilerState::Current().is_aot() || FLAG_target_unknown_cpu;
|
||||
#elif defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_RISCV32) || \
|
||||
|
|
|
@ -3851,9 +3851,7 @@ static void SetupUnboxingInfoOfParameter(const Function& function,
|
|||
function.set_unboxed_integer_parameter_at(param_pos);
|
||||
break;
|
||||
case UnboxingInfoMetadata::kDouble:
|
||||
if (FlowGraphCompiler::SupportsUnboxedDoubles()) {
|
||||
function.set_unboxed_double_parameter_at(param_pos);
|
||||
}
|
||||
break;
|
||||
case UnboxingInfoMetadata::kRecord:
|
||||
UNREACHABLE();
|
||||
|
@ -3875,9 +3873,7 @@ static void SetupUnboxingInfoOfReturnValue(
|
|||
function.set_unboxed_integer_return();
|
||||
break;
|
||||
case UnboxingInfoMetadata::kDouble:
|
||||
if (FlowGraphCompiler::SupportsUnboxedDoubles()) {
|
||||
function.set_unboxed_double_return();
|
||||
}
|
||||
break;
|
||||
case UnboxingInfoMetadata::kRecord:
|
||||
function.set_unboxed_record_return();
|
||||
|
|
|
@ -302,9 +302,6 @@ DEFINE_ARRAY_SETTER_INTRINSIC(Uint64Array)
|
|||
#define DEFINE_FLOAT_ARRAY_SETTER_INTRINSIC(enum_name) \
|
||||
bool GraphIntrinsifier::Build_##enum_name##SetIndexed( \
|
||||
FlowGraph* flow_graph) { \
|
||||
if (!FlowGraphCompiler::SupportsUnboxedDoubles()) { \
|
||||
return false; \
|
||||
} \
|
||||
return IntrinsifyArraySetIndexed( \
|
||||
flow_graph, MethodRecognizer::MethodKindToReceiverCid( \
|
||||
MethodRecognizer::k##enum_name##SetIndexed)); \
|
||||
|
@ -401,8 +398,7 @@ bool GraphIntrinsifier::Build_Float64x2Add(FlowGraph* flow_graph) {
|
|||
|
||||
static bool BuildFloat32x4Get(FlowGraph* flow_graph,
|
||||
MethodRecognizer::Kind kind) {
|
||||
if (!FlowGraphCompiler::SupportsUnboxedDoubles() ||
|
||||
!FlowGraphCompiler::SupportsUnboxedSimd128()) {
|
||||
if (!FlowGraphCompiler::SupportsUnboxedSimd128()) {
|
||||
return false;
|
||||
}
|
||||
GraphEntryInstr* graph_entry = flow_graph->graph_entry();
|
||||
|
@ -705,9 +701,6 @@ static Definition* ConvertOrUnboxDoubleParameter(BlockBuilder* builder,
|
|||
}
|
||||
|
||||
bool GraphIntrinsifier::Build_DoubleFlipSignBit(FlowGraph* flow_graph) {
|
||||
if (!FlowGraphCompiler::SupportsUnboxedDoubles()) {
|
||||
return false;
|
||||
}
|
||||
GraphEntryInstr* graph_entry = flow_graph->graph_entry();
|
||||
auto normal_entry = graph_entry->normal_entry();
|
||||
BlockBuilder builder(flow_graph, normal_entry, /*with_frame=*/false);
|
||||
|
|
|
@ -1089,9 +1089,7 @@ void UnboxFieldIfSupported(const dart::Field& field,
|
|||
|
||||
classid_t cid = kIllegalCid;
|
||||
if (type.IsDoubleType()) {
|
||||
if (FlowGraphCompiler::SupportsUnboxedDoubles()) {
|
||||
cid = kDoubleCid;
|
||||
}
|
||||
} else if (type.IsFloat32x4Type()) {
|
||||
if (FlowGraphCompiler::SupportsUnboxedSimd128()) {
|
||||
cid = kFloat32x4Cid;
|
||||
|
|
|
@ -83,7 +83,6 @@ class DeoptContext : public MallocAllocated {
|
|||
}
|
||||
|
||||
float FpuRegisterValueAsFloat(FpuRegister reg) const {
|
||||
ASSERT(FlowGraphCompiler::SupportsUnboxedDoubles());
|
||||
ASSERT(fpu_registers_ != NULL);
|
||||
ASSERT(reg >= 0);
|
||||
ASSERT(reg < kNumberOfFpuRegisters);
|
||||
|
@ -91,7 +90,6 @@ class DeoptContext : public MallocAllocated {
|
|||
}
|
||||
|
||||
double FpuRegisterValueAsDouble(FpuRegister reg) const {
|
||||
ASSERT(FlowGraphCompiler::SupportsUnboxedDoubles());
|
||||
ASSERT(fpu_registers_ != nullptr);
|
||||
ASSERT(reg >= 0);
|
||||
ASSERT(reg < kNumberOfFpuRegisters);
|
||||
|
|
|
@ -764,8 +764,7 @@ void KernelLoader::ReadInferredType(const Field& field,
|
|||
if (FLAG_precompiled_mode) {
|
||||
field.set_is_unboxed(!field.is_late() && !field.is_static() &&
|
||||
!field.is_nullable() &&
|
||||
((field.guarded_cid() == kDoubleCid &&
|
||||
FlowGraphCompiler::SupportsUnboxedDoubles()) ||
|
||||
((field.guarded_cid() == kDoubleCid) ||
|
||||
(field.guarded_cid() == kFloat32x4Cid &&
|
||||
FlowGraphCompiler::SupportsUnboxedSimd128()) ||
|
||||
(field.guarded_cid() == kFloat64x2Cid &&
|
||||
|
|
Loading…
Reference in a new issue