summaryrefslogtreecommitdiff
path: root/deps/v8/src/spaces-inl.h
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-12-10 11:21:47 -0800
committerRyan Dahl <ry@tinyclouds.org>2010-12-16 12:10:54 -0800
commitc6406f9e5775deb5d76baac572a3050a358beb17 (patch)
tree90c5b40124db9c82fe28e4a98e68af2b03ce4048 /deps/v8/src/spaces-inl.h
parentea700a8851023a1967083f22daa40f4c7a4366bf (diff)
downloadnode-new-c6406f9e5775deb5d76baac572a3050a358beb17.tar.gz
Apply V8 r5951 to fix Mac build
From f3973972b727df480697443871d780596aba0201 Mon Sep 17 00:00:00 2001 From: erik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00> Date: Wed, 8 Dec 2010 16:23:25 +0000 Subject: [PATCH] Speed up quoting of JSON strings by allocating a string that is big enough and then trimming it when the length is known. This way we only have to traverse the input once. Review URL: http://codereview.chromium.org/5556012
Diffstat (limited to 'deps/v8/src/spaces-inl.h')
-rw-r--r--deps/v8/src/spaces-inl.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/deps/v8/src/spaces-inl.h b/deps/v8/src/spaces-inl.h
index ad09ae2e04..aaca9e45ca 100644
--- a/deps/v8/src/spaces-inl.h
+++ b/deps/v8/src/spaces-inl.h
@@ -481,7 +481,7 @@ void LargeObjectChunk::Free(Executability executable) {
}
// -----------------------------------------------------------------------------
-// LargeObjectSpace
+// NewSpace
MaybeObject* NewSpace::AllocateRawInternal(int size_in_bytes,
AllocationInfo* alloc_info) {
@@ -501,6 +501,18 @@ MaybeObject* NewSpace::AllocateRawInternal(int size_in_bytes,
}
+template <typename StringType>
+void NewSpace::ShrinkStringAtAllocationBoundary(String* string, int length) {
+ ASSERT(length <= string->length());
+ ASSERT(string->IsSeqString());
+ ASSERT(string->address() + StringType::SizeFor(string->length()) ==
+ allocation_info_.top);
+ allocation_info_.top =
+ string->address() + StringType::SizeFor(length);
+ string->set_length(length);
+}
+
+
bool FreeListNode::IsFreeListNode(HeapObject* object) {
return object->map() == Heap::raw_unchecked_byte_array_map()
|| object->map() == Heap::raw_unchecked_one_pointer_filler_map()