Change information
Commit message:
[sandbox] Recover fast-path offset performance in ToDirectStringAssembler
crrev.com/c/7900075 introduced 32-bit offset accumulation in
ToDirectStringAssembler to prevent out-of-sandbox reads via sliced
string chains. However, changing var_offset_ to a 32-bit Int32T forced
CodeStubAssembler and optimized code to create a 32-bit loop Phi.
Consequently, even on the hot fast-path for flat strings, calling
offset() introduced a 32-bit to 64-bit zero-extension inside hot inner
loops (e.g. StringCharCodeAt), causing a JetStream2 regression.
This CL restores var_offset_ to a 64-bit IntPtrT while maintaining
32-bit wrapping arithmetic on the sliced string slow-path. On the
fast-path (flat strings), var_offset_ remains a clean 64-bit zero
constant or native 64-bit Phi with no conversion overhead. On the
slow-path, 32-bit wrapping addition limits accumulated offsets to
4 GB before zero-extending back to IntPtrT.
TAG=agy
CONV=4c4055d1-3009-41e9-98f5-c10ca2d24ecf
Bug: 521657359
Change-Id: I49f5dbf69409474b815686202008df8bfed42e29
Cr-Commit-Position: refs/heads/main@{#107876}
Files:
- M src/codegen/code-stub-assembler.cc
- M src/codegen/code-stub-assembler.h
Change size: S
Delta: 2 files changed, 8 insertions(+), 6 deletions(-)
Branch: refs/heads/main
Submit Requirements:
Code-Review: +1 by Michael Lippautz, +1 by Maksim Ivanov