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 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3319 | 3319 |
3320 | 3320 |
3321 MaybeObject* Heap::AllocateExternalStringFromAscii( | 3321 MaybeObject* Heap::AllocateExternalStringFromAscii( |
3322 const ExternalAsciiString::Resource* resource) { | 3322 const ExternalAsciiString::Resource* resource) { |
3323 size_t length = resource->length(); | 3323 size_t length = resource->length(); |
3324 if (length > static_cast<size_t>(String::kMaxLength)) { | 3324 if (length > static_cast<size_t>(String::kMaxLength)) { |
3325 isolate()->context()->mark_out_of_memory(); | 3325 isolate()->context()->mark_out_of_memory(); |
3326 return Failure::OutOfMemoryException(); | 3326 return Failure::OutOfMemoryException(); |
3327 } | 3327 } |
3328 | 3328 |
3329 ASSERT(String::IsAscii(resource->data(), length)); | 3329 ASSERT(String::IsAscii(resource->data(), static_cast<int>(length))); |
3330 | 3330 |
3331 Map* map = external_ascii_string_map(); | 3331 Map* map = external_ascii_string_map(); |
3332 Object* result; | 3332 Object* result; |
3333 { MaybeObject* maybe_result = Allocate(map, NEW_SPACE); | 3333 { MaybeObject* maybe_result = Allocate(map, NEW_SPACE); |
3334 if (!maybe_result->ToObject(&result)) return maybe_result; | 3334 if (!maybe_result->ToObject(&result)) return maybe_result; |
3335 } | 3335 } |
3336 | 3336 |
3337 ExternalAsciiString* external_string = ExternalAsciiString::cast(result); | 3337 ExternalAsciiString* external_string = ExternalAsciiString::cast(result); |
3338 external_string->set_length(static_cast<int>(length)); | 3338 external_string->set_length(static_cast<int>(length)); |
3339 external_string->set_hash_field(String::kEmptyHashField); | 3339 external_string->set_hash_field(String::kEmptyHashField); |
(...skipping 3804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7144 } else { | 7144 } else { |
7145 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. | 7145 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. |
7146 } | 7146 } |
7147 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = | 7147 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = |
7148 reinterpret_cast<Address>(p); | 7148 reinterpret_cast<Address>(p); |
7149 remembered_unmapped_pages_index_++; | 7149 remembered_unmapped_pages_index_++; |
7150 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; | 7150 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; |
7151 } | 7151 } |
7152 | 7152 |
7153 } } // namespace v8::internal | 7153 } } // namespace v8::internal |
OLD | NEW |