| OLD | NEW |
| 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 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 if (first_length == 0) return second; | 1672 if (first_length == 0) return second; |
| 1673 | 1673 |
| 1674 int second_length = second->length(); | 1674 int second_length = second->length(); |
| 1675 if (second_length == 0) return first; | 1675 if (second_length == 0) return first; |
| 1676 | 1676 |
| 1677 int length = first_length + second_length; | 1677 int length = first_length + second_length; |
| 1678 bool is_ascii = first->IsAsciiRepresentation() | 1678 bool is_ascii = first->IsAsciiRepresentation() |
| 1679 && second->IsAsciiRepresentation(); | 1679 && second->IsAsciiRepresentation(); |
| 1680 | 1680 |
| 1681 // Make sure that an out of memory exception is thrown if the length | 1681 // Make sure that an out of memory exception is thrown if the length |
| 1682 // of the new cons string is too large to fit in a Smi. | 1682 // of the new cons string is too large. |
| 1683 if (length > Smi::kMaxValue || length < -0) { | 1683 if (length > String::kMaxLength || length < 0) { |
| 1684 Top::context()->mark_out_of_memory(); | 1684 Top::context()->mark_out_of_memory(); |
| 1685 return Failure::OutOfMemoryException(); | 1685 return Failure::OutOfMemoryException(); |
| 1686 } | 1686 } |
| 1687 | 1687 |
| 1688 // If the resulting string is small make a flat string. | 1688 // If the resulting string is small make a flat string. |
| 1689 if (length < String::kMinNonFlatLength) { | 1689 if (length < String::kMinNonFlatLength) { |
| 1690 ASSERT(first->IsFlat()); | 1690 ASSERT(first->IsFlat()); |
| 1691 ASSERT(second->IsFlat()); | 1691 ASSERT(second->IsFlat()); |
| 1692 if (is_ascii) { | 1692 if (is_ascii) { |
| 1693 Object* result = AllocateRawAsciiString(length); | 1693 Object* result = AllocateRawAsciiString(length); |
| (...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3887 for (int i = 0; i < kNumberOfCaches; i++) { | 3887 for (int i = 0; i < kNumberOfCaches; i++) { |
| 3888 if (caches_[i] != NULL) { | 3888 if (caches_[i] != NULL) { |
| 3889 delete caches_[i]; | 3889 delete caches_[i]; |
| 3890 caches_[i] = NULL; | 3890 caches_[i] = NULL; |
| 3891 } | 3891 } |
| 3892 } | 3892 } |
| 3893 } | 3893 } |
| 3894 | 3894 |
| 3895 | 3895 |
| 3896 } } // namespace v8::internal | 3896 } } // namespace v8::internal |
| OLD | NEW |