Reviewers: Michael Starzinger,
Message:
This fixes some GC stress failures.
Description:
Fix assertion failure caused by external strings.
This fixes two issues:
- Update externalize-string-extension to the behavior of the API (see
r18285)
- Convert cons strings in old pointer space to short external strings as
expected by Heap::AllowedToBeMigrated, regardless of alignment.
BUG=
Please review this at https://codereview.chromium.org/189663011/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+8, -10 lines):
M src/extensions/externalize-string-extension.cc
M src/objects.cc
Index: src/extensions/externalize-string-extension.cc
diff --git a/src/extensions/externalize-string-extension.cc
b/src/extensions/externalize-string-extension.cc
index
d372cf012577102eef6309065b6676984c5c18fb..adc5577d9e5adf30491b078271c1b7e6afe69697
100644
--- a/src/extensions/externalize-string-extension.cc
+++ b/src/extensions/externalize-string-extension.cc
@@ -107,7 +107,7 @@ void ExternalizeStringExtension::Externalize(
SimpleAsciiStringResource* resource = new SimpleAsciiStringResource(
reinterpret_cast<char*>(data), string->length());
result = string->MakeExternal(resource);
- if (result && !string->IsInternalizedString()) {
+ if (result) {
i::Isolate* isolate =
reinterpret_cast<i::Isolate*>(args.GetIsolate());
isolate->heap()->external_string_table()->AddString(*string);
}
@@ -118,7 +118,7 @@ void ExternalizeStringExtension::Externalize(
SimpleTwoByteStringResource* resource = new
SimpleTwoByteStringResource(
data, string->length());
result = string->MakeExternal(resource);
- if (result && !string->IsInternalizedString()) {
+ if (result) {
i::Isolate* isolate =
reinterpret_cast<i::Isolate*>(args.GetIsolate());
isolate->heap()->external_string_table()->AddString(*string);
}
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
fc12cf96b338ced038a69c6a93b8e1265146485c..1ee13252b6d9539efef628349e128d2fd841c191
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -1280,14 +1280,13 @@ bool
String::MakeExternal(v8::String::ExternalStringResource* resource) {
// - the space the existing string occupies is too small for a regular
// external string.
// - the existing string is in old pointer space and the backing store of
- // the external string is not aligned. The GC cannot deal with fields
- // containing an unaligned address that points to outside of V8's heap.
+ // the external string is not aligned. The GC cannot deal with a field
+ // containing a possibly unaligned address to outside of V8's heap.
// In either case we resort to a short external string instead, omitting
// the field caching the address of the backing store. When we encounter
// short external strings in generated code, we need to bailout to
runtime.
if (size < ExternalString::kSize ||
- (!IsAligned(reinterpret_cast<intptr_t>(resource->data()),
kPointerSize) &&
- heap->old_pointer_space()->Contains(this))) {
+ heap->old_pointer_space()->Contains(this)) {
this->set_map_no_write_barrier(
is_internalized
? (is_ascii
@@ -1351,14 +1350,13 @@ bool
String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) {
// - the space the existing string occupies is too small for a regular
// external string.
// - the existing string is in old pointer space and the backing store of
- // the external string is not aligned. The GC cannot deal with fields
- // containing an unaligned address that points to outside of V8's heap.
+ // the external string is not aligned. The GC cannot deal with a field
+ // containing a possibly unaligned address to outside of V8's heap.
// In either case we resort to a short external string instead, omitting
// the field caching the address of the backing store. When we encounter
// short external strings in generated code, we need to bailout to
runtime.
if (size < ExternalString::kSize ||
- (!IsAligned(reinterpret_cast<intptr_t>(resource->data()),
kPointerSize) &&
- heap->old_pointer_space()->Contains(this))) {
+ heap->old_pointer_space()->Contains(this)) {
this->set_map_no_write_barrier(
is_internalized ?
heap->short_external_ascii_internalized_string_map()
: heap->short_external_ascii_string_map());
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.