Skip to content

Commit

Permalink
v8: refactor to use more primordials
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Dec 15, 2020
1 parent 45dbcbe commit fe72118
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/internal/v8_prof_polyfill.js
Expand Up @@ -120,8 +120,8 @@ function versionCheck(firstLine, expected) {
// "v8-version,$major,$minor,$build,$patch[,$embedder],$candidate"
// whereas process.versions.v8 is either "$major.$minor.$build-$embedder" or
// "$major.$minor.$build.$patch-$embedder".
firstLine = firstLine.split(',');
const curVer = expected.split(/[.\-]/);
firstLine = StringPrototypeSplit(firstLine, ',');
const curVer = StringPrototypeSplit(expected, /[.\-]/);
if (firstLine.length !== 6 && firstLine.length !== 7 ||
firstLine[0] !== 'v8-version') {
return 'Unable to read v8-version from log file.';
Expand Down
9 changes: 6 additions & 3 deletions lib/v8.js
Expand Up @@ -17,6 +17,8 @@
const {
Array,
ArrayBuffer,
ArrayPrototypeForEach,
ArrayPrototypePush,
DataView,
Error,
Float32Array,
Expand Down Expand Up @@ -198,13 +200,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 fe72118

Please sign in to comment.