Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 5e66202ded50ffeb8047f7c150377cef71423f5b..5c4ac9c5d0da3cbad2dc3a56bbb83f52a1db9905 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -289,7 +289,7 @@ Handle<String> Factory::NewStringFromTwoByte(Vector<const uc16> string, |
Handle<SeqOneByteString> Factory::NewRawOneByteString(int length, |
- PretenureFlag pretenure) { |
+ PretenureFlag pretenure) { |
CALL_HEAP_FUNCTION( |
isolate(), |
isolate()->heap()->AllocateRawOneByteString(length, pretenure), |
@@ -411,6 +411,7 @@ Handle<String> Factory::NewConsString(Handle<String> left, |
ASSERT(left->IsFlat()); |
ASSERT(right->IsFlat()); |
+ STATIC_ASSERT(ConsString::kMinLength <= String::kMaxLength); |
if (is_one_byte) { |
Handle<SeqOneByteString> result = NewRawOneByteString(length); |
DisallowHeapAllocation no_gc; |
@@ -496,12 +497,14 @@ Handle<String> Factory::NewProperSubString(Handle<String> str, |
if (!FLAG_string_slices || length < SlicedString::kMinLength) { |
if (str->IsOneByteRepresentation()) { |
Handle<SeqOneByteString> result = NewRawOneByteString(length); |
+ ASSERT(!result.is_null()); |
uint8_t* dest = result->GetChars(); |
DisallowHeapAllocation no_gc; |
String::WriteToFlat(*str, dest, begin, end); |
return result; |
} else { |
Handle<SeqTwoByteString> result = NewRawTwoByteString(length); |
+ ASSERT(!result.is_null()); |
uc16* dest = result->GetChars(); |
DisallowHeapAllocation no_gc; |
String::WriteToFlat(*str, dest, begin, end); |