| 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;
|
| }
|
|
|