OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2632 WriteBarrierMode mode = cons_string->GetWriteBarrierMode(no_gc); | 2632 WriteBarrierMode mode = cons_string->GetWriteBarrierMode(no_gc); |
2633 cons_string->set_length(length); | 2633 cons_string->set_length(length); |
2634 cons_string->set_hash_field(String::kEmptyHashField); | 2634 cons_string->set_hash_field(String::kEmptyHashField); |
2635 cons_string->set_first(first, mode); | 2635 cons_string->set_first(first, mode); |
2636 cons_string->set_second(second, mode); | 2636 cons_string->set_second(second, mode); |
2637 return result; | 2637 return result; |
2638 } | 2638 } |
2639 | 2639 |
2640 | 2640 |
2641 MaybeObject* Heap::AllocateSubString(String* buffer, | 2641 MaybeObject* Heap::AllocateSubString(String* buffer, |
2642 int start, | 2642 int start, |
Lasse Reichstein
2011/06/24 13:18:47
Indentation is bad. Fix it while you are here :)
sandholm
2011/06/24 13:40:02
Done.
| |
2643 int end, | 2643 int end, |
2644 PretenureFlag pretenure) { | 2644 PretenureFlag pretenure) { |
2645 int length = end - start; | 2645 int length = end - start; |
2646 | 2646 if (length == 0) { |
2647 if (length == 1) { | 2647 return empty_string(); |
2648 } else if (length == 1) { | |
2648 return LookupSingleCharacterStringFromCode(buffer->Get(start)); | 2649 return LookupSingleCharacterStringFromCode(buffer->Get(start)); |
2649 } else if (length == 2) { | 2650 } else if (length == 2) { |
2650 // Optimization for 2-byte strings often used as keys in a decompression | 2651 // Optimization for 2-byte strings often used as keys in a decompression |
2651 // dictionary. Check whether we already have the string in the symbol | 2652 // dictionary. Check whether we already have the string in the symbol |
2652 // table to prevent creation of many unneccesary strings. | 2653 // table to prevent creation of many unneccesary strings. |
2653 unsigned c1 = buffer->Get(start); | 2654 unsigned c1 = buffer->Get(start); |
2654 unsigned c2 = buffer->Get(start + 1); | 2655 unsigned c2 = buffer->Get(start + 1); |
2655 return MakeOrFindTwoCharacterString(this, c1, c2); | 2656 return MakeOrFindTwoCharacterString(this, c1, c2); |
2656 } | 2657 } |
2657 | 2658 |
(...skipping 3392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6050 } | 6051 } |
6051 | 6052 |
6052 | 6053 |
6053 void ExternalStringTable::TearDown() { | 6054 void ExternalStringTable::TearDown() { |
6054 new_space_strings_.Free(); | 6055 new_space_strings_.Free(); |
6055 old_space_strings_.Free(); | 6056 old_space_strings_.Free(); |
6056 } | 6057 } |
6057 | 6058 |
6058 | 6059 |
6059 } } // namespace v8::internal | 6060 } } // namespace v8::internal |
OLD | NEW |