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 3914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3925 { MaybeObject* maybe_prop = CopyFixedArray(properties); | 3925 { MaybeObject* maybe_prop = CopyFixedArray(properties); |
3926 if (!maybe_prop->ToObject(&prop)) return maybe_prop; | 3926 if (!maybe_prop->ToObject(&prop)) return maybe_prop; |
3927 } | 3927 } |
3928 JSObject::cast(clone)->set_properties(FixedArray::cast(prop), wb_mode); | 3928 JSObject::cast(clone)->set_properties(FixedArray::cast(prop), wb_mode); |
3929 } | 3929 } |
3930 // Return the new clone. | 3930 // Return the new clone. |
3931 return clone; | 3931 return clone; |
3932 } | 3932 } |
3933 | 3933 |
3934 | 3934 |
3935 MaybeObject* Heap::AllocateStringFromOneByte(Vector<const uint8_t> string, | |
3936 PretenureFlag pretenure) { | |
3937 int length = string.length(); | |
3938 if (length == 1) { | |
3939 return Heap::LookupSingleCharacterStringFromCode(string[0]); | |
3940 } | |
3941 Object* result; | |
3942 { MaybeObject* maybe_result = | |
3943 AllocateRawOneByteString(string.length(), pretenure); | |
3944 if (!maybe_result->ToObject(&result)) return maybe_result; | |
3945 } | |
3946 | |
3947 // Copy the characters into the new object. | |
3948 CopyChars(SeqOneByteString::cast(result)->GetChars(), | |
3949 string.start(), | |
3950 length); | |
3951 return result; | |
3952 } | |
3953 | |
3954 | |
3955 MaybeObject* Heap::AllocateStringFromUtf8Slow(Vector<const char> string, | 3935 MaybeObject* Heap::AllocateStringFromUtf8Slow(Vector<const char> string, |
3956 int non_ascii_start, | 3936 int non_ascii_start, |
3957 PretenureFlag pretenure) { | 3937 PretenureFlag pretenure) { |
3958 // Continue counting the number of characters in the UTF-8 string, starting | 3938 // Continue counting the number of characters in the UTF-8 string, starting |
3959 // from the first non-ascii character or word. | 3939 // from the first non-ascii character or word. |
3960 Access<UnicodeCache::Utf8Decoder> | 3940 Access<UnicodeCache::Utf8Decoder> |
3961 decoder(isolate_->unicode_cache()->utf8_decoder()); | 3941 decoder(isolate_->unicode_cache()->utf8_decoder()); |
3962 decoder->Reset(string.start() + non_ascii_start, | 3942 decoder->Reset(string.start() + non_ascii_start, |
3963 string.length() - non_ascii_start); | 3943 string.length() - non_ascii_start); |
3964 int utf16_length = decoder->Utf16Length(); | 3944 int utf16_length = decoder->Utf16Length(); |
(...skipping 2749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6714 static_cast<int>(object_sizes_last_time_[index])); | 6694 static_cast<int>(object_sizes_last_time_[index])); |
6715 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6695 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6716 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6696 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6717 | 6697 |
6718 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6698 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6719 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6699 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6720 ClearObjectStats(); | 6700 ClearObjectStats(); |
6721 } | 6701 } |
6722 | 6702 |
6723 } } // namespace v8::internal | 6703 } } // namespace v8::internal |
OLD | NEW |