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 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 return result; | 1662 return result; |
1663 } | 1663 } |
1664 | 1664 |
1665 | 1665 |
1666 Object* Heap::AllocateSlicedString(String* buffer, | 1666 Object* Heap::AllocateSlicedString(String* buffer, |
1667 int start, | 1667 int start, |
1668 int end) { | 1668 int end) { |
1669 int length = end - start; | 1669 int length = end - start; |
1670 | 1670 |
1671 // If the resulting string is small make a sub string. | 1671 // If the resulting string is small make a sub string. |
1672 if (end - start <= String::kMinNonFlatLength) { | 1672 if (length <= String::kMinNonFlatLength) { |
1673 return Heap::AllocateSubString(buffer, start, end); | 1673 return Heap::AllocateSubString(buffer, start, end); |
1674 } | 1674 } |
1675 | 1675 |
1676 Map* map; | 1676 Map* map; |
1677 if (length <= String::kMaxShortStringSize) { | 1677 if (length <= String::kMaxShortStringSize) { |
1678 map = buffer->IsAsciiRepresentation() ? | 1678 map = buffer->IsAsciiRepresentation() ? |
1679 short_sliced_ascii_string_map() : | 1679 short_sliced_ascii_string_map() : |
1680 short_sliced_string_map(); | 1680 short_sliced_string_map(); |
1681 } else if (length <= String::kMaxMediumStringSize) { | 1681 } else if (length <= String::kMaxMediumStringSize) { |
1682 map = buffer->IsAsciiRepresentation() ? | 1682 map = buffer->IsAsciiRepresentation() ? |
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3865 #ifdef DEBUG | 3865 #ifdef DEBUG |
3866 bool Heap::GarbageCollectionGreedyCheck() { | 3866 bool Heap::GarbageCollectionGreedyCheck() { |
3867 ASSERT(FLAG_gc_greedy); | 3867 ASSERT(FLAG_gc_greedy); |
3868 if (Bootstrapper::IsActive()) return true; | 3868 if (Bootstrapper::IsActive()) return true; |
3869 if (disallow_allocation_failure()) return true; | 3869 if (disallow_allocation_failure()) return true; |
3870 return CollectGarbage(0, NEW_SPACE); | 3870 return CollectGarbage(0, NEW_SPACE); |
3871 } | 3871 } |
3872 #endif | 3872 #endif |
3873 | 3873 |
3874 } } // namespace v8::internal | 3874 } } // namespace v8::internal |
OLD | NEW |