Skip to content

Commit

Permalink
v8: refactor to use more primordials
Browse files Browse the repository at this point in the history
PR-URL: #36527
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Pooja D P <[email protected]>
  • Loading branch information
aduh95 authored and targos committed Jun 11, 2021
1 parent e12dbc8 commit 1551b40
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/v8.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
const {
Array,
ArrayBuffer,
ArrayPrototypeForEach,
ArrayPrototypePush,
DataView,
Error,
Float32Array,
Expand Down Expand Up @@ -185,13 +187,14 @@ const arrayBufferViewTypeToIndex = new SafeMap();

{
const dummy = new ArrayBuffer();
for (const [i, ctor] of arrayBufferViewTypes.entries()) {
ArrayPrototypeForEach(arrayBufferViewTypes, (ctor, i) => {
const tag = ObjectPrototypeToString(new ctor(dummy));
arrayBufferViewTypeToIndex.set(tag, i);
}
});
}

const bufferConstructorIndex = arrayBufferViewTypes.push(FastBuffer) - 1;
const bufferConstructorIndex =
ArrayPrototypePush(arrayBufferViewTypes, FastBuffer) - 1;

class DefaultSerializer extends Serializer {
constructor() {
Expand Down

0 comments on commit 1551b40

Please sign in to comment.