Reviewers: Lasse Reichstein, Michael Starzinger,
Message:
Please take a look.
This CL adds a read buffer to long external strings. Short ones (less than
kMinBufferedLength) stay the way they are. Long ones are extended by an
attached
buffer that caches a substring of the external string. The rationale for
this is
that reading from the buffer does not require calling to the runtime. In
particular, this benefits http://code.google.com/p/v8/issues/detail?id=1750
When we use String.charAt(index) on an external string, the generated code
check
whether the indexed character is in the buffered substring. If not, the
runtime
call updates the buffer to contain a substring around the indexed char. In
the
case of sequential access, buffering pays off the next time we access the
external string from generated code.
When making a cons or slice that depend on an external string and is long
enough
to be buffered, the string cannot be simply morphed into an external string
due
to size constraints. In this case it is morphed into a sliced string, which
points to a newly allocated external string.
This CL also unifies the non-crankshaft and the crankshaft version of
charCodeAt, which only differ in smi-ness of the index argument. The
additional
smi-tagging has close to no impact on performance here.
The performance of reading sequentially forward through an external string
using
charAt gains 75%. Reading sequentially backward gains 68%. Reading randomly
drops by 37% due to unnecessary buffer updates.
x64 and arm ports are going to follow shortly.
Description:
Introduce read buffer for external strings when using charAt (ia32).
TEST=test/mjsunit/string-externalize.js
Please review this at http://codereview.chromium.org/8568013/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/arm/macro-assembler-arm.cc
M src/code-stubs.h
M src/extensions/externalize-string-extension.cc
M src/heap.h
M src/heap.cc
M src/ia32/code-stubs-ia32.cc
M src/ia32/lithium-codegen-ia32.cc
M src/ia32/macro-assembler-ia32.cc
M src/mips/macro-assembler-mips.cc
M src/objects-debug.cc
M src/objects-inl.h
M src/objects-printer.cc
M src/objects-visiting.cc
M src/objects.h
M src/objects.cc
M src/runtime.cc
M src/x64/macro-assembler-x64.cc
M test/mjsunit/string-externalize.js
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev