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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 self->Hash(); // Force regeneration of the hash value. | 882 self->Hash(); // Force regeneration of the hash value. |
883 // Now morph this external string into a external symbol. | 883 // Now morph this external string into a external symbol. |
884 this->set_map(is_ascii ? | 884 this->set_map(is_ascii ? |
885 heap->external_symbol_with_ascii_data_map() : | 885 heap->external_symbol_with_ascii_data_map() : |
886 heap->external_symbol_map()); | 886 heap->external_symbol_map()); |
887 } | 887 } |
888 | 888 |
889 // Fill the remainder of the string with dead wood. | 889 // Fill the remainder of the string with dead wood. |
890 int new_size = this->Size(); // Byte size of the external String object. | 890 int new_size = this->Size(); // Byte size of the external String object. |
891 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); | 891 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); |
892 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { | 892 if (MarkCompactCollector::IsLiveBytesUpdateRequired(this)) { |
893 MemoryChunk::IncrementLiveBytes(this->address(), new_size - size); | 893 MemoryChunk::IncrementLiveBytes(this->address(), new_size - size); |
894 } | 894 } |
895 return true; | 895 return true; |
896 } | 896 } |
897 | 897 |
898 | 898 |
899 bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) { | 899 bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) { |
900 #ifdef DEBUG | 900 #ifdef DEBUG |
901 if (FLAG_enable_slow_asserts) { | 901 if (FLAG_enable_slow_asserts) { |
902 // Assert that the resource and the string are equivalent. | 902 // Assert that the resource and the string are equivalent. |
(...skipping 28 matching lines...) Expand all Loading... |
931 // was a symbol to start with. | 931 // was a symbol to start with. |
932 if (is_symbol) { | 932 if (is_symbol) { |
933 self->Hash(); // Force regeneration of the hash value. | 933 self->Hash(); // Force regeneration of the hash value. |
934 // Now morph this external string into a external symbol. | 934 // Now morph this external string into a external symbol. |
935 this->set_map(heap->external_ascii_symbol_map()); | 935 this->set_map(heap->external_ascii_symbol_map()); |
936 } | 936 } |
937 | 937 |
938 // Fill the remainder of the string with dead wood. | 938 // Fill the remainder of the string with dead wood. |
939 int new_size = this->Size(); // Byte size of the external String object. | 939 int new_size = this->Size(); // Byte size of the external String object. |
940 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); | 940 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); |
941 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { | 941 if (MarkCompactCollector::IsLiveBytesUpdateRequired(this)) { |
942 MemoryChunk::IncrementLiveBytes(this->address(), new_size - size); | 942 MemoryChunk::IncrementLiveBytes(this->address(), new_size - size); |
943 } | 943 } |
944 | 944 |
945 return true; | 945 return true; |
946 } | 946 } |
947 | 947 |
948 | 948 |
949 void String::StringShortPrint(StringStream* accumulator) { | 949 void String::StringShortPrint(StringStream* accumulator) { |
950 int len = length(); | 950 int len = length(); |
951 if (len > kMaxShortPrintLength) { | 951 if (len > kMaxShortPrintLength) { |
(...skipping 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3248 | 3248 |
3249 // We have now successfully allocated all the necessary objects. | 3249 // We have now successfully allocated all the necessary objects. |
3250 // Changes can now be made with the guarantee that all of them take effect. | 3250 // Changes can now be made with the guarantee that all of them take effect. |
3251 | 3251 |
3252 // Resize the object in the heap if necessary. | 3252 // Resize the object in the heap if necessary. |
3253 int new_instance_size = new_map->instance_size(); | 3253 int new_instance_size = new_map->instance_size(); |
3254 int instance_size_delta = map_of_this->instance_size() - new_instance_size; | 3254 int instance_size_delta = map_of_this->instance_size() - new_instance_size; |
3255 ASSERT(instance_size_delta >= 0); | 3255 ASSERT(instance_size_delta >= 0); |
3256 current_heap->CreateFillerObjectAt(this->address() + new_instance_size, | 3256 current_heap->CreateFillerObjectAt(this->address() + new_instance_size, |
3257 instance_size_delta); | 3257 instance_size_delta); |
3258 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { | 3258 if (MarkCompactCollector::IsLiveBytesUpdateRequired(this)) { |
3259 MemoryChunk::IncrementLiveBytes(this->address(), -instance_size_delta); | 3259 MemoryChunk::IncrementLiveBytes(this->address(), -instance_size_delta); |
3260 } | 3260 } |
3261 | 3261 |
3262 | 3262 |
3263 set_map(new_map); | 3263 set_map(new_map); |
3264 new_map->clear_instance_descriptors(); | 3264 new_map->clear_instance_descriptors(); |
3265 | 3265 |
3266 set_properties(dictionary); | 3266 set_properties(dictionary); |
3267 | 3267 |
3268 current_heap->isolate()->counters()->props_to_dictionary()->Increment(); | 3268 current_heap->isolate()->counters()->props_to_dictionary()->Increment(); |
(...skipping 9069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12338 if (break_point_objects()->IsUndefined()) return 0; | 12338 if (break_point_objects()->IsUndefined()) return 0; |
12339 // Single break point. | 12339 // Single break point. |
12340 if (!break_point_objects()->IsFixedArray()) return 1; | 12340 if (!break_point_objects()->IsFixedArray()) return 1; |
12341 // Multiple break points. | 12341 // Multiple break points. |
12342 return FixedArray::cast(break_point_objects())->length(); | 12342 return FixedArray::cast(break_point_objects())->length(); |
12343 } | 12343 } |
12344 #endif // ENABLE_DEBUGGER_SUPPORT | 12344 #endif // ENABLE_DEBUGGER_SUPPORT |
12345 | 12345 |
12346 | 12346 |
12347 } } // namespace v8::internal | 12347 } } // namespace v8::internal |
OLD | NEW |