Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 48cf266826dd53b6dae18a328a1959c206c12eb7..98352f4804e2b49723af9d33bab6b86f74049213 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -48,6 +48,7 @@ |
#include "snapshot.h" |
#include "store-buffer.h" |
#include "v8threads.h" |
+#include "v8utils.h" |
#include "vm-state-inl.h" |
#if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP |
#include "regexp-macro-assembler.h" |
@@ -4392,6 +4393,23 @@ MaybeObject* Heap::AllocateStringFromUtf8Slow(Vector<const char> string, |
} |
+MaybeObject* Heap::AllocateStringFromLatin1Slow(Vector<const char> string, |
+ PretenureFlag pretenure) { |
+ int chars = string.length(); |
+ Object* result; |
+ { MaybeObject* maybe_result = AllocateRawTwoByteString(chars, pretenure); |
+ if (!maybe_result->ToObject(&result)) return maybe_result; |
+ } |
+ |
+ // Convert and copy the characters into the new object. |
+ SeqTwoByteString* string_result = SeqTwoByteString::cast(result); |
+ CopyChars(string_result->GetChars(), |
+ reinterpret_cast<const unsigned char*>(string.start()), |
+ chars); |
+ return result; |
+} |
+ |
+ |
MaybeObject* Heap::AllocateStringFromTwoByte(Vector<const uc16> string, |
PretenureFlag pretenure) { |
// Check if the string is an ASCII string. |