| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 | 1757 |
| 1758 | 1758 |
| 1759 enum MarksHandling { TRANSFER_MARKS, IGNORE_MARKS }; | 1759 enum MarksHandling { TRANSFER_MARKS, IGNORE_MARKS }; |
| 1760 | 1760 |
| 1761 | 1761 |
| 1762 template<MarksHandling marks_handling, | 1762 template<MarksHandling marks_handling, |
| 1763 LoggingAndProfiling logging_and_profiling_mode> | 1763 LoggingAndProfiling logging_and_profiling_mode> |
| 1764 class ScavengingVisitor : public StaticVisitorBase { | 1764 class ScavengingVisitor : public StaticVisitorBase { |
| 1765 public: | 1765 public: |
| 1766 static void Initialize() { | 1766 static void Initialize() { |
| 1767 table_.Register(kVisitSeqAsciiString, &EvacuateSeqAsciiString); | 1767 table_.Register(kVisitSeqOneByteString, &EvacuateSeqOneByteString); |
| 1768 table_.Register(kVisitSeqTwoByteString, &EvacuateSeqTwoByteString); | 1768 table_.Register(kVisitSeqTwoByteString, &EvacuateSeqTwoByteString); |
| 1769 table_.Register(kVisitShortcutCandidate, &EvacuateShortcutCandidate); | 1769 table_.Register(kVisitShortcutCandidate, &EvacuateShortcutCandidate); |
| 1770 table_.Register(kVisitByteArray, &EvacuateByteArray); | 1770 table_.Register(kVisitByteArray, &EvacuateByteArray); |
| 1771 table_.Register(kVisitFixedArray, &EvacuateFixedArray); | 1771 table_.Register(kVisitFixedArray, &EvacuateFixedArray); |
| 1772 table_.Register(kVisitFixedDoubleArray, &EvacuateFixedDoubleArray); | 1772 table_.Register(kVisitFixedDoubleArray, &EvacuateFixedDoubleArray); |
| 1773 | 1773 |
| 1774 table_.Register(kVisitNativeContext, | 1774 table_.Register(kVisitNativeContext, |
| 1775 &ObjectEvacuationStrategy<POINTER_OBJECT>:: | 1775 &ObjectEvacuationStrategy<POINTER_OBJECT>:: |
| 1776 template VisitSpecialized<Context::kSize>); | 1776 template VisitSpecialized<Context::kSize>); |
| 1777 | 1777 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2001 | 2001 |
| 2002 static inline void EvacuateByteArray(Map* map, | 2002 static inline void EvacuateByteArray(Map* map, |
| 2003 HeapObject** slot, | 2003 HeapObject** slot, |
| 2004 HeapObject* object) { | 2004 HeapObject* object) { |
| 2005 int object_size = reinterpret_cast<ByteArray*>(object)->ByteArraySize(); | 2005 int object_size = reinterpret_cast<ByteArray*>(object)->ByteArraySize(); |
| 2006 EvacuateObject<DATA_OBJECT, UNKNOWN_SIZE, kObjectAlignment>( | 2006 EvacuateObject<DATA_OBJECT, UNKNOWN_SIZE, kObjectAlignment>( |
| 2007 map, slot, object, object_size); | 2007 map, slot, object, object_size); |
| 2008 } | 2008 } |
| 2009 | 2009 |
| 2010 | 2010 |
| 2011 static inline void EvacuateSeqAsciiString(Map* map, | 2011 static inline void EvacuateSeqOneByteString(Map* map, |
| 2012 HeapObject** slot, | 2012 HeapObject** slot, |
| 2013 HeapObject* object) { | 2013 HeapObject* object) { |
| 2014 int object_size = SeqAsciiString::cast(object)-> | 2014 int object_size = SeqOneByteString::cast(object)-> |
| 2015 SeqAsciiStringSize(map->instance_type()); | 2015 SeqOneByteStringSize(map->instance_type()); |
| 2016 EvacuateObject<DATA_OBJECT, UNKNOWN_SIZE, kObjectAlignment>( | 2016 EvacuateObject<DATA_OBJECT, UNKNOWN_SIZE, kObjectAlignment>( |
| 2017 map, slot, object, object_size); | 2017 map, slot, object, object_size); |
| 2018 } | 2018 } |
| 2019 | 2019 |
| 2020 | 2020 |
| 2021 static inline void EvacuateSeqTwoByteString(Map* map, | 2021 static inline void EvacuateSeqTwoByteString(Map* map, |
| 2022 HeapObject** slot, | 2022 HeapObject** slot, |
| 2023 HeapObject* object) { | 2023 HeapObject* object) { |
| 2024 int object_size = SeqTwoByteString::cast(object)-> | 2024 int object_size = SeqTwoByteString::cast(object)-> |
| 2025 SeqTwoByteStringSize(map->instance_type()); | 2025 SeqTwoByteStringSize(map->instance_type()); |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3347 heap->symbol_table()->LookupTwoCharsSymbolIfExists(c1, c2, &symbol)) { | 3347 heap->symbol_table()->LookupTwoCharsSymbolIfExists(c1, c2, &symbol)) { |
| 3348 return symbol; | 3348 return symbol; |
| 3349 // Now we know the length is 2, we might as well make use of that fact | 3349 // Now we know the length is 2, we might as well make use of that fact |
| 3350 // when building the new string. | 3350 // when building the new string. |
| 3351 } else if ((c1 | c2) <= String::kMaxAsciiCharCodeU) { // We can do this | 3351 } else if ((c1 | c2) <= String::kMaxAsciiCharCodeU) { // We can do this |
| 3352 ASSERT(IsPowerOf2(String::kMaxAsciiCharCodeU + 1)); // because of this. | 3352 ASSERT(IsPowerOf2(String::kMaxAsciiCharCodeU + 1)); // because of this. |
| 3353 Object* result; | 3353 Object* result; |
| 3354 { MaybeObject* maybe_result = heap->AllocateRawAsciiString(2); | 3354 { MaybeObject* maybe_result = heap->AllocateRawAsciiString(2); |
| 3355 if (!maybe_result->ToObject(&result)) return maybe_result; | 3355 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 3356 } | 3356 } |
| 3357 char* dest = SeqAsciiString::cast(result)->GetChars(); | 3357 char* dest = SeqOneByteString::cast(result)->GetChars(); |
| 3358 dest[0] = c1; | 3358 dest[0] = c1; |
| 3359 dest[1] = c2; | 3359 dest[1] = c2; |
| 3360 return result; | 3360 return result; |
| 3361 } else { | 3361 } else { |
| 3362 Object* result; | 3362 Object* result; |
| 3363 { MaybeObject* maybe_result = heap->AllocateRawTwoByteString(2); | 3363 { MaybeObject* maybe_result = heap->AllocateRawTwoByteString(2); |
| 3364 if (!maybe_result->ToObject(&result)) return maybe_result; | 3364 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 3365 } | 3365 } |
| 3366 uc16* dest = SeqTwoByteString::cast(result)->GetChars(); | 3366 uc16* dest = SeqTwoByteString::cast(result)->GetChars(); |
| 3367 dest[0] = c1; | 3367 dest[0] = c1; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3421 // Note that neither of the two inputs can be a slice because: | 3421 // Note that neither of the two inputs can be a slice because: |
| 3422 STATIC_ASSERT(ConsString::kMinLength <= SlicedString::kMinLength); | 3422 STATIC_ASSERT(ConsString::kMinLength <= SlicedString::kMinLength); |
| 3423 ASSERT(first->IsFlat()); | 3423 ASSERT(first->IsFlat()); |
| 3424 ASSERT(second->IsFlat()); | 3424 ASSERT(second->IsFlat()); |
| 3425 if (is_ascii) { | 3425 if (is_ascii) { |
| 3426 Object* result; | 3426 Object* result; |
| 3427 { MaybeObject* maybe_result = AllocateRawAsciiString(length); | 3427 { MaybeObject* maybe_result = AllocateRawAsciiString(length); |
| 3428 if (!maybe_result->ToObject(&result)) return maybe_result; | 3428 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 3429 } | 3429 } |
| 3430 // Copy the characters into the new object. | 3430 // Copy the characters into the new object. |
| 3431 char* dest = SeqAsciiString::cast(result)->GetChars(); | 3431 char* dest = SeqOneByteString::cast(result)->GetChars(); |
| 3432 // Copy first part. | 3432 // Copy first part. |
| 3433 const char* src; | 3433 const char* src; |
| 3434 if (first->IsExternalString()) { | 3434 if (first->IsExternalString()) { |
| 3435 src = ExternalAsciiString::cast(first)->GetChars(); | 3435 src = ExternalAsciiString::cast(first)->GetChars(); |
| 3436 } else { | 3436 } else { |
| 3437 src = SeqAsciiString::cast(first)->GetChars(); | 3437 src = SeqOneByteString::cast(first)->GetChars(); |
| 3438 } | 3438 } |
| 3439 for (int i = 0; i < first_length; i++) *dest++ = src[i]; | 3439 for (int i = 0; i < first_length; i++) *dest++ = src[i]; |
| 3440 // Copy second part. | 3440 // Copy second part. |
| 3441 if (second->IsExternalString()) { | 3441 if (second->IsExternalString()) { |
| 3442 src = ExternalAsciiString::cast(second)->GetChars(); | 3442 src = ExternalAsciiString::cast(second)->GetChars(); |
| 3443 } else { | 3443 } else { |
| 3444 src = SeqAsciiString::cast(second)->GetChars(); | 3444 src = SeqOneByteString::cast(second)->GetChars(); |
| 3445 } | 3445 } |
| 3446 for (int i = 0; i < second_length; i++) *dest++ = src[i]; | 3446 for (int i = 0; i < second_length; i++) *dest++ = src[i]; |
| 3447 return result; | 3447 return result; |
| 3448 } else { | 3448 } else { |
| 3449 if (is_ascii_data_in_two_byte_string) { | 3449 if (is_ascii_data_in_two_byte_string) { |
| 3450 Object* result; | 3450 Object* result; |
| 3451 { MaybeObject* maybe_result = AllocateRawAsciiString(length); | 3451 { MaybeObject* maybe_result = AllocateRawAsciiString(length); |
| 3452 if (!maybe_result->ToObject(&result)) return maybe_result; | 3452 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 3453 } | 3453 } |
| 3454 // Copy the characters into the new object. | 3454 // Copy the characters into the new object. |
| 3455 char* dest = SeqAsciiString::cast(result)->GetChars(); | 3455 char* dest = SeqOneByteString::cast(result)->GetChars(); |
| 3456 String::WriteToFlat(first, dest, 0, first_length); | 3456 String::WriteToFlat(first, dest, 0, first_length); |
| 3457 String::WriteToFlat(second, dest + first_length, 0, second_length); | 3457 String::WriteToFlat(second, dest + first_length, 0, second_length); |
| 3458 isolate_->counters()->string_add_runtime_ext_to_ascii()->Increment(); | 3458 isolate_->counters()->string_add_runtime_ext_to_ascii()->Increment(); |
| 3459 return result; | 3459 return result; |
| 3460 } | 3460 } |
| 3461 | 3461 |
| 3462 Object* result; | 3462 Object* result; |
| 3463 { MaybeObject* maybe_result = AllocateRawTwoByteString(length); | 3463 { MaybeObject* maybe_result = AllocateRawTwoByteString(length); |
| 3464 if (!maybe_result->ToObject(&result)) return maybe_result; | 3464 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 3465 } | 3465 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3522 bool is_ascii = buffer->IsAsciiRepresentation(); | 3522 bool is_ascii = buffer->IsAsciiRepresentation(); |
| 3523 { MaybeObject* maybe_result = is_ascii | 3523 { MaybeObject* maybe_result = is_ascii |
| 3524 ? AllocateRawAsciiString(length, pretenure) | 3524 ? AllocateRawAsciiString(length, pretenure) |
| 3525 : AllocateRawTwoByteString(length, pretenure); | 3525 : AllocateRawTwoByteString(length, pretenure); |
| 3526 if (!maybe_result->ToObject(&result)) return maybe_result; | 3526 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 3527 } | 3527 } |
| 3528 String* string_result = String::cast(result); | 3528 String* string_result = String::cast(result); |
| 3529 // Copy the characters into the new object. | 3529 // Copy the characters into the new object. |
| 3530 if (is_ascii) { | 3530 if (is_ascii) { |
| 3531 ASSERT(string_result->IsAsciiRepresentation()); | 3531 ASSERT(string_result->IsAsciiRepresentation()); |
| 3532 char* dest = SeqAsciiString::cast(string_result)->GetChars(); | 3532 char* dest = SeqOneByteString::cast(string_result)->GetChars(); |
| 3533 String::WriteToFlat(buffer, dest, start, end); | 3533 String::WriteToFlat(buffer, dest, start, end); |
| 3534 } else { | 3534 } else { |
| 3535 ASSERT(string_result->IsTwoByteRepresentation()); | 3535 ASSERT(string_result->IsTwoByteRepresentation()); |
| 3536 uc16* dest = SeqTwoByteString::cast(string_result)->GetChars(); | 3536 uc16* dest = SeqTwoByteString::cast(string_result)->GetChars(); |
| 3537 String::WriteToFlat(buffer, dest, start, end); | 3537 String::WriteToFlat(buffer, dest, start, end); |
| 3538 } | 3538 } |
| 3539 return result; | 3539 return result; |
| 3540 } | 3540 } |
| 3541 | 3541 |
| 3542 ASSERT(buffer->IsFlat()); | 3542 ASSERT(buffer->IsFlat()); |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4565 if (length == 1) { | 4565 if (length == 1) { |
| 4566 return Heap::LookupSingleCharacterStringFromCode(string[0]); | 4566 return Heap::LookupSingleCharacterStringFromCode(string[0]); |
| 4567 } | 4567 } |
| 4568 Object* result; | 4568 Object* result; |
| 4569 { MaybeObject* maybe_result = | 4569 { MaybeObject* maybe_result = |
| 4570 AllocateRawAsciiString(string.length(), pretenure); | 4570 AllocateRawAsciiString(string.length(), pretenure); |
| 4571 if (!maybe_result->ToObject(&result)) return maybe_result; | 4571 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 4572 } | 4572 } |
| 4573 | 4573 |
| 4574 // Copy the characters into the new object. | 4574 // Copy the characters into the new object. |
| 4575 CopyChars(SeqAsciiString::cast(result)->GetChars(), string.start(), length); | 4575 CopyChars(SeqOneByteString::cast(result)->GetChars(), string.start(), length); |
| 4576 return result; | 4576 return result; |
| 4577 } | 4577 } |
| 4578 | 4578 |
| 4579 | 4579 |
| 4580 MaybeObject* Heap::AllocateStringFromUtf8Slow(Vector<const char> string, | 4580 MaybeObject* Heap::AllocateStringFromUtf8Slow(Vector<const char> string, |
| 4581 int non_ascii_start, | 4581 int non_ascii_start, |
| 4582 PretenureFlag pretenure) { | 4582 PretenureFlag pretenure) { |
| 4583 // Continue counting the number of characters in the UTF-8 string, starting | 4583 // Continue counting the number of characters in the UTF-8 string, starting |
| 4584 // from the first non-ascii character or word. | 4584 // from the first non-ascii character or word. |
| 4585 int chars = non_ascii_start; | 4585 int chars = non_ascii_start; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4620 MaybeObject* Heap::AllocateStringFromTwoByte(Vector<const uc16> string, | 4620 MaybeObject* Heap::AllocateStringFromTwoByte(Vector<const uc16> string, |
| 4621 PretenureFlag pretenure) { | 4621 PretenureFlag pretenure) { |
| 4622 // Check if the string is an ASCII string. | 4622 // Check if the string is an ASCII string. |
| 4623 Object* result; | 4623 Object* result; |
| 4624 int length = string.length(); | 4624 int length = string.length(); |
| 4625 const uc16* start = string.start(); | 4625 const uc16* start = string.start(); |
| 4626 | 4626 |
| 4627 if (String::IsAscii(start, length)) { | 4627 if (String::IsAscii(start, length)) { |
| 4628 MaybeObject* maybe_result = AllocateRawAsciiString(length, pretenure); | 4628 MaybeObject* maybe_result = AllocateRawAsciiString(length, pretenure); |
| 4629 if (!maybe_result->ToObject(&result)) return maybe_result; | 4629 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 4630 CopyChars(SeqAsciiString::cast(result)->GetChars(), start, length); | 4630 CopyChars(SeqOneByteString::cast(result)->GetChars(), start, length); |
| 4631 } else { // It's not an ASCII string. | 4631 } else { // It's not an ASCII string. |
| 4632 MaybeObject* maybe_result = AllocateRawTwoByteString(length, pretenure); | 4632 MaybeObject* maybe_result = AllocateRawTwoByteString(length, pretenure); |
| 4633 if (!maybe_result->ToObject(&result)) return maybe_result; | 4633 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 4634 CopyChars(SeqTwoByteString::cast(result)->GetChars(), start, length); | 4634 CopyChars(SeqTwoByteString::cast(result)->GetChars(), start, length); |
| 4635 } | 4635 } |
| 4636 return result; | 4636 return result; |
| 4637 } | 4637 } |
| 4638 | 4638 |
| 4639 | 4639 |
| 4640 Map* Heap::SymbolMapForString(String* string) { | 4640 Map* Heap::SymbolMapForString(String* string) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4675 break; | 4675 break; |
| 4676 } | 4676 } |
| 4677 } | 4677 } |
| 4678 buffer->Rewind(); | 4678 buffer->Rewind(); |
| 4679 | 4679 |
| 4680 // Compute map and object size. | 4680 // Compute map and object size. |
| 4681 int size; | 4681 int size; |
| 4682 Map* map; | 4682 Map* map; |
| 4683 | 4683 |
| 4684 if (is_ascii) { | 4684 if (is_ascii) { |
| 4685 if (chars > SeqAsciiString::kMaxLength) { | 4685 if (chars > SeqOneByteString::kMaxLength) { |
| 4686 return Failure::OutOfMemoryException(); | 4686 return Failure::OutOfMemoryException(); |
| 4687 } | 4687 } |
| 4688 map = ascii_symbol_map(); | 4688 map = ascii_symbol_map(); |
| 4689 size = SeqAsciiString::SizeFor(chars); | 4689 size = SeqOneByteString::SizeFor(chars); |
| 4690 } else { | 4690 } else { |
| 4691 if (chars > SeqTwoByteString::kMaxLength) { | 4691 if (chars > SeqTwoByteString::kMaxLength) { |
| 4692 return Failure::OutOfMemoryException(); | 4692 return Failure::OutOfMemoryException(); |
| 4693 } | 4693 } |
| 4694 map = symbol_map(); | 4694 map = symbol_map(); |
| 4695 size = SeqTwoByteString::SizeFor(chars); | 4695 size = SeqTwoByteString::SizeFor(chars); |
| 4696 } | 4696 } |
| 4697 | 4697 |
| 4698 // Allocate string. | 4698 // Allocate string. |
| 4699 Object* result; | 4699 Object* result; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 4720 answer->Set(i++, unibrow::Utf16::TrailSurrogate(character)); | 4720 answer->Set(i++, unibrow::Utf16::TrailSurrogate(character)); |
| 4721 } else { | 4721 } else { |
| 4722 answer->Set(i++, character); | 4722 answer->Set(i++, character); |
| 4723 } | 4723 } |
| 4724 } | 4724 } |
| 4725 return answer; | 4725 return answer; |
| 4726 } | 4726 } |
| 4727 | 4727 |
| 4728 | 4728 |
| 4729 MaybeObject* Heap::AllocateRawAsciiString(int length, PretenureFlag pretenure) { | 4729 MaybeObject* Heap::AllocateRawAsciiString(int length, PretenureFlag pretenure) { |
| 4730 if (length < 0 || length > SeqAsciiString::kMaxLength) { | 4730 if (length < 0 || length > SeqOneByteString::kMaxLength) { |
| 4731 return Failure::OutOfMemoryException(); | 4731 return Failure::OutOfMemoryException(); |
| 4732 } | 4732 } |
| 4733 | 4733 |
| 4734 int size = SeqAsciiString::SizeFor(length); | 4734 int size = SeqOneByteString::SizeFor(length); |
| 4735 ASSERT(size <= SeqAsciiString::kMaxSize); | 4735 ASSERT(size <= SeqOneByteString::kMaxSize); |
| 4736 | 4736 |
| 4737 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; | 4737 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; |
| 4738 AllocationSpace retry_space = OLD_DATA_SPACE; | 4738 AllocationSpace retry_space = OLD_DATA_SPACE; |
| 4739 | 4739 |
| 4740 if (space == NEW_SPACE) { | 4740 if (space == NEW_SPACE) { |
| 4741 if (size > kMaxObjectSizeInNewSpace) { | 4741 if (size > kMaxObjectSizeInNewSpace) { |
| 4742 // Allocate in large object space, retry space will be ignored. | 4742 // Allocate in large object space, retry space will be ignored. |
| 4743 space = LO_SPACE; | 4743 space = LO_SPACE; |
| 4744 } else if (size > Page::kMaxNonCodeHeapObjectSize) { | 4744 } else if (size > Page::kMaxNonCodeHeapObjectSize) { |
| 4745 // Allocate in new space, retry in large object space. | 4745 // Allocate in new space, retry in large object space. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4757 // Partially initialize the object. | 4757 // Partially initialize the object. |
| 4758 HeapObject::cast(result)->set_map_no_write_barrier(ascii_string_map()); | 4758 HeapObject::cast(result)->set_map_no_write_barrier(ascii_string_map()); |
| 4759 String::cast(result)->set_length(length); | 4759 String::cast(result)->set_length(length); |
| 4760 String::cast(result)->set_hash_field(String::kEmptyHashField); | 4760 String::cast(result)->set_hash_field(String::kEmptyHashField); |
| 4761 ASSERT_EQ(size, HeapObject::cast(result)->Size()); | 4761 ASSERT_EQ(size, HeapObject::cast(result)->Size()); |
| 4762 | 4762 |
| 4763 #ifdef VERIFY_HEAP | 4763 #ifdef VERIFY_HEAP |
| 4764 if (FLAG_verify_heap) { | 4764 if (FLAG_verify_heap) { |
| 4765 // Initialize string's content to ensure ASCII-ness (character range 0-127) | 4765 // Initialize string's content to ensure ASCII-ness (character range 0-127) |
| 4766 // as required when verifying the heap. | 4766 // as required when verifying the heap. |
| 4767 char* dest = SeqAsciiString::cast(result)->GetChars(); | 4767 char* dest = SeqOneByteString::cast(result)->GetChars(); |
| 4768 memset(dest, 0x0F, length * kCharSize); | 4768 memset(dest, 0x0F, length * kCharSize); |
| 4769 } | 4769 } |
| 4770 #endif | 4770 #endif |
| 4771 | 4771 |
| 4772 return result; | 4772 return result; |
| 4773 } | 4773 } |
| 4774 | 4774 |
| 4775 | 4775 |
| 4776 MaybeObject* Heap::AllocateRawTwoByteString(int length, | 4776 MaybeObject* Heap::AllocateRawTwoByteString(int length, |
| 4777 PretenureFlag pretenure) { | 4777 PretenureFlag pretenure) { |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5618 if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table; | 5618 if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table; |
| 5619 } | 5619 } |
| 5620 // Can't use set_symbol_table because SymbolTable::cast knows that | 5620 // Can't use set_symbol_table because SymbolTable::cast knows that |
| 5621 // SymbolTable is a singleton and checks for identity. | 5621 // SymbolTable is a singleton and checks for identity. |
| 5622 roots_[kSymbolTableRootIndex] = new_table; | 5622 roots_[kSymbolTableRootIndex] = new_table; |
| 5623 ASSERT(symbol != NULL); | 5623 ASSERT(symbol != NULL); |
| 5624 return symbol; | 5624 return symbol; |
| 5625 } | 5625 } |
| 5626 | 5626 |
| 5627 | 5627 |
| 5628 MaybeObject* Heap::LookupAsciiSymbol(Handle<SeqAsciiString> string, | 5628 MaybeObject* Heap::LookupAsciiSymbol(Handle<SeqOneByteString> string, |
| 5629 int from, | 5629 int from, |
| 5630 int length) { | 5630 int length) { |
| 5631 Object* symbol = NULL; | 5631 Object* symbol = NULL; |
| 5632 Object* new_table; | 5632 Object* new_table; |
| 5633 { MaybeObject* maybe_new_table = | 5633 { MaybeObject* maybe_new_table = |
| 5634 symbol_table()->LookupSubStringAsciiSymbol(string, | 5634 symbol_table()->LookupSubStringAsciiSymbol(string, |
| 5635 from, | 5635 from, |
| 5636 length, | 5636 length, |
| 5637 &symbol); | 5637 &symbol); |
| 5638 if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table; | 5638 if (!maybe_new_table->ToObject(&new_table)) return maybe_new_table; |
| (...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7504 static_cast<int>(object_sizes_last_time_[index])); | 7504 static_cast<int>(object_sizes_last_time_[index])); |
| 7505 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7505 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7506 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7506 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7507 | 7507 |
| 7508 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7508 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7509 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7509 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7510 ClearObjectStats(); | 7510 ClearObjectStats(); |
| 7511 } | 7511 } |
| 7512 | 7512 |
| 7513 } } // namespace v8::internal | 7513 } } // namespace v8::internal |
| OLD | NEW |