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

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

Issue 153803003: Correctly recognize external strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 bool StringShape::IsSequentialTwoByte() { 426 bool StringShape::IsSequentialTwoByte() {
427 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag); 427 return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag);
428 } 428 }
429 429
430 430
431 bool StringShape::IsExternalAscii() { 431 bool StringShape::IsExternalAscii() {
432 return full_representation_tag() == (kExternalStringTag | kOneByteStringTag); 432 return full_representation_tag() == (kExternalStringTag | kOneByteStringTag);
433 } 433 }
434 434
435 435
436 STATIC_CHECK((kExternalStringTag | kOneByteStringTag) ==
437 Internals::kExternalAsciiRepresentationTag);
438
439 STATIC_CHECK(v8::String::ASCII_ENCODING == kOneByteStringTag); 436 STATIC_CHECK(v8::String::ASCII_ENCODING == kOneByteStringTag);
440 437
441 438
442 bool StringShape::IsExternalTwoByte() { 439 bool StringShape::IsExternalTwoByte() {
443 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag); 440 return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag);
444 } 441 }
445 442
446 443
444 STATIC_CHECK(kConsStringTag == Internals::kConsRepresentationTag);
445
446 STATIC_CHECK((kConsStringTag | kTwoByteStringTag) ==
447 Internals::kConsTwoByteRepresentationTag);
448
449 STATIC_CHECK(kExternalStringTag == Internals::kExternalRepresentationTag);
450
447 STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) == 451 STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) ==
448 Internals::kExternalTwoByteRepresentationTag); 452 Internals::kExternalTwoByteRepresentationTag);
449 453
450 STATIC_CHECK(v8::String::TWO_BYTE_ENCODING == kTwoByteStringTag); 454 STATIC_CHECK(v8::String::TWO_BYTE_ENCODING == kTwoByteStringTag);
451 455
452 uc32 FlatStringReader::Get(int index) { 456 uc32 FlatStringReader::Get(int index) {
453 ASSERT(0 <= index && index <= length_); 457 ASSERT(0 <= index && index <= length_);
454 if (is_ascii_) { 458 if (is_ascii_) {
455 return static_cast<const byte*>(start_)[index]; 459 return static_cast<const byte*>(start_)[index];
456 } else { 460 } else {
(...skipping 6324 matching lines...) Expand 10 before | Expand all | Expand 10 after
6781 #undef READ_UINT32_FIELD 6785 #undef READ_UINT32_FIELD
6782 #undef WRITE_UINT32_FIELD 6786 #undef WRITE_UINT32_FIELD
6783 #undef READ_SHORT_FIELD 6787 #undef READ_SHORT_FIELD
6784 #undef WRITE_SHORT_FIELD 6788 #undef WRITE_SHORT_FIELD
6785 #undef READ_BYTE_FIELD 6789 #undef READ_BYTE_FIELD
6786 #undef WRITE_BYTE_FIELD 6790 #undef WRITE_BYTE_FIELD
6787 6791
6788 } } // namespace v8::internal 6792 } } // namespace v8::internal
6789 6793
6790 #endif // V8_OBJECTS_INL_H_ 6794 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/api.cc ('K') | « src/api.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698