| 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 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3004 cons_string->set_second(second, mode); | 3004 cons_string->set_second(second, mode); |
| 3005 return result; | 3005 return result; |
| 3006 } | 3006 } |
| 3007 | 3007 |
| 3008 | 3008 |
| 3009 MaybeObject* Heap::AllocateSubString(String* buffer, | 3009 MaybeObject* Heap::AllocateSubString(String* buffer, |
| 3010 int start, | 3010 int start, |
| 3011 int end, | 3011 int end, |
| 3012 PretenureFlag pretenure) { | 3012 PretenureFlag pretenure) { |
| 3013 int length = end - start; | 3013 int length = end - start; |
| 3014 if (length == 0) { | 3014 if (length <= 0) { |
| 3015 return empty_string(); | 3015 return empty_string(); |
| 3016 } else if (length == 1) { | 3016 } else if (length == 1) { |
| 3017 return LookupSingleCharacterStringFromCode(buffer->Get(start)); | 3017 return LookupSingleCharacterStringFromCode(buffer->Get(start)); |
| 3018 } else if (length == 2) { | 3018 } else if (length == 2) { |
| 3019 // Optimization for 2-byte strings often used as keys in a decompression | 3019 // Optimization for 2-byte strings often used as keys in a decompression |
| 3020 // dictionary. Check whether we already have the string in the symbol | 3020 // dictionary. Check whether we already have the string in the symbol |
| 3021 // table to prevent creation of many unneccesary strings. | 3021 // table to prevent creation of many unneccesary strings. |
| 3022 unsigned c1 = buffer->Get(start); | 3022 unsigned c1 = buffer->Get(start); |
| 3023 unsigned c2 = buffer->Get(start + 1); | 3023 unsigned c2 = buffer->Get(start + 1); |
| 3024 return MakeOrFindTwoCharacterString(this, c1, c2); | 3024 return MakeOrFindTwoCharacterString(this, c1, c2); |
| (...skipping 3629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6654 isolate_->heap()->store_buffer()->Compact(); | 6654 isolate_->heap()->store_buffer()->Compact(); |
| 6655 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6655 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
| 6656 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6656 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
| 6657 next = chunk->next_chunk(); | 6657 next = chunk->next_chunk(); |
| 6658 isolate_->memory_allocator()->Free(chunk); | 6658 isolate_->memory_allocator()->Free(chunk); |
| 6659 } | 6659 } |
| 6660 chunks_queued_for_free_ = NULL; | 6660 chunks_queued_for_free_ = NULL; |
| 6661 } | 6661 } |
| 6662 | 6662 |
| 6663 } } // namespace v8::internal | 6663 } } // namespace v8::internal |
| OLD | NEW |