Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: src/heap.cc

Issue 12700008: remove latin-1 flag (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: removed SeqOneByteStringVerify Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/heap-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3578 matching lines...) Expand 10 before | Expand all | Expand 10 after
3589 3589
3590 3590
3591 MaybeObject* Heap::AllocateExternalStringFromAscii( 3591 MaybeObject* Heap::AllocateExternalStringFromAscii(
3592 const ExternalAsciiString::Resource* resource) { 3592 const ExternalAsciiString::Resource* resource) {
3593 size_t length = resource->length(); 3593 size_t length = resource->length();
3594 if (length > static_cast<size_t>(String::kMaxLength)) { 3594 if (length > static_cast<size_t>(String::kMaxLength)) {
3595 isolate()->context()->mark_out_of_memory(); 3595 isolate()->context()->mark_out_of_memory();
3596 return Failure::OutOfMemoryException(0x5); 3596 return Failure::OutOfMemoryException(0x5);
3597 } 3597 }
3598 3598
3599 #ifndef ENABLE_LATIN_1
3600 ASSERT(String::IsAscii(resource->data(), static_cast<int>(length)));
3601 #endif // ENABLE_LATIN_1
3602
3603 Map* map = external_ascii_string_map(); 3599 Map* map = external_ascii_string_map();
3604 Object* result; 3600 Object* result;
3605 { MaybeObject* maybe_result = Allocate(map, NEW_SPACE); 3601 { MaybeObject* maybe_result = Allocate(map, NEW_SPACE);
3606 if (!maybe_result->ToObject(&result)) return maybe_result; 3602 if (!maybe_result->ToObject(&result)) return maybe_result;
3607 } 3603 }
3608 3604
3609 ExternalAsciiString* external_string = ExternalAsciiString::cast(result); 3605 ExternalAsciiString* external_string = ExternalAsciiString::cast(result);
3610 external_string->set_length(static_cast<int>(length)); 3606 external_string->set_length(static_cast<int>(length));
3611 external_string->set_hash_field(String::kEmptyHashField); 3607 external_string->set_hash_field(String::kEmptyHashField);
3612 external_string->set_resource(resource); 3608 external_string->set_resource(resource);
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
5071 { MaybeObject* maybe_result = AllocateRaw(size, space, retry_space); 5067 { MaybeObject* maybe_result = AllocateRaw(size, space, retry_space);
5072 if (!maybe_result->ToObject(&result)) return maybe_result; 5068 if (!maybe_result->ToObject(&result)) return maybe_result;
5073 } 5069 }
5074 5070
5075 // Partially initialize the object. 5071 // Partially initialize the object.
5076 HeapObject::cast(result)->set_map_no_write_barrier(ascii_string_map()); 5072 HeapObject::cast(result)->set_map_no_write_barrier(ascii_string_map());
5077 String::cast(result)->set_length(length); 5073 String::cast(result)->set_length(length);
5078 String::cast(result)->set_hash_field(String::kEmptyHashField); 5074 String::cast(result)->set_hash_field(String::kEmptyHashField);
5079 ASSERT_EQ(size, HeapObject::cast(result)->Size()); 5075 ASSERT_EQ(size, HeapObject::cast(result)->Size());
5080 5076
5081 #ifndef ENABLE_LATIN_1
5082 #ifdef VERIFY_HEAP
5083 if (FLAG_verify_heap) {
5084 // Initialize string's content to ensure ASCII-ness (character range 0-127)
5085 // as required when verifying the heap.
5086 uint8_t* dest = SeqOneByteString::cast(result)->GetChars();
5087 memset(dest, 0x0F, length * kCharSize);
5088 }
5089 #endif
5090 #endif
5091
5092 return result; 5077 return result;
5093 } 5078 }
5094 5079
5095 5080
5096 MaybeObject* Heap::AllocateRawTwoByteString(int length, 5081 MaybeObject* Heap::AllocateRawTwoByteString(int length,
5097 PretenureFlag pretenure) { 5082 PretenureFlag pretenure) {
5098 if (length < 0 || length > SeqTwoByteString::kMaxLength) { 5083 if (length < 0 || length > SeqTwoByteString::kMaxLength) {
5099 return Failure::OutOfMemoryException(0xc); 5084 return Failure::OutOfMemoryException(0xc);
5100 } 5085 }
5101 int size = SeqTwoByteString::SizeFor(length); 5086 int size = SeqTwoByteString::SizeFor(length);
(...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after
7825 static_cast<int>(object_sizes_last_time_[index])); 7810 static_cast<int>(object_sizes_last_time_[index]));
7826 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7811 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7827 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7812 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7828 7813
7829 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7814 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7830 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7815 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7831 ClearObjectStats(); 7816 ClearObjectStats();
7832 } 7817 }
7833 7818
7834 } } // namespace v8::internal 7819 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698