Reviewers: Lasse Reichstein,

Description:
Check for empty substring.

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

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

Affected files:
  M     src/heap.cc


Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 8404)
+++ src/heap.cc (working copy)
@@ -2643,8 +2643,9 @@
                                 int end,
                                 PretenureFlag pretenure) {
   int length = end - start;
-
-  if (length == 1) {
+  if (length == 0) {
+    return empty_string();
+  } else if (length == 1) {
     return LookupSingleCharacterStringFromCode(buffer->Get(start));
   } else if (length == 2) {
// Optimization for 2-byte strings often used as keys in a decompression


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

Reply via email to