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

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

Issue 11759008: Introduce ENABLE_LATIN_1 compile flag (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix FilterASCII Created 7 years, 11 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-debug.cc ('k') | src/parser.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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 338 }
339 } 339 }
340 340
341 341
342 bool String::HasOnlyAsciiChars() { 342 bool String::HasOnlyAsciiChars() {
343 uint32_t type = map()->instance_type(); 343 uint32_t type = map()->instance_type();
344 return (type & kAsciiDataHintMask) == kAsciiDataHintTag; 344 return (type & kAsciiDataHintMask) == kAsciiDataHintTag;
345 } 345 }
346 346
347 347
348 bool String::IsOneByteConvertible() {
349 return HasOnlyAsciiChars() || IsOneByteRepresentation();
350 }
351
352
348 bool StringShape::IsCons() { 353 bool StringShape::IsCons() {
349 return (type_ & kStringRepresentationMask) == kConsStringTag; 354 return (type_ & kStringRepresentationMask) == kConsStringTag;
350 } 355 }
351 356
352 357
353 bool StringShape::IsSliced() { 358 bool StringShape::IsSliced() {
354 return (type_ & kStringRepresentationMask) == kSlicedStringTag; 359 return (type_ & kStringRepresentationMask) == kSlicedStringTag;
355 } 360 }
356 361
357 362
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 } 2603 }
2599 2604
2600 2605
2601 uint16_t SeqOneByteString::SeqOneByteStringGet(int index) { 2606 uint16_t SeqOneByteString::SeqOneByteStringGet(int index) {
2602 ASSERT(index >= 0 && index < length()); 2607 ASSERT(index >= 0 && index < length());
2603 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); 2608 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
2604 } 2609 }
2605 2610
2606 2611
2607 void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) { 2612 void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) {
2608 ASSERT(index >= 0 && index < length() && value <= kMaxAsciiCharCode); 2613 ASSERT(index >= 0 && index < length() && value <= kMaxOneByteCharCode);
2609 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, 2614 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize,
2610 static_cast<byte>(value)); 2615 static_cast<byte>(value));
2611 } 2616 }
2612 2617
2613 2618
2614 Address SeqOneByteString::GetCharsAddress() { 2619 Address SeqOneByteString::GetCharsAddress() {
2615 return FIELD_ADDR(this, kHeaderSize); 2620 return FIELD_ADDR(this, kHeaderSize);
2616 } 2621 }
2617 2622
2618 2623
2619 char* SeqOneByteString::GetChars() { 2624 char* SeqOneByteString::GetChars() {
2620 return reinterpret_cast<char*>(GetCharsAddress()); 2625 return reinterpret_cast<char*>(GetCharsAddress());
2621 } 2626 }
2622 2627
2623 2628
2629 uint8_t* SeqOneByteString::GetCharsU() {
2630 return reinterpret_cast<uint8_t*>(GetCharsAddress());
2631 }
2632
2633
2624 Address SeqTwoByteString::GetCharsAddress() { 2634 Address SeqTwoByteString::GetCharsAddress() {
2625 return FIELD_ADDR(this, kHeaderSize); 2635 return FIELD_ADDR(this, kHeaderSize);
2626 } 2636 }
2627 2637
2628 2638
2629 uc16* SeqTwoByteString::GetChars() { 2639 uc16* SeqTwoByteString::GetChars() {
2630 return reinterpret_cast<uc16*>(FIELD_ADDR(this, kHeaderSize)); 2640 return reinterpret_cast<uc16*>(FIELD_ADDR(this, kHeaderSize));
2631 } 2641 }
2632 2642
2633 2643
(...skipping 3147 matching lines...) Expand 10 before | Expand all | Expand 10 after
5781 #undef WRITE_UINT32_FIELD 5791 #undef WRITE_UINT32_FIELD
5782 #undef READ_SHORT_FIELD 5792 #undef READ_SHORT_FIELD
5783 #undef WRITE_SHORT_FIELD 5793 #undef WRITE_SHORT_FIELD
5784 #undef READ_BYTE_FIELD 5794 #undef READ_BYTE_FIELD
5785 #undef WRITE_BYTE_FIELD 5795 #undef WRITE_BYTE_FIELD
5786 5796
5787 5797
5788 } } // namespace v8::internal 5798 } } // namespace v8::internal
5789 5799
5790 #endif // V8_OBJECTS_INL_H_ 5800 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698