Skip to content

Commit 03fef1f

Browse files
committed
Bug 1916388 - Always initialize all fixed slots if bailAfter testing function is used. r=jonco
Not adding the test case because it's a bit slow, hard to reduce, and likely brittle too. Differential Revision: https://phabricator.services.mozilla.com/D221130
1 parent 879897d commit 03fef1f

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

js/src/jit/CodeGenerator.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8428,8 +8428,8 @@ void CodeGenerator::visitNewObjectVMCall(LNewObject* lir) {
84288428
restoreLive(lir);
84298429
}
84308430

8431-
static bool ShouldInitFixedSlots(LNewPlainObject* lir, const Shape* shape,
8432-
uint32_t nfixed) {
8431+
static bool ShouldInitFixedSlots(MIRGenerator* gen, LNewPlainObject* lir,
8432+
const Shape* shape, uint32_t nfixed) {
84338433
// Look for StoreFixedSlot instructions following an object allocation
84348434
// that write to this object before a GC is triggered or this object is
84358435
// passed to a VM call. If all fixed slots will be initialized, the
@@ -8439,6 +8439,14 @@ static bool ShouldInitFixedSlots(LNewPlainObject* lir, const Shape* shape,
84398439
return false;
84408440
}
84418441

8442+
#ifdef DEBUG
8443+
// The bailAfter testing function can trigger a bailout between allocating the
8444+
// object and initializing the slots.
8445+
if (gen->options.ionBailAfterEnabled()) {
8446+
return true;
8447+
}
8448+
#endif
8449+
84428450
// Keep track of the fixed slots that are initialized. initializedSlots is
84438451
// a bit mask with a bit for each slot.
84448452
MOZ_ASSERT(nfixed <= NativeObject::MAX_FIXED_SLOTS);
@@ -8556,7 +8564,8 @@ void CodeGenerator::visitNewPlainObject(LNewPlainObject* lir) {
85568564
Imm32(int32_t(initialHeap))),
85578565
StoreRegisterTo(objReg));
85588566

8559-
bool initContents = ShouldInitFixedSlots(lir, shape, mir->numFixedSlots());
8567+
bool initContents =
8568+
ShouldInitFixedSlots(gen, lir, shape, mir->numFixedSlots());
85608569

85618570
masm.movePtr(ImmGCPtr(shape), shapeReg);
85628571
masm.createPlainGCObject(

0 commit comments

Comments
 (0)