Skip to content

Commit 1551b40

Browse files
aduh95targos
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 e12dbc8 commit 1551b40

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,
@@ -185,13 +187,14 @@ const arrayBufferViewTypeToIndex = new SafeMap();
185187

186188
{
187189
const dummy = new ArrayBuffer();
188-
for (const [i, ctor] of arrayBufferViewTypes.entries()) {
190+
ArrayPrototypeForEach(arrayBufferViewTypes, (ctor, i) => {
189191
const tag = ObjectPrototypeToString(new ctor(dummy));
190192
arrayBufferViewTypeToIndex.set(tag, i);
191-
}
193+
});
192194
}
193195

194-
const bufferConstructorIndex = arrayBufferViewTypes.push(FastBuffer) - 1;
196+
const bufferConstructorIndex =
197+
ArrayPrototypePush(arrayBufferViewTypes, FastBuffer) - 1;
195198

196199
class DefaultSerializer extends Serializer {
197200
constructor() {

0 commit comments

Comments
 (0)