Index: src/objects-inl.h |
=================================================================== |
--- src/objects-inl.h (revision 10035) |
+++ src/objects-inl.h (working copy) |
@@ -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,9 +2311,24 @@ |
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]; |
+} |
+ |
+ |
const ExternalTwoByteString::Resource* ExternalTwoByteString::resource() { |
return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)); |
} |
@@ -2318,9 +2338,30 @@ |
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; |
+} |
+ |
+ |
void JSFunctionResultCache::MakeZeroSize() { |
set_finger_index(kEntriesIndex); |
set_size(kEntriesIndex); |