Changeset 203911 in webkit
- Timestamp:
- Jul 29, 2016, 11:52:53 AM (9 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r203907 r203911 1 2016-07-29 Mark Lam <mark.lam@apple.com> 2 3 Make StringView capable of being passed or returned in only 2 registers. 4 https://bugs.webkit.org/show_bug.cgi?id=160344 5 6 Reviewed by Geoffrey Garen. 7 8 We just need to #if out copy and move constructors and assignment operators. 9 10 After this change, the following test code: 11 12 JS_EXPORT_PRIVATE StringView returnStringView(StringView sv) 13 { 14 return sv; 15 } 16 17 ... compiles to the following for x86_64: 18 19 __ZN3JSC16returnStringViewEN3WTF10StringViewE: 20 000000000093fb20 pushq %rbp 21 000000000093fb21 movq %rsp, %rbp 22 000000000093fb24 movq %rdi, %rax // Copy from arg word 0 to ret word 0. 23 000000000093fb27 movq %rsi, %rdx // Copy from arg word 1 to ret word 1. 24 000000000093fb2a popq %rbp 25 000000000093fb2b retq 26 27 ... and this for arm64: 28 29 __ZN3JSC16returnStringViewEN3WTF10StringViewE: 30 0000000000818504 ret // arg word 0 and 1 are in the same regs as ret word 0 and 1. 31 32 * wtf/text/StringView.h: 33 (WTF::StringView::StringView): 34 (WTF::StringView::~StringView): 35 (WTF::StringView::operator=): 36 1 37 2016-07-29 Csaba Osztrogonác <ossy@webkit.org> 2 38 -
trunk/Source/WTF/wtf/text/StringView.h
r203834 r203911 49 49 50 50 // StringView is a non-owning reference to a string, similar to the proposed std::string_view. 51 // Whether the string is 8-bit or 16-bit is encoded in the upper bit of the length member.52 // This means that strings longer than 2 gigacharacters cannot be represented.53 51 54 52 class StringView { 55 53 public: 56 54 StringView(); 55 #if CHECK_STRINGVIEW_LIFETIME 57 56 ~StringView(); 58 57 StringView(StringView&&); … … 60 59 StringView& operator=(StringView&&); 61 60 StringView& operator=(const StringView&); 61 #endif 62 62 63 63 StringView(const String&); … … 203 203 } 204 204 205 #if CHECK_STRINGVIEW_LIFETIME 205 206 inline StringView::~StringView() 206 207 { … … 259 260 return *this; 260 261 } 262 #endif // CHECK_STRINGVIEW_LIFETIME 261 263 262 264 inline void StringView::initialize(const LChar* characters, unsigned length)
Note:
See TracChangeset
for help on using the changeset viewer.