Skip to content

Commit 2dd2ec3

Browse files
aduh95danielleadams
authored andcommitted
v8: refactor to use more primordials
PR-URL: #36527 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Pooja D P <[email protected]>
1 parent 7134d49 commit 2dd2ec3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/v8.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
const {
1818
Array,
1919
ArrayBuffer,
20+
ArrayPrototypeForEach,
21+
ArrayPrototypePush,
2022
DataView,
2123
Error,
2224
Float32Array,
@@ -191,13 +193,14 @@ const arrayBufferViewTypeToIndex = new SafeMap();
191193

192194
{
193195
const dummy = new ArrayBuffer();
194-
for (const [i, ctor] of arrayBufferViewTypes.entries()) {
196+
ArrayPrototypeForEach(arrayBufferViewTypes, (ctor, i) => {
195197
const tag = ObjectPrototypeToString(new ctor(dummy));
196198
arrayBufferViewTypeToIndex.set(tag, i);
197-
}
199+
});
198200
}
199201

200-
const bufferConstructorIndex = arrayBufferViewTypes.push(FastBuffer) - 1;
202+
const bufferConstructorIndex =
203+
ArrayPrototypePush(arrayBufferViewTypes, FastBuffer) - 1;
201204

202205
class DefaultSerializer extends Serializer {
203206
constructor() {

0 commit comments

Comments
 (0)