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

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

Issue 8551006: Version 3.7.9. (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/parser.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 return READ_FIELD(this, kSecondOffset); 2290 return READ_FIELD(this, kSecondOffset);
2291 } 2291 }
2292 2292
2293 2293
2294 void ConsString::set_second(String* value, WriteBarrierMode mode) { 2294 void ConsString::set_second(String* value, WriteBarrierMode mode) {
2295 WRITE_FIELD(this, kSecondOffset, value); 2295 WRITE_FIELD(this, kSecondOffset, value);
2296 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kSecondOffset, value, mode); 2296 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kSecondOffset, value, mode);
2297 } 2297 }
2298 2298
2299 2299
2300 void ExternalString::clear_data_cache() {
2301 WRITE_INTPTR_FIELD(this, kResourceDataOffset, 0);
2302 }
2303
2304
2300 const ExternalAsciiString::Resource* ExternalAsciiString::resource() { 2305 const ExternalAsciiString::Resource* ExternalAsciiString::resource() {
2301 return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)); 2306 return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset));
2302 } 2307 }
2303 2308
2304 2309
2305 void ExternalAsciiString::set_resource( 2310 void ExternalAsciiString::set_resource(
2306 const ExternalAsciiString::Resource* resource) { 2311 const ExternalAsciiString::Resource* resource) {
2307 *reinterpret_cast<const Resource**>( 2312 *reinterpret_cast<const Resource**>(
2308 FIELD_ADDR(this, kResourceOffset)) = resource; 2313 FIELD_ADDR(this, kResourceOffset)) = resource;
2314 clear_data_cache();
2315 }
2316
2317
2318 const char* ExternalAsciiString::GetChars() {
2319 const char** data_field =
2320 reinterpret_cast<const char**>(FIELD_ADDR(this, kResourceDataOffset));
2321 if (*data_field == NULL) *data_field = resource()->data();
2322 return *data_field;
2323 }
2324
2325
2326 uint16_t ExternalAsciiString::ExternalAsciiStringGet(int index) {
2327 ASSERT(index >= 0 && index < length());
2328 return GetChars()[index];
2309 } 2329 }
2310 2330
2311 2331
2312 const ExternalTwoByteString::Resource* ExternalTwoByteString::resource() { 2332 const ExternalTwoByteString::Resource* ExternalTwoByteString::resource() {
2313 return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)); 2333 return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset));
2314 } 2334 }
2315 2335
2316 2336
2317 void ExternalTwoByteString::set_resource( 2337 void ExternalTwoByteString::set_resource(
2318 const ExternalTwoByteString::Resource* resource) { 2338 const ExternalTwoByteString::Resource* resource) {
2319 *reinterpret_cast<const Resource**>( 2339 *reinterpret_cast<const Resource**>(
2320 FIELD_ADDR(this, kResourceOffset)) = resource; 2340 FIELD_ADDR(this, kResourceOffset)) = resource;
2341 clear_data_cache();
2342 }
2343
2344
2345 const uint16_t* ExternalTwoByteString::GetChars() {
2346 const uint16_t** data_field =
2347 reinterpret_cast<const uint16_t**>(FIELD_ADDR(this, kResourceDataOffset));
2348 if (*data_field == NULL) *data_field = resource()->data();
2349 return *data_field;
2350 }
2351
2352
2353 uint16_t ExternalTwoByteString::ExternalTwoByteStringGet(int index) {
2354 ASSERT(index >= 0 && index < length());
2355 return GetChars()[index];
2356 }
2357
2358
2359 const uint16_t* ExternalTwoByteString::ExternalTwoByteStringGetData(
2360 unsigned start) {
2361 return GetChars() + start;
2321 } 2362 }
2322 2363
2323 2364
2324 void JSFunctionResultCache::MakeZeroSize() { 2365 void JSFunctionResultCache::MakeZeroSize() {
2325 set_finger_index(kEntriesIndex); 2366 set_finger_index(kEntriesIndex);
2326 set_size(kEntriesIndex); 2367 set_size(kEntriesIndex);
2327 } 2368 }
2328 2369
2329 2370
2330 void JSFunctionResultCache::Clear() { 2371 void JSFunctionResultCache::Clear() {
(...skipping 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after
4628 #undef WRITE_INT_FIELD 4669 #undef WRITE_INT_FIELD
4629 #undef READ_SHORT_FIELD 4670 #undef READ_SHORT_FIELD
4630 #undef WRITE_SHORT_FIELD 4671 #undef WRITE_SHORT_FIELD
4631 #undef READ_BYTE_FIELD 4672 #undef READ_BYTE_FIELD
4632 #undef WRITE_BYTE_FIELD 4673 #undef WRITE_BYTE_FIELD
4633 4674
4634 4675
4635 } } // namespace v8::internal 4676 } } // namespace v8::internal
4636 4677
4637 #endif // V8_OBJECTS_INL_H_ 4678 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698