Commit 0f1ace8f authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[csa] disable bounds checks for ToString cache accesses

This addresses the JSTests/Array/OptFastForEach regression,
which ends up spending a lot of time in the ToString builtin.

Bug: chromium:932919
Change-Id: I53cfdc61841bf10a669e54c3fdc009ead295782b
Reviewed-on: https://chromium-review.googlesource.com/c/1477068Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59664}
parent 185ad97c
......@@ -7414,7 +7414,8 @@ TNode<String> CodeStubAssembler::NumberToString(TNode<Number> input) {
WordAnd(word_hash, WordSar(mask, SmiShiftBitsConstant()));
// Cache entry's key must be a heap number
Node* number_key = LoadFixedArrayElement(CAST(number_string_cache), index);
Node* number_key =
UnsafeLoadFixedArrayElement(CAST(number_string_cache), index);
GotoIf(TaggedIsSmi(number_key), &runtime);
GotoIfNot(IsHeapNumber(number_key), &runtime);
......@@ -7427,8 +7428,8 @@ TNode<String> CodeStubAssembler::NumberToString(TNode<Number> input) {
GotoIfNot(Word32Equal(high, high_compare), &runtime);
// Heap number match, return value from cache entry.
result = CAST(
LoadFixedArrayElement(CAST(number_string_cache), index, kTaggedSize));
result = CAST(UnsafeLoadFixedArrayElement(CAST(number_string_cache), index,
kTaggedSize));
Goto(&done);
}
......@@ -7437,13 +7438,13 @@ TNode<String> CodeStubAssembler::NumberToString(TNode<Number> input) {
// Load the smi key, make sure it matches the smi we're looking for.
Node* smi_index = BitcastWordToTagged(
WordAnd(WordShl(BitcastTaggedToWord(smi_input.value()), one), mask));
Node* smi_key = LoadFixedArrayElement(CAST(number_string_cache), smi_index,
0, SMI_PARAMETERS);
Node* smi_key = UnsafeLoadFixedArrayElement(CAST(number_string_cache),
smi_index, 0, SMI_PARAMETERS);
GotoIf(WordNotEqual(smi_key, smi_input.value()), &runtime);
// Smi match, return value from cache entry.
result = CAST(LoadFixedArrayElement(CAST(number_string_cache), smi_index,
kTaggedSize, SMI_PARAMETERS));
result = CAST(UnsafeLoadFixedArrayElement(
CAST(number_string_cache), smi_index, kTaggedSize, SMI_PARAMETERS));
Goto(&done);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment