mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Start marking functions that can transitively trigger a GC (#33144)
* Mark JS reflector wrappers as CanGc. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Propagate CanGc from reflect_dom_object_with_proto. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Mark DOM constructors as GC operations. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
9a1051c917
commit
60ef6bc461
140 changed files with 1336 additions and 304 deletions
|
@ -2889,7 +2889,8 @@ class CGWrapMethod(CGAbstractMethod):
|
|||
args = [Argument('SafeJSContext', 'cx'),
|
||||
Argument('&GlobalScope', 'scope'),
|
||||
Argument('Option<HandleObject>', 'given_proto'),
|
||||
Argument(f"Box<{descriptor.concreteType}>", 'object')]
|
||||
Argument(f"Box<{descriptor.concreteType}>", 'object'),
|
||||
Argument('CanGc', '_can_gc')]
|
||||
retval = f'DomRoot<{descriptor.concreteType}>'
|
||||
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args,
|
||||
pub=True, unsafe=True)
|
||||
|
@ -3082,6 +3083,7 @@ impl DomObjectWrap for {name} {{
|
|||
&GlobalScope,
|
||||
Option<HandleObject>,
|
||||
Box<Self>,
|
||||
CanGc,
|
||||
) -> Root<Dom<Self>> = Wrap;
|
||||
}}
|
||||
"""
|
||||
|
@ -3105,6 +3107,7 @@ impl DomObjectIteratorWrap for {name} {{
|
|||
&GlobalScope,
|
||||
Option<HandleObject>,
|
||||
Box<IterableIterator<Self>>,
|
||||
CanGc,
|
||||
) -> Root<Dom<IterableIterator<Self>>> = Wrap;
|
||||
}}
|
||||
"""
|
||||
|
@ -6234,7 +6237,7 @@ if proto_result.is_err() {{
|
|||
"""
|
||||
name = self.constructor.identifier.name
|
||||
nativeName = MakeNativeName(self.descriptor.binaryNameFor(name))
|
||||
args = ["&global", "Some(desired_proto.handle())"]
|
||||
args = ["&global", "Some(desired_proto.handle())", "CanGc::note()"]
|
||||
constructorCall = CGMethodCall(args, nativeName, True,
|
||||
self.descriptor, self.constructor)
|
||||
return CGList([CGGeneric(preamble), constructorCall])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue