Closed Bug 783708 Opened 12 years ago Closed 12 years ago

Add assertion for mismatched finalizeKinds

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: sfink, Unassigned)

Details

(Whiteboard: [js:t])

Over in bug 720949, I discovered that you can do

  obj = NewBuiltinClassInstance(protoClass);
  empty = EmptyShape::getInitialShape(anotherClass);
  obj->setLastPropertyInfallible(empty);

and screw things up. Specifically, protoClass has no finalizer, and so results in a background-finalizable object. Mutating the object via setLastPropertyInfallible switches it to anotherClass, which *does* have a finalizer, but it'll never get called because the finalization kind is an immutable property (it's derived from the storage location, so it really can't be changed.)

Should setLastPropertyInfallible assert if the finalization kind changes? Or is there a better place for it? Or am I misunderstanding something?
It would be a good assertion to add. However, I was under the impression that we never change the class of an object except for array slowification.
(In reply to Bill McCloskey (:billm) from comment #1)
> It would be a good assertion to add. However, I was under the impression
> that we never change the class of an object except for array slowification.

Could be true. The typed array object creation code was clearly cargo-culted from the array creation code, and brought over the class changing stuff for its normal object creation path. (I think the array code used to do this too, though the current version looks more sane.) I hope to remove that as part of getting bug 720949, but the finalizeKind-changing stuff still seems like a nasty footgun to leave lying around.
I briefly attempted this, but getting access to the necessary data at the point you'd want the assertion is hard.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
Whiteboard: [js:t]
You need to log in before you can comment on or make changes to this bug.