Reviewers: Kevin Millikin,

Description:
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.


Please review this at http://codereview.chromium.org/542089

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/runtime.cc


Index: src/runtime.cc
===================================================================
--- src/runtime.cc      (revision 3610)
+++ src/runtime.cc      (working copy)
@@ -1479,7 +1479,11 @@

   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);
 }




-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to