Commit 59d4539f authored by ager@chromium.org's avatar ager@chromium.org

If an external string enters the symbol table, make sure to set the

resource to NULL when removing it from the symbol table.  This makes
sure that the debugger can recognize the external string as being
"deleted".  Now, whenever an external resource is deleted, the
resource pointer is set to NULL.

This is really a workaround of a debugger problem.  We need to make
sure that the debugger only finds scripts in the heap that are
actually live.
Review URL: http://codereview.chromium.org/69029

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1734 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 82ac3f30
......@@ -404,15 +404,19 @@ class SymbolTableCleaner : public ObjectVisitor {
ExternalString::kResourceOffset -
kHeapObjectTag;
if (is_two_byte) {
v8::String::ExternalStringResource* resource =
*reinterpret_cast<v8::String::ExternalStringResource**>
v8::String::ExternalStringResource** resource =
reinterpret_cast<v8::String::ExternalStringResource**>
(resource_addr);
delete resource;
delete *resource;
// Clear the resource pointer in the symbol.
*resource = NULL;
} else {
v8::String::ExternalAsciiStringResource* resource =
*reinterpret_cast<v8::String::ExternalAsciiStringResource**>
v8::String::ExternalAsciiStringResource** resource =
reinterpret_cast<v8::String::ExternalAsciiStringResource**>
(resource_addr);
delete resource;
delete *resource;
// Clear the resource pointer in the symbol.
*resource = NULL;
}
}
// Set the entry to null_value (as deleted).
......
......@@ -263,8 +263,7 @@ bool StringShape::IsSequentialAscii() {
bool StringShape::IsSequentialTwoByte() {
return (type_ & (kStringRepresentationMask | kStringEncodingMask)) ==
(kSeqStringTag | kTwoByteStringTag);
return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag);
}
......@@ -274,8 +273,7 @@ bool StringShape::IsExternalAscii() {
bool StringShape::IsExternalTwoByte() {
return (type_ & (kStringRepresentationMask | kStringEncodingMask)) ==
(kExternalStringTag | kTwoByteStringTag);
return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag);
}
......
......@@ -3593,7 +3593,7 @@ void ExternalTwoByteString::ExternalTwoByteStringReadBlockIntoBuffer(
while (chars_read < max_chars) {
uint16_t c = data[offset];
if (c <= kMaxAsciiCharCode) {
// Fast case for ASCII characters. Cursor is an input output argument.
// Fast case for ASCII characters. Cursor is an input output argument.
if (!unibrow::CharacterStream::EncodeAsciiCharacter(c,
rbb->util_buffer,
rbb->capacity,
......
......@@ -6525,9 +6525,9 @@ static bool IsExternalStringValid(Object* str) {
return true;
}
if (StringShape(String::cast(str)).IsAsciiRepresentation()) {
return ExternalAsciiString::cast(str)->resource() != 0;
return ExternalAsciiString::cast(str)->resource() != NULL;
} else if (StringShape(String::cast(str)).IsTwoByteRepresentation()) {
return ExternalTwoByteString::cast(str)->resource() != 0;
return ExternalTwoByteString::cast(str)->resource() != NULL;
} else {
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment