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 danielleadams committed Jan 12, 2021
1 parent 7134d49 commit 2dd2ec3
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 @@ -191,13 +193,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 2dd2ec3

Please sign in to comment.