Fix bug in keyed load stub for strings.

Instead of returning the empty string when indexing
a string out of bounds we now correctly return undefined.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3611 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
fschneider@chromium.org 2010-01-15 12:00:21 +00:00
parent acf74b04a7
commit d234b0e2ad

View File

@ -1479,7 +1479,11 @@ static Object* Runtime_StringCharAt(Arguments args) {
CONVERT_CHECKED(String, subject, args[0]);
Object* index = args[1];
return CharFromCode(CharCodeAt(subject, index));
Object* code = CharCodeAt(subject, index);
if (code == Heap::nan_value()) {
return Heap::undefined_value();
}
return CharFromCode(code);
}