Skip to content

Commit d15612a

Browse files
LiedtkeV8-internal LUCI CQ
authored andcommitted
[environment] Map: Add prototype object and Map.groupBy
Bug: 487347678 Change-Id: I37f8126dbd08e989f229246f68675540cfc8c9f4 Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/9052178 Commit-Queue: Danylo Mocherniuk <mdanylo@google.com> Reviewed-by: Danylo Mocherniuk <mdanylo@google.com> Auto-Submit: Matthias Liedtke <mliedtke@google.com>
1 parent 3d901fa commit d15612a

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

Sources/Fuzzilli/Environment/JavaScriptEnvironment.swift

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ public class JavaScriptEnvironment: ComponentBase {
368368
registerObjectGroup(.jsFunctions)
369369
registerObjectGroup(.jsSymbols)
370370
registerObjectGroup(.jsMaps)
371+
registerObjectGroup(.jsMapPrototype)
372+
registerObjectGroup(.jsMapConstructor)
371373
registerObjectGroup(.jsWeakMaps)
372374
registerObjectGroup(.jsSets)
373375
registerObjectGroup(.jsWeakSets)
@@ -1211,7 +1213,7 @@ public extension ILType {
12111213
static let jsProxyConstructor = ILType.constructor([.object(), .object()] => .jsAnything)
12121214

12131215
/// Type of the JavaScript Map constructor builtin.
1214-
static let jsMapConstructor = ILType.constructor([.object()] => .jsMap)
1216+
static let jsMapConstructor = ILType.constructor([.object()] => .jsMap) + .object(ofGroup: "MapConstructor", withProperties: ["prototype"], withMethods: ["groupBy"])
12151217

12161218
/// Type of the JavaScript WeakMap constructor builtin.
12171219
static let jsWeakMapConstructor = ILType.constructor([.object()] => .jsWeakMap)
@@ -1671,6 +1673,21 @@ public extension ObjectGroup {
16711673
]
16721674
)
16731675

1676+
static let jsMapPrototype = createPrototypeObjectGroup(jsMaps,
1677+
constructor: .jsMapConstructor)
1678+
1679+
static let jsMapConstructor = ObjectGroup(
1680+
name: "MapConstructor",
1681+
constructorPath: "Map",
1682+
instanceType: .jsMapConstructor,
1683+
properties: [
1684+
"prototype" : jsMapPrototype.instanceType
1685+
],
1686+
methods: [
1687+
"groupBy": [.iterable, .function()] => .jsMap
1688+
]
1689+
)
1690+
16741691
/// ObjectGroup modelling JavaScript WeakMap objects
16751692
static let jsWeakMaps = ObjectGroup(
16761693
name: "WeakMap",

0 commit comments

Comments
 (0)