@@ -4446,15 +4446,37 @@ LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone,
4446
4446
bool opt) const {
4447
4447
const intptr_t kNumInputs = 1 ;
4448
4448
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 )));
4453
4469
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 ());
4455
4478
summary->set_temp (0 , Location::RequiresRegister ());
4456
4479
}
4457
- summary->set_out (0 , Location::RequiresRegister ());
4458
4480
return summary;
4459
4481
}
4460
4482
@@ -4463,17 +4485,39 @@ void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4463
4485
const Register value = locs ()->in (0 ).reg ();
4464
4486
__ MoveRegister (out, value);
4465
4487
__ 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 {
4472
4515
BoxAllocationSlowPath::Allocate (compiler, this , compiler->mint_class (), out,
4473
4516
temp);
4474
- __ movq (compiler::FieldAddress (out, Mint::value_offset ()), value);
4475
- __ Bind (&done);
4476
4517
}
4518
+
4519
+ __ movq (compiler::FieldAddress (out, Mint::value_offset ()), value);
4520
+ __ Bind (&done);
4477
4521
}
4478
4522
4479
4523
LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary (Zone* zone,
0 commit comments