| 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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 self->Hash(); // Force regeneration of the hash value. | 829 self->Hash(); // Force regeneration of the hash value. |
| 830 // Now morph this external string into a external symbol. | 830 // Now morph this external string into a external symbol. |
| 831 this->set_map(is_ascii ? | 831 this->set_map(is_ascii ? |
| 832 heap->external_symbol_with_ascii_data_map() : | 832 heap->external_symbol_with_ascii_data_map() : |
| 833 heap->external_symbol_map()); | 833 heap->external_symbol_map()); |
| 834 } | 834 } |
| 835 | 835 |
| 836 // Fill the remainder of the string with dead wood. | 836 // Fill the remainder of the string with dead wood. |
| 837 int new_size = this->Size(); // Byte size of the external String object. | 837 int new_size = this->Size(); // Byte size of the external String object. |
| 838 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); | 838 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); |
| 839 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { |
| 840 MemoryChunk::IncrementLiveBytes(this->address(), new_size - size); |
| 841 } |
| 839 return true; | 842 return true; |
| 840 } | 843 } |
| 841 | 844 |
| 842 | 845 |
| 843 bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) { | 846 bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) { |
| 844 #ifdef DEBUG | 847 #ifdef DEBUG |
| 845 if (FLAG_enable_slow_asserts) { | 848 if (FLAG_enable_slow_asserts) { |
| 846 // Assert that the resource and the string are equivalent. | 849 // Assert that the resource and the string are equivalent. |
| 847 ASSERT(static_cast<size_t>(this->length()) == resource->length()); | 850 ASSERT(static_cast<size_t>(this->length()) == resource->length()); |
| 848 ScopedVector<char> smart_chars(this->length()); | 851 ScopedVector<char> smart_chars(this->length()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 875 // was a symbol to start with. | 878 // was a symbol to start with. |
| 876 if (is_symbol) { | 879 if (is_symbol) { |
| 877 self->Hash(); // Force regeneration of the hash value. | 880 self->Hash(); // Force regeneration of the hash value. |
| 878 // Now morph this external string into a external symbol. | 881 // Now morph this external string into a external symbol. |
| 879 this->set_map(heap->external_ascii_symbol_map()); | 882 this->set_map(heap->external_ascii_symbol_map()); |
| 880 } | 883 } |
| 881 | 884 |
| 882 // Fill the remainder of the string with dead wood. | 885 // Fill the remainder of the string with dead wood. |
| 883 int new_size = this->Size(); // Byte size of the external String object. | 886 int new_size = this->Size(); // Byte size of the external String object. |
| 884 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); | 887 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); |
| 888 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { |
| 889 MemoryChunk::IncrementLiveBytes(this->address(), new_size - size); |
| 890 } |
| 891 |
| 885 return true; | 892 return true; |
| 886 } | 893 } |
| 887 | 894 |
| 888 | 895 |
| 889 void String::StringShortPrint(StringStream* accumulator) { | 896 void String::StringShortPrint(StringStream* accumulator) { |
| 890 int len = length(); | 897 int len = length(); |
| 891 if (len > kMaxShortPrintLength) { | 898 if (len > kMaxShortPrintLength) { |
| 892 accumulator->Add("<Very long string[%u]>", len); | 899 accumulator->Add("<Very long string[%u]>", len); |
| 893 return; | 900 return; |
| 894 } | 901 } |
| (...skipping 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2681 | 2688 |
| 2682 // We have now successfully allocated all the necessary objects. | 2689 // We have now successfully allocated all the necessary objects. |
| 2683 // Changes can now be made with the guarantee that all of them take effect. | 2690 // Changes can now be made with the guarantee that all of them take effect. |
| 2684 | 2691 |
| 2685 // Resize the object in the heap if necessary. | 2692 // Resize the object in the heap if necessary. |
| 2686 int new_instance_size = new_map->instance_size(); | 2693 int new_instance_size = new_map->instance_size(); |
| 2687 int instance_size_delta = map_of_this->instance_size() - new_instance_size; | 2694 int instance_size_delta = map_of_this->instance_size() - new_instance_size; |
| 2688 ASSERT(instance_size_delta >= 0); | 2695 ASSERT(instance_size_delta >= 0); |
| 2689 current_heap->CreateFillerObjectAt(this->address() + new_instance_size, | 2696 current_heap->CreateFillerObjectAt(this->address() + new_instance_size, |
| 2690 instance_size_delta); | 2697 instance_size_delta); |
| 2698 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { |
| 2699 MemoryChunk::IncrementLiveBytes(this->address(), -instance_size_delta); |
| 2700 } |
| 2701 |
| 2691 | 2702 |
| 2692 set_map(new_map); | 2703 set_map(new_map); |
| 2693 new_map->clear_instance_descriptors(); | 2704 new_map->clear_instance_descriptors(); |
| 2694 | 2705 |
| 2695 set_properties(dictionary); | 2706 set_properties(dictionary); |
| 2696 | 2707 |
| 2697 current_heap->isolate()->counters()->props_to_dictionary()->Increment(); | 2708 current_heap->isolate()->counters()->props_to_dictionary()->Increment(); |
| 2698 | 2709 |
| 2699 #ifdef DEBUG | 2710 #ifdef DEBUG |
| 2700 if (FLAG_trace_normalization) { | 2711 if (FLAG_trace_normalization) { |
| (...skipping 7921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10622 if (break_point_objects()->IsUndefined()) return 0; | 10633 if (break_point_objects()->IsUndefined()) return 0; |
| 10623 // Single beak point. | 10634 // Single beak point. |
| 10624 if (!break_point_objects()->IsFixedArray()) return 1; | 10635 if (!break_point_objects()->IsFixedArray()) return 1; |
| 10625 // Multiple break points. | 10636 // Multiple break points. |
| 10626 return FixedArray::cast(break_point_objects())->length(); | 10637 return FixedArray::cast(break_point_objects())->length(); |
| 10627 } | 10638 } |
| 10628 #endif | 10639 #endif |
| 10629 | 10640 |
| 10630 | 10641 |
| 10631 } } // namespace v8::internal | 10642 } } // namespace v8::internal |
| OLD | NEW |