Revision: 3611
Author: [email protected]
Date: Fri Jan 15 04:00:21 2010
Log: 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
http://code.google.com/p/v8/source/detail?r=3611

Modified:
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /branches/bleeding_edge/src/runtime.cc      Thu Jan 14 06:32:19 2010
+++ /branches/bleeding_edge/src/runtime.cc      Fri Jan 15 04:00:21 2010
@@ -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