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

Unified Diff: src/heap.cc

Issue 243051: the idea is that often times in code, you will see something like this:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 2 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
« no previous file with comments | « src/heap.h ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 3015)
+++ src/heap.cc (working copy)
@@ -1664,7 +1664,9 @@
}
-Object* Heap::AllocateConsString(String* first, String* second) {
+Object* Heap::AllocateConsString(String* first,
+ String* second,
+ PretenureFlag pretenure) {
int first_length = first->length();
if (first_length == 0) return second;
@@ -1687,7 +1689,7 @@
ASSERT(first->IsFlat());
ASSERT(second->IsFlat());
if (is_ascii) {
- Object* result = AllocateRawAsciiString(length);
+ Object* result = AllocateRawAsciiString(length, pretenure);
if (result->IsFailure()) return result;
// Copy the characters into the new object.
char* dest = SeqAsciiString::cast(result)->GetChars();
@@ -1699,7 +1701,7 @@
for (int i = 0; i < second_length; i++) *dest++ = src[i];
return result;
} else {
- Object* result = AllocateRawTwoByteString(length);
+ Object* result = AllocateRawTwoByteString(length, pretenure);
if (result->IsFailure()) return result;
// Copy the characters into the new object.
uc16* dest = SeqTwoByteString::cast(result)->GetChars();
@@ -1721,12 +1723,17 @@
: long_cons_string_map();
}
- Object* result = Allocate(map, NEW_SPACE);
+ AllocationSpace space =
+ (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE;
+ if (map->instance_size() > MaxObjectSizeInPagedSpace()) space = LO_SPACE;
+ Object* result = Allocate(map, space);
if (result->IsFailure()) return result;
- ASSERT(InNewSpace(result));
+ ASSERT(pretenure == TENURED ? !InNewSpace(result) : InNewSpace(result));
ConsString* cons_string = ConsString::cast(result);
- cons_string->set_first(first, SKIP_WRITE_BARRIER);
- cons_string->set_second(second, SKIP_WRITE_BARRIER);
+ WriteBarrierMode write_barrier_mode =
+ (pretenure == TENURED) ? UPDATE_WRITE_BARRIER : SKIP_WRITE_BARRIER;
+ cons_string->set_first(first, write_barrier_mode);
+ cons_string->set_second(second, write_barrier_mode);
cons_string->set_length(length);
return result;
}
« no previous file with comments | « src/heap.h ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698