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

Side by Side Diff: src/objects.cc

Issue 189663011: Fix assertion failure caused by external strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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/extensions/externalize-string-extension.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 return false; 1273 return false;
1274 } 1274 }
1275 bool is_ascii = this->IsOneByteRepresentation(); 1275 bool is_ascii = this->IsOneByteRepresentation();
1276 bool is_internalized = this->IsInternalizedString(); 1276 bool is_internalized = this->IsInternalizedString();
1277 1277
1278 // Morph the string to an external string by replacing the map and 1278 // Morph the string to an external string by replacing the map and
1279 // reinitializing the fields. This won't work if 1279 // reinitializing the fields. This won't work if
1280 // - the space the existing string occupies is too small for a regular 1280 // - the space the existing string occupies is too small for a regular
1281 // external string. 1281 // external string.
1282 // - the existing string is in old pointer space and the backing store of 1282 // - the existing string is in old pointer space and the backing store of
1283 // the external string is not aligned. The GC cannot deal with fields 1283 // the external string is not aligned. The GC cannot deal with a field
1284 // containing an unaligned address that points to outside of V8's heap. 1284 // containing a possibly unaligned address to outside of V8's heap.
1285 // In either case we resort to a short external string instead, omitting 1285 // In either case we resort to a short external string instead, omitting
1286 // the field caching the address of the backing store. When we encounter 1286 // the field caching the address of the backing store. When we encounter
1287 // short external strings in generated code, we need to bailout to runtime. 1287 // short external strings in generated code, we need to bailout to runtime.
1288 if (size < ExternalString::kSize || 1288 if (size < ExternalString::kSize ||
1289 (!IsAligned(reinterpret_cast<intptr_t>(resource->data()), kPointerSize) && 1289 heap->old_pointer_space()->Contains(this)) {
1290 heap->old_pointer_space()->Contains(this))) {
1291 this->set_map_no_write_barrier( 1290 this->set_map_no_write_barrier(
1292 is_internalized 1291 is_internalized
1293 ? (is_ascii 1292 ? (is_ascii
1294 ? heap-> 1293 ? heap->
1295 short_external_internalized_string_with_one_byte_data_map() 1294 short_external_internalized_string_with_one_byte_data_map()
1296 : heap->short_external_internalized_string_map()) 1295 : heap->short_external_internalized_string_map())
1297 : (is_ascii 1296 : (is_ascii
1298 ? heap->short_external_string_with_one_byte_data_map() 1297 ? heap->short_external_string_with_one_byte_data_map()
1299 : heap->short_external_string_map())); 1298 : heap->short_external_string_map()));
1300 } else { 1299 } else {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 if (size < ExternalString::kShortSize) { 1343 if (size < ExternalString::kShortSize) {
1345 return false; 1344 return false;
1346 } 1345 }
1347 bool is_internalized = this->IsInternalizedString(); 1346 bool is_internalized = this->IsInternalizedString();
1348 1347
1349 // Morph the string to an external string by replacing the map and 1348 // Morph the string to an external string by replacing the map and
1350 // reinitializing the fields. This won't work if 1349 // reinitializing the fields. This won't work if
1351 // - the space the existing string occupies is too small for a regular 1350 // - the space the existing string occupies is too small for a regular
1352 // external string. 1351 // external string.
1353 // - the existing string is in old pointer space and the backing store of 1352 // - the existing string is in old pointer space and the backing store of
1354 // the external string is not aligned. The GC cannot deal with fields 1353 // the external string is not aligned. The GC cannot deal with a field
1355 // containing an unaligned address that points to outside of V8's heap. 1354 // containing a possibly unaligned address to outside of V8's heap.
1356 // In either case we resort to a short external string instead, omitting 1355 // In either case we resort to a short external string instead, omitting
1357 // the field caching the address of the backing store. When we encounter 1356 // the field caching the address of the backing store. When we encounter
1358 // short external strings in generated code, we need to bailout to runtime. 1357 // short external strings in generated code, we need to bailout to runtime.
1359 if (size < ExternalString::kSize || 1358 if (size < ExternalString::kSize ||
1360 (!IsAligned(reinterpret_cast<intptr_t>(resource->data()), kPointerSize) && 1359 heap->old_pointer_space()->Contains(this)) {
1361 heap->old_pointer_space()->Contains(this))) {
1362 this->set_map_no_write_barrier( 1360 this->set_map_no_write_barrier(
1363 is_internalized ? heap->short_external_ascii_internalized_string_map() 1361 is_internalized ? heap->short_external_ascii_internalized_string_map()
1364 : heap->short_external_ascii_string_map()); 1362 : heap->short_external_ascii_string_map());
1365 } else { 1363 } else {
1366 this->set_map_no_write_barrier( 1364 this->set_map_no_write_barrier(
1367 is_internalized ? heap->external_ascii_internalized_string_map() 1365 is_internalized ? heap->external_ascii_internalized_string_map()
1368 : heap->external_ascii_string_map()); 1366 : heap->external_ascii_string_map());
1369 } 1367 }
1370 ExternalAsciiString* self = ExternalAsciiString::cast(this); 1368 ExternalAsciiString* self = ExternalAsciiString::cast(this);
1371 self->set_resource(resource); 1369 self->set_resource(resource);
(...skipping 15129 matching lines...) Expand 10 before | Expand all | Expand 10 after
16501 #define ERROR_MESSAGES_TEXTS(C, T) T, 16499 #define ERROR_MESSAGES_TEXTS(C, T) T,
16502 static const char* error_messages_[] = { 16500 static const char* error_messages_[] = {
16503 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16501 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16504 }; 16502 };
16505 #undef ERROR_MESSAGES_TEXTS 16503 #undef ERROR_MESSAGES_TEXTS
16506 return error_messages_[reason]; 16504 return error_messages_[reason];
16507 } 16505 }
16508 16506
16509 16507
16510 } } // namespace v8::internal 16508 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/extensions/externalize-string-extension.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698