Don't externalize fresh strings.
authorvitalyr@chromium.org <vitalyr@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 16 Feb 2010 18:56:07 +0000 (18:56 +0000)
committervitalyr@chromium.org <vitalyr@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 16 Feb 2010 18:56:07 +0000 (18:56 +0000)
commitad9ea637bed075af7bb1824464a538ed9c3ae37d
treea79518635b4ead697788883e02b6b018755381f7
parente61996bf3fd3913af8c797b5c7c9a3cc3ef190b3
Don't externalize fresh strings.

With the current API the embedder has to extrenalize a string each
time a string is encountered to avoid the cost of repeated character
copying/conversion. The issue here is that the externalization cost
itself is non-negligible (both in time and space) and should not be
paid for a rarely used string. This change is an attempt to predict a
string's usage frequency based on its freshness. A string is
considered fresh if it was recently allocated in the new space.

Review URL: http://codereview.chromium.org/608006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3878 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
src/api.cc
test/cctest/test-api.cc