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 3582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3593 | 3593 |
3594 | 3594 |
3595 MaybeObject* Heap::AllocateExternalStringFromAscii( | 3595 MaybeObject* Heap::AllocateExternalStringFromAscii( |
3596 const ExternalAsciiString::Resource* resource) { | 3596 const ExternalAsciiString::Resource* resource) { |
3597 size_t length = resource->length(); | 3597 size_t length = resource->length(); |
3598 if (length > static_cast<size_t>(String::kMaxLength)) { | 3598 if (length > static_cast<size_t>(String::kMaxLength)) { |
3599 isolate()->context()->mark_out_of_memory(); | 3599 isolate()->context()->mark_out_of_memory(); |
3600 return Failure::OutOfMemoryException(0x5); | 3600 return Failure::OutOfMemoryException(0x5); |
3601 } | 3601 } |
3602 | 3602 |
| 3603 #ifndef ENABLE_LATIN_1 |
3603 ASSERT(String::IsAscii(resource->data(), static_cast<int>(length))); | 3604 ASSERT(String::IsAscii(resource->data(), static_cast<int>(length))); |
| 3605 #endif // ENABLE_LATIN_1 |
3604 | 3606 |
3605 Map* map = external_ascii_string_map(); | 3607 Map* map = external_ascii_string_map(); |
3606 Object* result; | 3608 Object* result; |
3607 { MaybeObject* maybe_result = Allocate(map, NEW_SPACE); | 3609 { MaybeObject* maybe_result = Allocate(map, NEW_SPACE); |
3608 if (!maybe_result->ToObject(&result)) return maybe_result; | 3610 if (!maybe_result->ToObject(&result)) return maybe_result; |
3609 } | 3611 } |
3610 | 3612 |
3611 ExternalAsciiString* external_string = ExternalAsciiString::cast(result); | 3613 ExternalAsciiString* external_string = ExternalAsciiString::cast(result); |
3612 external_string->set_length(static_cast<int>(length)); | 3614 external_string->set_length(static_cast<int>(length)); |
3613 external_string->set_hash_field(String::kEmptyHashField); | 3615 external_string->set_hash_field(String::kEmptyHashField); |
(...skipping 3923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7537 static_cast<int>(object_sizes_last_time_[index])); | 7539 static_cast<int>(object_sizes_last_time_[index])); |
7538 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7540 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7539 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7541 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7540 | 7542 |
7541 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7543 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7542 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7544 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7543 ClearObjectStats(); | 7545 ClearObjectStats(); |
7544 } | 7546 } |
7545 | 7547 |
7546 } } // namespace v8::internal | 7548 } } // namespace v8::internal |
OLD | NEW |