OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 : heap->short_external_string_map())); | 986 : heap->short_external_string_map())); |
987 } | 987 } |
988 ExternalTwoByteString* self = ExternalTwoByteString::cast(this); | 988 ExternalTwoByteString* self = ExternalTwoByteString::cast(this); |
989 self->set_resource(resource); | 989 self->set_resource(resource); |
990 if (is_symbol) self->Hash(); // Force regeneration of the hash value. | 990 if (is_symbol) self->Hash(); // Force regeneration of the hash value. |
991 | 991 |
992 // Fill the remainder of the string with dead wood. | 992 // Fill the remainder of the string with dead wood. |
993 int new_size = this->Size(); // Byte size of the external String object. | 993 int new_size = this->Size(); // Byte size of the external String object. |
994 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); | 994 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); |
995 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { | 995 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { |
996 MemoryChunk::IncrementLiveBytes(this->address(), new_size - size); | 996 MemoryChunk::IncrementLiveBytesFromMutator(this->address(), new_size - size)
; |
997 } | 997 } |
998 return true; | 998 return true; |
999 } | 999 } |
1000 | 1000 |
1001 | 1001 |
1002 bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) { | 1002 bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) { |
1003 #ifdef DEBUG | 1003 #ifdef DEBUG |
1004 if (FLAG_enable_slow_asserts) { | 1004 if (FLAG_enable_slow_asserts) { |
1005 // Assert that the resource and the string are equivalent. | 1005 // Assert that the resource and the string are equivalent. |
1006 ASSERT(static_cast<size_t>(this->length()) == resource->length()); | 1006 ASSERT(static_cast<size_t>(this->length()) == resource->length()); |
(...skipping 23 matching lines...) Expand all Loading... |
1030 : heap->short_external_ascii_string_map()); | 1030 : heap->short_external_ascii_string_map()); |
1031 } | 1031 } |
1032 ExternalAsciiString* self = ExternalAsciiString::cast(this); | 1032 ExternalAsciiString* self = ExternalAsciiString::cast(this); |
1033 self->set_resource(resource); | 1033 self->set_resource(resource); |
1034 if (is_symbol) self->Hash(); // Force regeneration of the hash value. | 1034 if (is_symbol) self->Hash(); // Force regeneration of the hash value. |
1035 | 1035 |
1036 // Fill the remainder of the string with dead wood. | 1036 // Fill the remainder of the string with dead wood. |
1037 int new_size = this->Size(); // Byte size of the external String object. | 1037 int new_size = this->Size(); // Byte size of the external String object. |
1038 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); | 1038 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); |
1039 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { | 1039 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { |
1040 MemoryChunk::IncrementLiveBytes(this->address(), new_size - size); | 1040 MemoryChunk::IncrementLiveBytesFromMutator(this->address(), new_size - size)
; |
1041 } | 1041 } |
1042 return true; | 1042 return true; |
1043 } | 1043 } |
1044 | 1044 |
1045 | 1045 |
1046 void String::StringShortPrint(StringStream* accumulator) { | 1046 void String::StringShortPrint(StringStream* accumulator) { |
1047 int len = length(); | 1047 int len = length(); |
1048 if (len > kMaxShortPrintLength) { | 1048 if (len > kMaxShortPrintLength) { |
1049 accumulator->Add("<Very long string[%u]>", len); | 1049 accumulator->Add("<Very long string[%u]>", len); |
1050 return; | 1050 return; |
(...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3453 // We have now successfully allocated all the necessary objects. | 3453 // We have now successfully allocated all the necessary objects. |
3454 // Changes can now be made with the guarantee that all of them take effect. | 3454 // Changes can now be made with the guarantee that all of them take effect. |
3455 | 3455 |
3456 // Resize the object in the heap if necessary. | 3456 // Resize the object in the heap if necessary. |
3457 int new_instance_size = new_map->instance_size(); | 3457 int new_instance_size = new_map->instance_size(); |
3458 int instance_size_delta = map_of_this->instance_size() - new_instance_size; | 3458 int instance_size_delta = map_of_this->instance_size() - new_instance_size; |
3459 ASSERT(instance_size_delta >= 0); | 3459 ASSERT(instance_size_delta >= 0); |
3460 current_heap->CreateFillerObjectAt(this->address() + new_instance_size, | 3460 current_heap->CreateFillerObjectAt(this->address() + new_instance_size, |
3461 instance_size_delta); | 3461 instance_size_delta); |
3462 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { | 3462 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { |
3463 MemoryChunk::IncrementLiveBytes(this->address(), -instance_size_delta); | 3463 MemoryChunk::IncrementLiveBytesFromMutator(this->address(), |
| 3464 -instance_size_delta); |
3464 } | 3465 } |
3465 | 3466 |
3466 | 3467 |
3467 set_map(new_map); | 3468 set_map(new_map); |
3468 new_map->clear_instance_descriptors(); | 3469 new_map->clear_instance_descriptors(); |
3469 | 3470 |
3470 set_properties(dictionary); | 3471 set_properties(dictionary); |
3471 | 3472 |
3472 current_heap->isolate()->counters()->props_to_dictionary()->Increment(); | 3473 current_heap->isolate()->counters()->props_to_dictionary()->Increment(); |
3473 | 3474 |
(...skipping 9332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12806 if (break_point_objects()->IsUndefined()) return 0; | 12807 if (break_point_objects()->IsUndefined()) return 0; |
12807 // Single break point. | 12808 // Single break point. |
12808 if (!break_point_objects()->IsFixedArray()) return 1; | 12809 if (!break_point_objects()->IsFixedArray()) return 1; |
12809 // Multiple break points. | 12810 // Multiple break points. |
12810 return FixedArray::cast(break_point_objects())->length(); | 12811 return FixedArray::cast(break_point_objects())->length(); |
12811 } | 12812 } |
12812 #endif // ENABLE_DEBUGGER_SUPPORT | 12813 #endif // ENABLE_DEBUGGER_SUPPORT |
12813 | 12814 |
12814 | 12815 |
12815 } } // namespace v8::internal | 12816 } } // namespace v8::internal |
OLD | NEW |