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 3981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3992 MaybeObject* maybe_result = AllocateRawTwoByteString(length, pretenure); | 3992 MaybeObject* maybe_result = AllocateRawTwoByteString(length, pretenure); |
3993 if (!maybe_result->ToObject(&result) || result->IsException()) { | 3993 if (!maybe_result->ToObject(&result) || result->IsException()) { |
3994 return maybe_result; | 3994 return maybe_result; |
3995 } | 3995 } |
3996 CopyChars(SeqTwoByteString::cast(result)->GetChars(), start, length); | 3996 CopyChars(SeqTwoByteString::cast(result)->GetChars(), start, length); |
3997 } | 3997 } |
3998 return result; | 3998 return result; |
3999 } | 3999 } |
4000 | 4000 |
4001 | 4001 |
4002 Map* Heap::InternalizedStringMapForString(String* string) { | |
4003 // If the string is in new space it cannot be used as internalized. | |
4004 if (InNewSpace(string)) return NULL; | |
4005 | |
4006 // Find the corresponding internalized string map for strings. | |
4007 switch (string->map()->instance_type()) { | |
4008 case STRING_TYPE: return internalized_string_map(); | |
4009 case ASCII_STRING_TYPE: return ascii_internalized_string_map(); | |
4010 case EXTERNAL_STRING_TYPE: return external_internalized_string_map(); | |
4011 case EXTERNAL_ASCII_STRING_TYPE: | |
4012 return external_ascii_internalized_string_map(); | |
4013 case EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE: | |
4014 return external_internalized_string_with_one_byte_data_map(); | |
4015 case SHORT_EXTERNAL_STRING_TYPE: | |
4016 return short_external_internalized_string_map(); | |
4017 case SHORT_EXTERNAL_ASCII_STRING_TYPE: | |
4018 return short_external_ascii_internalized_string_map(); | |
4019 case SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE: | |
4020 return short_external_internalized_string_with_one_byte_data_map(); | |
4021 default: return NULL; // No match found. | |
4022 } | |
4023 } | |
4024 | |
4025 | |
4026 static inline void WriteOneByteData(Vector<const char> vector, | 4002 static inline void WriteOneByteData(Vector<const char> vector, |
4027 uint8_t* chars, | 4003 uint8_t* chars, |
4028 int len) { | 4004 int len) { |
4029 // Only works for ascii. | 4005 // Only works for ascii. |
4030 ASSERT(vector.length() == len); | 4006 ASSERT(vector.length() == len); |
4031 OS::MemCopy(chars, vector.start(), len); | 4007 OS::MemCopy(chars, vector.start(), len); |
4032 } | 4008 } |
4033 | 4009 |
4034 static inline void WriteTwoByteData(Vector<const char> vector, | 4010 static inline void WriteTwoByteData(Vector<const char> vector, |
4035 uint16_t* chars, | 4011 uint16_t* chars, |
(...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6677 static_cast<int>(object_sizes_last_time_[index])); | 6653 static_cast<int>(object_sizes_last_time_[index])); |
6678 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6654 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6679 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6655 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6680 | 6656 |
6681 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6657 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6682 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6658 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6683 ClearObjectStats(); | 6659 ClearObjectStats(); |
6684 } | 6660 } |
6685 | 6661 |
6686 } } // namespace v8::internal | 6662 } } // namespace v8::internal |
OLD | NEW |