Skip to content

Commit 6411212

Browse files
MayaLekovaV8 LUCI CQ
authored andcommitted
[compiler] Fix mutable heap number object reference leak
Bug: chromium:1380063 Change-Id: Ide7622be38f575327693599bb4719f361105a0bd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3998653 Auto-Submit: Maya Lekova <[email protected]> Reviewed-by: Darius Mercadier <[email protected]> Commit-Queue: Darius Mercadier <[email protected]> Cr-Commit-Position: refs/heads/main@{#84039}
1 parent ef1ac47 commit 6411212

1 file changed

Lines changed: 25 additions & 26 deletions

File tree

src/compiler/effect-control-linearizer.cc

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5556,6 +5556,8 @@ Node* EffectControlLinearizer::LowerLoadFieldByIndex(Node* node) {
55565556

55575557
auto if_double = __ MakeDeferredLabel();
55585558
auto done = __ MakeLabel(MachineRepresentation::kTagged);
5559+
auto loaded_field = __ MakeLabel(MachineRepresentation::kTagged);
5560+
auto done_double = __ MakeLabel(MachineRepresentation::kFloat64);
55595561

55605562
// Check if field is a mutable double field.
55615563
__ GotoIfNot(__ IntPtrEqual(__ WordAnd(index, one), zero), &if_double);
@@ -5572,8 +5574,8 @@ Node* EffectControlLinearizer::LowerLoadFieldByIndex(Node* node) {
55725574
Node* offset =
55735575
__ IntAdd(__ WordShl(index, __ IntPtrConstant(kTaggedSizeLog2 - 1)),
55745576
__ IntPtrConstant(JSObject::kHeaderSize - kHeapObjectTag));
5575-
Node* result = __ Load(MachineType::AnyTagged(), object, offset);
5576-
__ Goto(&done, result);
5577+
Node* field = __ Load(MachineType::AnyTagged(), object, offset);
5578+
__ Goto(&loaded_field, field);
55775579
}
55785580

55795581
// The field is located in the properties backing store of {object}.
@@ -5587,18 +5589,15 @@ Node* EffectControlLinearizer::LowerLoadFieldByIndex(Node* node) {
55875589
__ IntPtrConstant(kTaggedSizeLog2 - 1)),
55885590
__ IntPtrConstant((FixedArray::kHeaderSize - kTaggedSize) -
55895591
kHeapObjectTag));
5590-
Node* result = __ Load(MachineType::AnyTagged(), properties, offset);
5591-
__ Goto(&done, result);
5592+
Node* field = __ Load(MachineType::AnyTagged(), properties, offset);
5593+
__ Goto(&loaded_field, field);
55925594
}
55935595
}
55945596

55955597
// The field is a Double field, either unboxed in the object on 64-bit
55965598
// architectures, or a mutable HeapNumber.
55975599
__ Bind(&if_double);
55985600
{
5599-
auto loaded_field = __ MakeLabel(MachineRepresentation::kTagged);
5600-
auto done_double = __ MakeLabel(MachineRepresentation::kFloat64);
5601-
56025601
index = __ WordSar(index, one);
56035602

56045603
// Check if field is in-object or out-of-object.
@@ -5626,27 +5625,27 @@ Node* EffectControlLinearizer::LowerLoadFieldByIndex(Node* node) {
56265625
Node* field = __ Load(MachineType::AnyTagged(), properties, offset);
56275626
__ Goto(&loaded_field, field);
56285627
}
5628+
}
56295629

5630-
__ Bind(&loaded_field);
5631-
{
5632-
Node* field = loaded_field.PhiAt(0);
5633-
// We may have transitioned in-place away from double, so check that
5634-
// this is a HeapNumber -- otherwise the load is fine and we don't need
5635-
// to copy anything anyway.
5636-
__ GotoIf(ObjectIsSmi(field), &done, field);
5637-
Node* field_map = __ LoadField(AccessBuilder::ForMap(), field);
5638-
__ GotoIfNot(__ TaggedEqual(field_map, __ HeapNumberMapConstant()), &done,
5639-
field);
5640-
5641-
Node* value = __ LoadField(AccessBuilder::ForHeapNumberValue(), field);
5642-
__ Goto(&done_double, value);
5643-
}
5630+
__ Bind(&loaded_field);
5631+
{
5632+
Node* field = loaded_field.PhiAt(0);
5633+
// We may have transitioned in-place away from double, so check that
5634+
// this is a HeapNumber -- otherwise the load is fine and we don't need
5635+
// to copy anything anyway.
5636+
__ GotoIf(ObjectIsSmi(field), &done, field);
5637+
Node* field_map = __ LoadField(AccessBuilder::ForMap(), field);
5638+
__ GotoIfNot(__ TaggedEqual(field_map, __ HeapNumberMapConstant()), &done,
5639+
field);
56445640

5645-
__ Bind(&done_double);
5646-
{
5647-
Node* result = AllocateHeapNumberWithValue(done_double.PhiAt(0));
5648-
__ Goto(&done, result);
5649-
}
5641+
Node* value = __ LoadField(AccessBuilder::ForHeapNumberValue(), field);
5642+
__ Goto(&done_double, value);
5643+
}
5644+
5645+
__ Bind(&done_double);
5646+
{
5647+
Node* result = AllocateHeapNumberWithValue(done_double.PhiAt(0));
5648+
__ Goto(&done, result);
56505649
}
56515650

56525651
__ Bind(&done);

0 commit comments

Comments
 (0)