Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Unified Diff: src/heap.cc

Issue 10828229: Add basic support for Latin1 strings to the API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698