[Torque] Do Witness Rechecks() at loop starts
Since these Recheck() calls are usually combined with a bailout, doing them at the end of loops means we have to increment one or more bailout variables, which is hard to understand. Change-Id: I595ea592f31762da5abd85bfa7556eb39e3c9430 Reviewed-on: https://chromium-review.googlesource.com/c/1478694 Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Commit-Queue: Michael Stanton <mvstanton@chromium.org> Cr-Commit-Position: refs/heads/master@{#59727}
This commit is contained in:
parent
723b16b018
commit
26a2aee384
@ -92,6 +92,8 @@ namespace array {
|
|||||||
|
|
||||||
// Build a fast loop over the smi array.
|
// Build a fast loop over the smi array.
|
||||||
for (; k < len; k++) {
|
for (; k < len; k++) {
|
||||||
|
fastO.Recheck() otherwise goto Bailout(k);
|
||||||
|
|
||||||
// Ensure that we haven't walked beyond a possibly updated length.
|
// Ensure that we haven't walked beyond a possibly updated length.
|
||||||
if (k >= fastO.Get().length) goto Bailout(k);
|
if (k >= fastO.Get().length) goto Bailout(k);
|
||||||
|
|
||||||
@ -105,7 +107,6 @@ namespace array {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
label FoundHole {}
|
label FoundHole {}
|
||||||
fastO.Recheck() otherwise goto Bailout(k + 1);
|
|
||||||
}
|
}
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,8 @@ namespace array_filter {
|
|||||||
|
|
||||||
// Build a fast loop over the smi array.
|
// Build a fast loop over the smi array.
|
||||||
for (; k < len; k++) {
|
for (; k < len; k++) {
|
||||||
|
fastO.Recheck() otherwise goto Bailout(k, to);
|
||||||
|
|
||||||
// Ensure that we haven't walked beyond a possibly updated length.
|
// Ensure that we haven't walked beyond a possibly updated length.
|
||||||
if (k >= fastO.Get().length) goto Bailout(k, to);
|
if (k >= fastO.Get().length) goto Bailout(k, to);
|
||||||
const value: Object = LoadElementNoHole<FixedArrayType>(fastO.Get(), k)
|
const value: Object = LoadElementNoHole<FixedArrayType>(fastO.Get(), k)
|
||||||
@ -128,7 +130,6 @@ namespace array_filter {
|
|||||||
}
|
}
|
||||||
to = to + 1;
|
to = to + 1;
|
||||||
}
|
}
|
||||||
fastO.Recheck() otherwise goto Bailout(k + 1, to);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,12 +77,13 @@ namespace array_foreach {
|
|||||||
|
|
||||||
// Build a fast loop over the smi array.
|
// Build a fast loop over the smi array.
|
||||||
for (; k < len; k++) {
|
for (; k < len; k++) {
|
||||||
|
fastO.Recheck() otherwise goto Bailout(k);
|
||||||
|
|
||||||
// Ensure that we haven't walked beyond a possibly updated length.
|
// Ensure that we haven't walked beyond a possibly updated length.
|
||||||
if (k >= fastO.Get().length) goto Bailout(k);
|
if (k >= fastO.Get().length) goto Bailout(k);
|
||||||
const value: Object = LoadElementNoHole<FixedArrayType>(fastO.Get(), k)
|
const value: Object = LoadElementNoHole<FixedArrayType>(fastO.Get(), k)
|
||||||
otherwise continue;
|
otherwise continue;
|
||||||
Call(context, callbackfn, thisArg, value, k, fastO.Get());
|
Call(context, callbackfn, thisArg, value, k, fastO.Get());
|
||||||
fastO.Recheck() otherwise goto Bailout(k + 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +191,8 @@ namespace array_map {
|
|||||||
// Build a fast loop over the smi array.
|
// Build a fast loop over the smi array.
|
||||||
// 7. Repeat, while k < len.
|
// 7. Repeat, while k < len.
|
||||||
for (; k < len; k++) {
|
for (; k < len; k++) {
|
||||||
|
fastO.Recheck() otherwise goto Bailout(v, k);
|
||||||
|
|
||||||
// Ensure that we haven't walked beyond a possibly updated length.
|
// Ensure that we haven't walked beyond a possibly updated length.
|
||||||
if (k >= fastO.Get().length) goto Bailout(v, k);
|
if (k >= fastO.Get().length) goto Bailout(v, k);
|
||||||
|
|
||||||
@ -200,7 +202,6 @@ namespace array_map {
|
|||||||
const result: Object =
|
const result: Object =
|
||||||
Call(context, callbackfn, thisArg, value, k, fastO.Get());
|
Call(context, callbackfn, thisArg, value, k, fastO.Get());
|
||||||
v.StoreResult(k, result);
|
v.StoreResult(k, result);
|
||||||
fastO.Recheck() otherwise goto Bailout(v, k + 1);
|
|
||||||
}
|
}
|
||||||
label FoundHole {
|
label FoundHole {
|
||||||
// Our output array must necessarily be holey because of holes in
|
// Our output array must necessarily be holey because of holes in
|
||||||
|
@ -92,6 +92,8 @@ namespace array {
|
|||||||
|
|
||||||
// Build a fast loop over the smi array.
|
// Build a fast loop over the smi array.
|
||||||
for (; k < len; k++) {
|
for (; k < len; k++) {
|
||||||
|
fastO.Recheck() otherwise goto Bailout(k);
|
||||||
|
|
||||||
// Ensure that we haven't walked beyond a possibly updated length.
|
// Ensure that we haven't walked beyond a possibly updated length.
|
||||||
if (k >= fastO.Get().length) goto Bailout(k);
|
if (k >= fastO.Get().length) goto Bailout(k);
|
||||||
|
|
||||||
@ -105,7 +107,6 @@ namespace array {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
label FoundHole {}
|
label FoundHole {}
|
||||||
fastO.Recheck() otherwise goto Bailout(k + 1);
|
|
||||||
}
|
}
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user