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

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

Issue 7518: String equality improvements. (Closed)
Patch Set: Fixed lint issue Created 12 years, 2 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
« src/objects.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 && (String::cast(this)->representation_tag() == kSeqStringTag); 118 && (String::cast(this)->representation_tag() == kSeqStringTag);
119 } 119 }
120 120
121 121
122 bool Object::IsSeqAsciiString() { 122 bool Object::IsSeqAsciiString() {
123 return IsSeqString() 123 return IsSeqString()
124 && String::cast(this)->IsAsciiRepresentation(); 124 && String::cast(this)->IsAsciiRepresentation();
125 } 125 }
126 126
127 127
128 bool String::IsSeqAsciiString() {
129 return (this->representation_tag() == kSeqStringTag)
130 && is_ascii_representation();
131 }
132
133
128 bool Object::IsSeqTwoByteString() { 134 bool Object::IsSeqTwoByteString() {
129 return IsSeqString() 135 return IsSeqString()
130 && !String::cast(this)->IsAsciiRepresentation(); 136 && !String::cast(this)->IsAsciiRepresentation();
131 } 137 }
132 138
133 139
134 bool Object::IsAsciiStringRepresentation() { 140 bool Object::IsAsciiStringRepresentation() {
135 return IsString() && (String::cast(this)->is_ascii_representation()); 141 return IsString() && (String::cast(this)->is_ascii_representation());
136 } 142 }
137 143
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, 1407 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize,
1402 static_cast<byte>(value)); 1408 static_cast<byte>(value));
1403 } 1409 }
1404 1410
1405 1411
1406 Address SeqAsciiString::GetCharsAddress() { 1412 Address SeqAsciiString::GetCharsAddress() {
1407 return FIELD_ADDR(this, kHeaderSize); 1413 return FIELD_ADDR(this, kHeaderSize);
1408 } 1414 }
1409 1415
1410 1416
1417 const char* SeqAsciiString::GetChars() {
1418 return reinterpret_cast<const char*>(GetCharsAddress());
1419 }
1420
1421
1411 Address SeqTwoByteString::GetCharsAddress() { 1422 Address SeqTwoByteString::GetCharsAddress() {
1412 return FIELD_ADDR(this, kHeaderSize); 1423 return FIELD_ADDR(this, kHeaderSize);
1413 } 1424 }
1414 1425
1415 1426
1416 uint16_t SeqTwoByteString::SeqTwoByteStringGet(int index) { 1427 uint16_t SeqTwoByteString::SeqTwoByteStringGet(int index) {
1417 ASSERT(index >= 0 && index < length()); 1428 ASSERT(index >= 0 && index < length());
1418 return READ_SHORT_FIELD(this, kHeaderSize + index * kShortSize); 1429 return READ_SHORT_FIELD(this, kHeaderSize + index * kShortSize);
1419 } 1430 }
1420 1431
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
2317 #undef WRITE_INT_FIELD 2328 #undef WRITE_INT_FIELD
2318 #undef READ_SHORT_FIELD 2329 #undef READ_SHORT_FIELD
2319 #undef WRITE_SHORT_FIELD 2330 #undef WRITE_SHORT_FIELD
2320 #undef READ_BYTE_FIELD 2331 #undef READ_BYTE_FIELD
2321 #undef WRITE_BYTE_FIELD 2332 #undef WRITE_BYTE_FIELD
2322 2333
2323 2334
2324 } } // namespace v8::internal 2335 } } // namespace v8::internal
2325 2336
2326 #endif // V8_OBJECTS_INL_H_ 2337 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698