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

Side by Side Diff: src/heap.cc

Issue 506018: Merge r3397 to branches/1.3... (Closed) Base URL: http://v8.googlecode.com/svn/branches/1.3/
Patch Set: Created 11 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 // If the resulting string is small make a flat string. 1786 // If the resulting string is small make a flat string.
1787 if (length < String::kMinNonFlatLength) { 1787 if (length < String::kMinNonFlatLength) {
1788 ASSERT(first->IsFlat()); 1788 ASSERT(first->IsFlat());
1789 ASSERT(second->IsFlat()); 1789 ASSERT(second->IsFlat());
1790 if (is_ascii) { 1790 if (is_ascii) {
1791 Object* result = AllocateRawAsciiString(length); 1791 Object* result = AllocateRawAsciiString(length);
1792 if (result->IsFailure()) return result; 1792 if (result->IsFailure()) return result;
1793 // Copy the characters into the new object. 1793 // Copy the characters into the new object.
1794 char* dest = SeqAsciiString::cast(result)->GetChars(); 1794 char* dest = SeqAsciiString::cast(result)->GetChars();
1795 // Copy first part. 1795 // Copy first part.
1796 char* src = SeqAsciiString::cast(first)->GetChars(); 1796 const char* src;
1797 if (first->IsExternalString()) {
1798 src = ExternalAsciiString::cast(first)->resource()->data();
1799 } else {
1800 src = SeqAsciiString::cast(first)->GetChars();
1801 }
1797 for (int i = 0; i < first_length; i++) *dest++ = src[i]; 1802 for (int i = 0; i < first_length; i++) *dest++ = src[i];
1798 // Copy second part. 1803 // Copy second part.
1799 src = SeqAsciiString::cast(second)->GetChars(); 1804 if (second->IsExternalString()) {
1805 src = ExternalAsciiString::cast(second)->resource()->data();
1806 } else {
1807 src = SeqAsciiString::cast(second)->GetChars();
1808 }
1800 for (int i = 0; i < second_length; i++) *dest++ = src[i]; 1809 for (int i = 0; i < second_length; i++) *dest++ = src[i];
1801 return result; 1810 return result;
1802 } else { 1811 } else {
1803 Object* result = AllocateRawTwoByteString(length); 1812 Object* result = AllocateRawTwoByteString(length);
1804 if (result->IsFailure()) return result; 1813 if (result->IsFailure()) return result;
1805 // Copy the characters into the new object. 1814 // Copy the characters into the new object.
1806 uc16* dest = SeqTwoByteString::cast(result)->GetChars(); 1815 uc16* dest = SeqTwoByteString::cast(result)->GetChars();
1807 String::WriteToFlat(first, dest, 0, first_length); 1816 String::WriteToFlat(first, dest, 0, first_length);
1808 String::WriteToFlat(second, dest + first_length, 0, second_length); 1817 String::WriteToFlat(second, dest + first_length, 0, second_length);
1809 return result; 1818 return result;
(...skipping 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after
4055 for (int i = 0; i < kNumberOfCaches; i++) { 4064 for (int i = 0; i < kNumberOfCaches; i++) {
4056 if (caches_[i] != NULL) { 4065 if (caches_[i] != NULL) {
4057 delete caches_[i]; 4066 delete caches_[i];
4058 caches_[i] = NULL; 4067 caches_[i] = NULL;
4059 } 4068 }
4060 } 4069 }
4061 } 4070 }
4062 4071
4063 4072
4064 } } // namespace v8::internal 4073 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698