OLD | NEW |
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 Loading... |
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 Loading... |
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_ |
OLD | NEW |