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:
parent
acf74b04a7
commit
d234b0e2ad
@ -1479,7 +1479,11 @@ static Object* Runtime_StringCharAt(Arguments args) {
|
|||||||
|
|
||||||
CONVERT_CHECKED(String, subject, args[0]);
|
CONVERT_CHECKED(String, subject, args[0]);
|
||||||
Object* index = args[1];
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user