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

Side by Side Diff: src/objects-inl.h

Issue 146183006: Allow externalizing strings in old pointer space. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Also fix two-byte String::MakeExternal Created 6 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 void ExternalAsciiString::update_data_cache() { 3186 void ExternalAsciiString::update_data_cache() {
3187 if (is_short()) return; 3187 if (is_short()) return;
3188 const char** data_field = 3188 const char** data_field =
3189 reinterpret_cast<const char**>(FIELD_ADDR(this, kResourceDataOffset)); 3189 reinterpret_cast<const char**>(FIELD_ADDR(this, kResourceDataOffset));
3190 *data_field = resource()->data(); 3190 *data_field = resource()->data();
3191 } 3191 }
3192 3192
3193 3193
3194 void ExternalAsciiString::set_resource( 3194 void ExternalAsciiString::set_resource(
3195 const ExternalAsciiString::Resource* resource) { 3195 const ExternalAsciiString::Resource* resource) {
3196 ASSERT(IsAligned(reinterpret_cast<intptr_t>(resource), kPointerSize));
3196 *reinterpret_cast<const Resource**>( 3197 *reinterpret_cast<const Resource**>(
3197 FIELD_ADDR(this, kResourceOffset)) = resource; 3198 FIELD_ADDR(this, kResourceOffset)) = resource;
3198 if (resource != NULL) update_data_cache(); 3199 if (resource != NULL) update_data_cache();
3199 } 3200 }
3200 3201
3201 3202
3202 const uint8_t* ExternalAsciiString::GetChars() { 3203 const uint8_t* ExternalAsciiString::GetChars() {
3203 return reinterpret_cast<const uint8_t*>(resource()->data()); 3204 return reinterpret_cast<const uint8_t*>(resource()->data());
3204 } 3205 }
3205 3206
(...skipping 3575 matching lines...) Expand 10 before | Expand all | Expand 10 after
6781 #undef READ_UINT32_FIELD 6782 #undef READ_UINT32_FIELD
6782 #undef WRITE_UINT32_FIELD 6783 #undef WRITE_UINT32_FIELD
6783 #undef READ_SHORT_FIELD 6784 #undef READ_SHORT_FIELD
6784 #undef WRITE_SHORT_FIELD 6785 #undef WRITE_SHORT_FIELD
6785 #undef READ_BYTE_FIELD 6786 #undef READ_BYTE_FIELD
6786 #undef WRITE_BYTE_FIELD 6787 #undef WRITE_BYTE_FIELD
6787 6788
6788 } } // namespace v8::internal 6789 } } // namespace v8::internal
6789 6790
6790 #endif // V8_OBJECTS_INL_H_ 6791 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698