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

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: Address Yang's comment 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 8621 matching lines...) Expand 10 before | Expand all | Expand 10 after
8632 }; 8632 };
8633 8633
8634 // Representation of the flat content of a String. 8634 // Representation of the flat content of a String.
8635 // A non-flat string doesn't have flat content. 8635 // A non-flat string doesn't have flat content.
8636 // A flat string has content that's encoded as a sequence of either 8636 // A flat string has content that's encoded as a sequence of either
8637 // one-byte chars or two-byte UC16. 8637 // one-byte chars or two-byte UC16.
8638 // Returned by String::GetFlatContent(). 8638 // Returned by String::GetFlatContent().
8639 class FlatContent { 8639 class FlatContent {
8640 public: 8640 public:
8641 // Returns true if the string is flat and this structure contains content. 8641 // Returns true if the string is flat and this structure contains content.
8642 bool IsFlat() { return state_ != NON_FLAT; } 8642 bool IsFlat() const { return state_ != NON_FLAT; }
8643 // Returns true if the structure contains one-byte content. 8643 // Returns true if the structure contains one-byte content.
8644 bool IsOneByte() { return state_ == ONE_BYTE; } 8644 bool IsOneByte() const { return state_ == ONE_BYTE; }
8645 // Returns true if the structure contains two-byte content. 8645 // Returns true if the structure contains two-byte content.
8646 bool IsTwoByte() { return state_ == TWO_BYTE; } 8646 bool IsTwoByte() const { return state_ == TWO_BYTE; }
8647 8647
8648 // Return the one byte content of the string. Only use if IsOneByte() 8648 // Return the one byte content of the string. Only use if IsOneByte()
8649 // returns true. 8649 // returns true.
8650 Vector<const uint8_t> ToOneByteVector() { 8650 Vector<const uint8_t> ToOneByteVector() const {
8651 DCHECK_EQ(ONE_BYTE, state_); 8651 DCHECK_EQ(ONE_BYTE, state_);
8652 return Vector<const uint8_t>(onebyte_start, length_); 8652 return Vector<const uint8_t>(onebyte_start, length_);
8653 } 8653 }
8654 // Return the two-byte content of the string. Only use if IsTwoByte() 8654 // Return the two-byte content of the string. Only use if IsTwoByte()
8655 // returns true. 8655 // returns true.
8656 Vector<const uc16> ToUC16Vector() { 8656 Vector<const uc16> ToUC16Vector() const {
8657 DCHECK_EQ(TWO_BYTE, state_); 8657 DCHECK_EQ(TWO_BYTE, state_);
8658 return Vector<const uc16>(twobyte_start, length_); 8658 return Vector<const uc16>(twobyte_start, length_);
8659 } 8659 }
8660 8660
8661 uc16 Get(int i) { 8661 uc16 Get(int i) const {
8662 DCHECK(i < length_); 8662 DCHECK(i < length_);
8663 DCHECK(state_ != NON_FLAT); 8663 DCHECK(state_ != NON_FLAT);
8664 if (state_ == ONE_BYTE) return onebyte_start[i]; 8664 if (state_ == ONE_BYTE) return onebyte_start[i];
8665 return twobyte_start[i]; 8665 return twobyte_start[i];
8666 } 8666 }
8667 8667
8668 bool UsesSameString(const FlatContent& other) const { 8668 bool UsesSameString(const FlatContent& other) const {
8669 return onebyte_start == other.onebyte_start; 8669 return onebyte_start == other.onebyte_start;
8670 } 8670 }
8671 8671
(...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after
10727 } 10727 }
10728 return value; 10728 return value;
10729 } 10729 }
10730 }; 10730 };
10731 10731
10732 10732
10733 } // NOLINT, false-positive due to second-order macros. 10733 } // NOLINT, false-positive due to second-order macros.
10734 } // NOLINT, false-positive due to second-order macros. 10734 } // NOLINT, false-positive due to second-order macros.
10735 10735
10736 #endif // V8_OBJECTS_H_ 10736 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/js/prologue.js ('k') | src/runtime/runtime.h » ('j') | src/runtime/runtime-i18n.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698