Skip to content

Commit aa76705

Browse files
LiedtkeV8-internal LUCI CQ
authored andcommitted
[environment] Set: Add prototype and missing instance methods
Bug: 487347678 Change-Id: I08a1e7346eb50d85832e4d4df798ba5b52348382 Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/9052182 Commit-Queue: Danylo Mocherniuk <mdanylo@google.com> Auto-Submit: Matthias Liedtke <mliedtke@google.com> Reviewed-by: Danylo Mocherniuk <mdanylo@google.com>
1 parent f475e21 commit aa76705

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

Sources/Fuzzilli/Environment/JavaScriptEnvironment.swift

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ public class JavaScriptEnvironment: ComponentBase {
374374
registerObjectGroup(.jsWeakMapPrototype)
375375
registerObjectGroup(.jsWeakMapConstructor)
376376
registerObjectGroup(.jsSets)
377+
registerObjectGroup(.jsSetPrototype)
378+
registerObjectGroup(.jsSetConstructor)
377379
registerObjectGroup(.jsWeakSets)
378380
registerObjectGroup(.jsWeakSetPrototype)
379381
registerObjectGroup(.jsWeakSetConstructor)
@@ -1114,7 +1116,7 @@ public extension ILType {
11141116
static let jsWeakMap = ILType.object(ofGroup: "WeakMap", withMethods: ["delete", "get", "has", "set", "getOrInsert", "getOrInsertComputed"])
11151117

11161118
/// Type of a JavaScript Set object.
1117-
static let jsSet = ILType.iterable + ILType.object(ofGroup: "Set", withProperties: ["size"], withMethods: ["add", "clear", "delete", "entries", "forEach", "has", "keys", "values"])
1119+
static let jsSet = ILType.iterable + ILType.object(ofGroup: "Set", withProperties: ["size"], withMethods: ["add", "clear", "delete", "entries", "forEach", "has", "keys", "values", "difference", "intersection", "isDisjointFrom", "isSubsetOf", "isSupersetOf", "symmetricDifference", "union"])
11181120

11191121
/// Type of a JavaScript WeakSet object.
11201122
static let jsWeakSet = ILType.object(ofGroup: "WeakSet", withMethods: ["add", "delete", "has"])
@@ -1226,7 +1228,7 @@ public extension ILType {
12261228
static let jsWeakMapConstructor = ILType.constructor([.object()] => .jsWeakMap) + .object(ofGroup: "WeakMapConstructor", withProperties: ["prototype"])
12271229

12281230
/// Type of the JavaScript Set constructor builtin.
1229-
static let jsSetConstructor = ILType.constructor([.object()] => .jsSet)
1231+
static let jsSetConstructor = ILType.constructor([.object()] => .jsSet) + .object(ofGroup: "SetConstructor", withProperties: ["prototype"])
12301232

12311233
/// Type of the JavaScript WeakSet constructor builtin.
12321234
static let jsWeakSetConstructor = ILType.constructor([.object()] => .jsWeakSet) + .object(ofGroup: "WeakSetConstructor", withProperties: ["prototype"])
@@ -1731,15 +1733,35 @@ public extension ObjectGroup {
17311733
"size" : .integer
17321734
],
17331735
methods: [
1734-
"add" : [.jsAnything] => .jsSet,
1735-
"clear" : [] => .undefined,
1736-
"delete" : [.jsAnything] => .boolean,
1737-
"entries" : [] => .jsIterator,
1738-
"forEach" : [.function(), .opt(.object())] => .undefined,
1739-
"has" : [.jsAnything] => .boolean,
1740-
"keys" : [] => .jsIterator,
1741-
"values" : [] => .jsIterator,
1742-
]
1736+
"add" : [.jsAnything] => .jsSet,
1737+
"clear" : [] => .undefined,
1738+
"delete" : [.jsAnything] => .boolean,
1739+
"difference" : [.plain(.jsSet)] => .jsSet,
1740+
"entries" : [] => .jsIterator,
1741+
"forEach" : [.function(), .opt(.object())] => .undefined,
1742+
"has" : [.jsAnything] => .boolean,
1743+
"intersection" : [.plain(.jsSet)] => .jsSet,
1744+
"isDisjointFrom" : [.plain(.jsSet)] => .boolean,
1745+
"isSubsetOf" : [.plain(.jsSet)] => .boolean,
1746+
"isSupersetOf" : [.plain(.jsSet)] => .boolean,
1747+
"keys" : [] => .jsIterator,
1748+
"symmetricDifference" : [.plain(.jsSet)] => .jsSet,
1749+
"union" : [.plain(.jsSet)] => .jsSet,
1750+
"values" : [] => .jsIterator,
1751+
]
1752+
)
1753+
1754+
static let jsSetPrototype = createPrototypeObjectGroup(jsSets,
1755+
constructor: .jsSetConstructor)
1756+
1757+
static let jsSetConstructor = ObjectGroup(
1758+
name: "SetConstructor",
1759+
constructorPath: "Set",
1760+
instanceType: .jsSetConstructor,
1761+
properties: [
1762+
"prototype" : jsSetPrototype.instanceType
1763+
],
1764+
methods: [:]
17431765
)
17441766

17451767
/// ObjectGroup modelling JavaScript WeakSet objects

0 commit comments

Comments
 (0)