Check for empty substring.
Review URL: http://codereview.chromium.org/7237023 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8419 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
b55a673177
commit
22abf6a579
11
src/heap.cc
11
src/heap.cc
@ -2634,12 +2634,13 @@ MaybeObject* Heap::AllocateConsString(String* first, String* second) {
|
|||||||
|
|
||||||
|
|
||||||
MaybeObject* Heap::AllocateSubString(String* buffer,
|
MaybeObject* Heap::AllocateSubString(String* buffer,
|
||||||
int start,
|
int start,
|
||||||
int end,
|
int end,
|
||||||
PretenureFlag pretenure) {
|
PretenureFlag pretenure) {
|
||||||
int length = end - start;
|
int length = end - start;
|
||||||
|
if (length == 0) {
|
||||||
if (length == 1) {
|
return empty_string();
|
||||||
|
} else if (length == 1) {
|
||||||
return LookupSingleCharacterStringFromCode(buffer->Get(start));
|
return LookupSingleCharacterStringFromCode(buffer->Get(start));
|
||||||
} else if (length == 2) {
|
} else if (length == 2) {
|
||||||
// Optimization for 2-byte strings often used as keys in a decompression
|
// Optimization for 2-byte strings often used as keys in a decompression
|
||||||
|
Loading…
Reference in New Issue
Block a user