Author: [email protected]
Date: Fri Apr 17 02:17:04 2009
New Revision: 1734
Modified:
branches/bleeding_edge/src/mark-compact.cc
branches/bleeding_edge/src/objects-inl.h
branches/bleeding_edge/src/objects.cc
branches/bleeding_edge/src/runtime.cc
Log:
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
Modified: branches/bleeding_edge/src/mark-compact.cc
==============================================================================
--- branches/bleeding_edge/src/mark-compact.cc (original)
+++ branches/bleeding_edge/src/mark-compact.cc Fri Apr 17 02:17:04 2009
@@ -404,15 +404,19 @@
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).
Modified: branches/bleeding_edge/src/objects-inl.h
==============================================================================
--- branches/bleeding_edge/src/objects-inl.h (original)
+++ branches/bleeding_edge/src/objects-inl.h Fri Apr 17 02:17:04 2009
@@ -263,8 +263,7 @@
bool StringShape::IsSequentialTwoByte() {
- return (type_ & (kStringRepresentationMask | kStringEncodingMask)) ==
- (kSeqStringTag | kTwoByteStringTag);
+ return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag);
}
@@ -274,8 +273,7 @@
bool StringShape::IsExternalTwoByte() {
- return (type_ & (kStringRepresentationMask | kStringEncodingMask)) ==
- (kExternalStringTag | kTwoByteStringTag);
+ return full_representation_tag() == (kExternalStringTag |
kTwoByteStringTag);
}
Modified: branches/bleeding_edge/src/objects.cc
==============================================================================
--- branches/bleeding_edge/src/objects.cc (original)
+++ branches/bleeding_edge/src/objects.cc Fri Apr 17 02:17:04 2009
@@ -3593,7 +3593,7 @@
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,
Modified: branches/bleeding_edge/src/runtime.cc
==============================================================================
--- branches/bleeding_edge/src/runtime.cc (original)
+++ branches/bleeding_edge/src/runtime.cc Fri Apr 17 02:17:04 2009
@@ -6525,9 +6525,9 @@
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;
}
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---