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

Side by Side Diff: src/objects.h

Issue 1812673005: Use ICU case conversion/transliterator for case conversion behind a flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: a bit more tweak with buffer extraction Created 4 years, 7 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/assert-scope.h" 10 #include "src/assert-scope.h"
(...skipping 8687 matching lines...) Expand 10 before | Expand all | Expand 10 after
8698 }; 8698 };
8699 8699
8700 // Representation of the flat content of a String. 8700 // Representation of the flat content of a String.
8701 // A non-flat string doesn't have flat content. 8701 // A non-flat string doesn't have flat content.
8702 // A flat string has content that's encoded as a sequence of either 8702 // A flat string has content that's encoded as a sequence of either
8703 // one-byte chars or two-byte UC16. 8703 // one-byte chars or two-byte UC16.
8704 // Returned by String::GetFlatContent(). 8704 // Returned by String::GetFlatContent().
8705 class FlatContent { 8705 class FlatContent {
8706 public: 8706 public:
8707 // Returns true if the string is flat and this structure contains content. 8707 // Returns true if the string is flat and this structure contains content.
8708 bool IsFlat() { return state_ != NON_FLAT; } 8708 bool IsFlat() const { return state_ != NON_FLAT; }
8709 // Returns true if the structure contains one-byte content. 8709 // Returns true if the structure contains one-byte content.
8710 bool IsOneByte() { return state_ == ONE_BYTE; } 8710 bool IsOneByte() const { return state_ == ONE_BYTE; }
8711 // Returns true if the structure contains two-byte content. 8711 // Returns true if the structure contains two-byte content.
8712 bool IsTwoByte() { return state_ == TWO_BYTE; } 8712 bool IsTwoByte() const { return state_ == TWO_BYTE; }
8713 8713
8714 // Return the one byte content of the string. Only use if IsOneByte() 8714 // Return the one byte content of the string. Only use if IsOneByte()
8715 // returns true. 8715 // returns true.
8716 Vector<const uint8_t> ToOneByteVector() { 8716 Vector<const uint8_t> ToOneByteVector() const {
8717 DCHECK_EQ(ONE_BYTE, state_); 8717 DCHECK_EQ(ONE_BYTE, state_);
8718 return Vector<const uint8_t>(onebyte_start, length_); 8718 return Vector<const uint8_t>(onebyte_start, length_);
8719 } 8719 }
8720 // Return the two-byte content of the string. Only use if IsTwoByte() 8720 // Return the two-byte content of the string. Only use if IsTwoByte()
8721 // returns true. 8721 // returns true.
8722 Vector<const uc16> ToUC16Vector() { 8722 Vector<const uc16> ToUC16Vector() const {
8723 DCHECK_EQ(TWO_BYTE, state_); 8723 DCHECK_EQ(TWO_BYTE, state_);
8724 return Vector<const uc16>(twobyte_start, length_); 8724 return Vector<const uc16>(twobyte_start, length_);
8725 } 8725 }
8726 8726
8727 uc16 Get(int i) { 8727 uc16 Get(int i) const {
8728 DCHECK(i < length_); 8728 DCHECK(i < length_);
8729 DCHECK(state_ != NON_FLAT); 8729 DCHECK(state_ != NON_FLAT);
8730 if (state_ == ONE_BYTE) return onebyte_start[i]; 8730 if (state_ == ONE_BYTE) return onebyte_start[i];
8731 return twobyte_start[i]; 8731 return twobyte_start[i];
8732 } 8732 }
8733 8733
8734 bool UsesSameString(const FlatContent& other) const { 8734 bool UsesSameString(const FlatContent& other) const {
8735 return onebyte_start == other.onebyte_start; 8735 return onebyte_start == other.onebyte_start;
8736 } 8736 }
8737 8737
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after
10792 } 10792 }
10793 return value; 10793 return value;
10794 } 10794 }
10795 }; 10795 };
10796 10796
10797 10797
10798 } // NOLINT, false-positive due to second-order macros. 10798 } // NOLINT, false-positive due to second-order macros.
10799 } // NOLINT, false-positive due to second-order macros. 10799 } // NOLINT, false-positive due to second-order macros.
10800 10800
10801 #endif // V8_OBJECTS_H_ 10801 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/js/icu-case-mapping.js ('k') | src/runtime/runtime.h » ('j') | src/runtime/runtime-i18n.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698