Inline the isRef checks in the various XRef.fetch related methods

The relevant methods are usually not hot enough for these changes to have an easily measurable effect, however there's been a lot of other cases where similiar inlining has helped performance. (And these changes may help offset the changes made in the next patch.)
This commit is contained in:
Jonas Jenwald 2019-08-17 11:06:27 +02:00
parent 1565d1849d
commit 34a53b9f5d

@ -1626,14 +1626,14 @@ var XRef = (function XRefClosure() {
},
fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
if (!isRef(obj)) {
return obj;
}
if (obj instanceof Ref) {
return this.fetch(obj, suppressEncryption);
}
return obj;
},
fetch: function XRef_fetch(ref, suppressEncryption) {
if (!isRef(ref)) {
if (!(ref instanceof Ref)) {
throw new Error('ref object is not a reference');
}
var num = ref.num;
@ -1768,10 +1768,10 @@ var XRef = (function XRefClosure() {
},
async fetchIfRefAsync(obj, suppressEncryption) {
if (!isRef(obj)) {
return obj;
}
if (obj instanceof Ref) {
return this.fetchAsync(obj, suppressEncryption);
}
return obj;
},
async fetchAsync(ref, suppressEncryption) {