Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(809)

Unified Diff: src/objects-inl.h

Issue 8681007: Rolling back r10049 due to webkit failures. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 8ef4f3c9d7dd803ead0bc7e3bd9cabc04ae120e5..f3a7fd3ce72bf9feeeba4c58f0fd4280abde914b 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2297,9 +2297,8 @@ void ConsString::set_second(String* value, WriteBarrierMode mode) {
}
-bool ExternalString::is_short() {
- InstanceType type = map()->instance_type();
- return (type & kShortExternalStringMask) == kShortExternalStringTag;
+void ExternalString::clear_data_cache() {
+ WRITE_INTPTR_FIELD(this, kResourceDataOffset, 0);
}
@@ -2308,24 +2307,19 @@ const ExternalAsciiString::Resource* ExternalAsciiString::resource() {
}
-void ExternalAsciiString::update_data_cache() {
- if (is_short()) return;
- const char** data_field =
- reinterpret_cast<const char**>(FIELD_ADDR(this, kResourceDataOffset));
- *data_field = resource()->data();
-}
-
-
void ExternalAsciiString::set_resource(
const ExternalAsciiString::Resource* resource) {
*reinterpret_cast<const Resource**>(
FIELD_ADDR(this, kResourceOffset)) = resource;
- if (resource != NULL) update_data_cache();
+ clear_data_cache();
}
const char* ExternalAsciiString::GetChars() {
- return resource()->data();
+ const char** data_field =
+ reinterpret_cast<const char**>(FIELD_ADDR(this, kResourceDataOffset));
+ if (*data_field == NULL) *data_field = resource()->data();
+ return *data_field;
}
@@ -2340,24 +2334,19 @@ const ExternalTwoByteString::Resource* ExternalTwoByteString::resource() {
}
-void ExternalTwoByteString::update_data_cache() {
- if (is_short()) return;
- const uint16_t** data_field =
- reinterpret_cast<const uint16_t**>(FIELD_ADDR(this, kResourceDataOffset));
- *data_field = resource()->data();
-}
-
-
void ExternalTwoByteString::set_resource(
const ExternalTwoByteString::Resource* resource) {
*reinterpret_cast<const Resource**>(
FIELD_ADDR(this, kResourceOffset)) = resource;
- if (resource != NULL) update_data_cache();
+ clear_data_cache();
}
const uint16_t* ExternalTwoByteString::GetChars() {
- return resource()->data();
+ 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;
}
« no previous file with comments | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698