@@ -4446,15 +4446,37 @@ LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone,
44464446 bool opt) const {
44474447 const intptr_t kNumInputs = 1 ;
44484448 const intptr_t kNumTemps = ValueFitsSmi () ? 0 : 1 ;
4449- LocationSummary* summary = new (zone)
4450- LocationSummary (zone, kNumInputs , kNumTemps ,
4451- ValueFitsSmi () ? LocationSummary::kNoCall
4452- : LocationSummary::kCallOnSlowPath );
4449+ // Shared slow path is used in BoxInt64Instr::EmitNativeCode in
4450+ // FLAG_use_bare_instructions mode and only after VM isolate stubs where
4451+ // replaced with isolate-specific stubs.
4452+ auto object_store = Isolate::Current ()->object_store ();
4453+ const bool stubs_in_vm_isolate =
4454+ object_store->allocate_mint_with_fpu_regs_stub ()
4455+ ->ptr ()
4456+ ->InVMIsolateHeap () ||
4457+ object_store->allocate_mint_without_fpu_regs_stub ()
4458+ ->ptr ()
4459+ ->InVMIsolateHeap ();
4460+ const bool shared_slow_path_call = SlowPathSharingSupported (opt) &&
4461+ FLAG_use_bare_instructions &&
4462+ !stubs_in_vm_isolate;
4463+ LocationSummary* summary = new (zone) LocationSummary (
4464+ zone, kNumInputs , kNumTemps ,
4465+ ValueFitsSmi ()
4466+ ? LocationSummary::kNoCall
4467+ : ((shared_slow_path_call ? LocationSummary::kCallOnSharedSlowPath
4468+ : LocationSummary::kCallOnSlowPath )));
44534469 summary->set_in (0 , Location::RequiresRegister ());
4454- if (!ValueFitsSmi ()) {
4470+ if (ValueFitsSmi ()) {
4471+ summary->set_out (0 , Location::RequiresRegister ());
4472+ } else if (shared_slow_path_call) {
4473+ summary->set_out (0 ,
4474+ Location::RegisterLocation (AllocateMintABI::kResultReg ));
4475+ summary->set_temp (0 , Location::RegisterLocation (AllocateMintABI::kTempReg ));
4476+ } else {
4477+ summary->set_out (0 , Location::RequiresRegister ());
44554478 summary->set_temp (0 , Location::RequiresRegister ());
44564479 }
4457- summary->set_out (0 , Location::RequiresRegister ());
44584480 return summary;
44594481}
44604482
@@ -4463,17 +4485,39 @@ void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
44634485 const Register value = locs ()->in (0 ).reg ();
44644486 __ MoveRegister (out, value);
44654487 __ SmiTag (out);
4466- if (!ValueFitsSmi ()) {
4467- const Register temp = locs ()->temp (0 ).reg ();
4468- compiler::Label done;
4469- // If the value doesn't fit in a smi, the tagging changes the sign,
4470- // which causes the overflow flag to be set.
4471- __ j (NO_OVERFLOW, &done);
4488+ if (ValueFitsSmi ()) {
4489+ return ;
4490+ }
4491+ // If the value doesn't fit in a smi, the tagging changes the sign,
4492+ // which causes the overflow flag to be set.
4493+ compiler::Label done;
4494+ __ j (NO_OVERFLOW, &done);
4495+
4496+ const Register temp = locs ()->temp (0 ).reg ();
4497+ if (compiler->intrinsic_mode ()) {
4498+ __ TryAllocate (compiler->mint_class (),
4499+ compiler->intrinsic_slow_path_label (),
4500+ /* near_jump=*/ true , out, temp);
4501+ } else if (locs ()->call_on_shared_slow_path ()) {
4502+ auto object_store = compiler->isolate ()->object_store ();
4503+ const bool live_fpu_regs = locs ()->live_registers ()->FpuRegisterCount () > 0 ;
4504+ const auto & stub = Code::ZoneHandle (
4505+ compiler->zone (),
4506+ live_fpu_regs ? object_store->allocate_mint_with_fpu_regs_stub ()
4507+ : object_store->allocate_mint_without_fpu_regs_stub ());
4508+
4509+ ASSERT (!locs ()->live_registers ()->ContainsRegister (
4510+ AllocateMintABI::kResultReg ));
4511+ auto extended_env = compiler->SlowPathEnvironmentFor (this , 0 );
4512+ compiler->GenerateStubCall (token_pos (), stub, PcDescriptorsLayout::kOther ,
4513+ locs (), DeoptId::kNone , extended_env);
4514+ } else {
44724515 BoxAllocationSlowPath::Allocate (compiler, this , compiler->mint_class (), out,
44734516 temp);
4474- __ movq (compiler::FieldAddress (out, Mint::value_offset ()), value);
4475- __ Bind (&done);
44764517 }
4518+
4519+ __ movq (compiler::FieldAddress (out, Mint::value_offset ()), value);
4520+ __ Bind (&done);
44774521}
44784522
44794523LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary (Zone* zone,
0 commit comments