Version 3.7.9.
Removed exit-time destructors.
Stability and performance improvements on all platforms.
Review URL: http://codereview.chromium.org/8551006
git-svn-id: http://v8.googlecode.com/svn/trunk@10037 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 11819ea..9da480e 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2297,6 +2297,11 @@
}
+void ExternalString::clear_data_cache() {
+ WRITE_INTPTR_FIELD(this, kResourceDataOffset, 0);
+}
+
+
const ExternalAsciiString::Resource* ExternalAsciiString::resource() {
return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset));
}
@@ -2306,6 +2311,21 @@
const ExternalAsciiString::Resource* resource) {
*reinterpret_cast<const Resource**>(
FIELD_ADDR(this, kResourceOffset)) = resource;
+ clear_data_cache();
+}
+
+
+const char* ExternalAsciiString::GetChars() {
+ const char** data_field =
+ reinterpret_cast<const char**>(FIELD_ADDR(this, kResourceDataOffset));
+ if (*data_field == NULL) *data_field = resource()->data();
+ return *data_field;
+}
+
+
+uint16_t ExternalAsciiString::ExternalAsciiStringGet(int index) {
+ ASSERT(index >= 0 && index < length());
+ return GetChars()[index];
}
@@ -2318,6 +2338,27 @@
const ExternalTwoByteString::Resource* resource) {
*reinterpret_cast<const Resource**>(
FIELD_ADDR(this, kResourceOffset)) = resource;
+ clear_data_cache();
+}
+
+
+const uint16_t* ExternalTwoByteString::GetChars() {
+ const uint16_t** data_field =
+ reinterpret_cast<const uint16_t**>(FIELD_ADDR(this, kResourceDataOffset));
+ if (*data_field == NULL) *data_field = resource()->data();
+ return *data_field;
+}
+
+
+uint16_t ExternalTwoByteString::ExternalTwoByteStringGet(int index) {
+ ASSERT(index >= 0 && index < length());
+ return GetChars()[index];
+}
+
+
+const uint16_t* ExternalTwoByteString::ExternalTwoByteStringGetData(
+ unsigned start) {
+ return GetChars() + start;
}