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

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

Issue 10918169: Refactored fast external string resource getter. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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/api.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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 bool StringShape::IsSequentialTwoByte() { 391 bool StringShape::IsSequentialTwoByte() {
392 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag); 392 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag);
393 } 393 }
394 394
395 395
396 bool StringShape::IsExternalAscii() { 396 bool StringShape::IsExternalAscii() {
397 return full_representation_tag() == (kExternalStringTag | kAsciiStringTag); 397 return full_representation_tag() == (kExternalStringTag | kAsciiStringTag);
398 } 398 }
399 399
400 400
401 STATIC_CHECK((kExternalStringTag | kAsciiStringTag) ==
402 Internals::kExternalAsciiRepresentationTag);
403
404 STATIC_CHECK(v8::String::kExternalAsciiStringType ==
405 Internals::kExternalAsciiRepresentationTag);
406
407
401 bool StringShape::IsExternalTwoByte() { 408 bool StringShape::IsExternalTwoByte() {
402 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag); 409 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag);
403 } 410 }
404 411
405 412
406 STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) == 413 STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) ==
407 Internals::kExternalTwoByteRepresentationTag); 414 Internals::kExternalTwoByteRepresentationTag);
408 415
416 STATIC_CHECK(v8::String::kExternalTwoByteStringType ==
417 Internals::kExternalTwoByteRepresentationTag);
409 418
410 uc32 FlatStringReader::Get(int index) { 419 uc32 FlatStringReader::Get(int index) {
411 ASSERT(0 <= index && index <= length_); 420 ASSERT(0 <= index && index <= length_);
412 if (is_ascii_) { 421 if (is_ascii_) {
413 return static_cast<const byte*>(start_)[index]; 422 return static_cast<const byte*>(start_)[index];
414 } else { 423 } else {
415 return static_cast<const uc16*>(start_)[index]; 424 return static_cast<const uc16*>(start_)[index];
416 } 425 }
417 } 426 }
418 427
(...skipping 5007 matching lines...) Expand 10 before | Expand all | Expand 10 after
5426 #undef WRITE_UINT32_FIELD 5435 #undef WRITE_UINT32_FIELD
5427 #undef READ_SHORT_FIELD 5436 #undef READ_SHORT_FIELD
5428 #undef WRITE_SHORT_FIELD 5437 #undef WRITE_SHORT_FIELD
5429 #undef READ_BYTE_FIELD 5438 #undef READ_BYTE_FIELD
5430 #undef WRITE_BYTE_FIELD 5439 #undef WRITE_BYTE_FIELD
5431 5440
5432 5441
5433 } } // namespace v8::internal 5442 } } // namespace v8::internal
5434 5443
5435 #endif // V8_OBJECTS_INL_H_ 5444 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698