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

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

Issue 11231: Flat string reader (Closed)
Patch Set: Created 12 years, 1 month 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 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 return full_representation_tag() == (kExternalStringTag | kAsciiStringTag); 272 return full_representation_tag() == (kExternalStringTag | kAsciiStringTag);
273 } 273 }
274 274
275 275
276 bool StringShape::IsExternalTwoByte() { 276 bool StringShape::IsExternalTwoByte() {
277 return (type_ & (kStringRepresentationMask | kStringEncodingMask)) == 277 return (type_ & (kStringRepresentationMask | kStringEncodingMask)) ==
278 (kExternalStringTag | kTwoByteStringTag); 278 (kExternalStringTag | kTwoByteStringTag);
279 } 279 }
280 280
281 281
282 uc32 FlatStringReader::Get(int index) {
283 ASSERT(0 <= index && index <= length_);
284 if (is_ascii_) {
285 return static_cast<const byte*>(start_)[index];
286 } else {
287 return static_cast<const uc16*>(start_)[index];
288 }
289 }
290
291
282 bool Object::IsNumber() { 292 bool Object::IsNumber() {
283 return IsSmi() || IsHeapNumber(); 293 return IsSmi() || IsHeapNumber();
284 } 294 }
285 295
286 296
287 bool Object::IsByteArray() { 297 bool Object::IsByteArray() {
288 return Object::IsHeapObject() 298 return Object::IsHeapObject()
289 && HeapObject::cast(this)->map()->instance_type() == BYTE_ARRAY_TYPE; 299 && HeapObject::cast(this)->map()->instance_type() == BYTE_ARRAY_TYPE;
290 } 300 }
291 301
(...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2457 #undef WRITE_INT_FIELD 2467 #undef WRITE_INT_FIELD
2458 #undef READ_SHORT_FIELD 2468 #undef READ_SHORT_FIELD
2459 #undef WRITE_SHORT_FIELD 2469 #undef WRITE_SHORT_FIELD
2460 #undef READ_BYTE_FIELD 2470 #undef READ_BYTE_FIELD
2461 #undef WRITE_BYTE_FIELD 2471 #undef WRITE_BYTE_FIELD
2462 2472
2463 2473
2464 } } // namespace v8::internal 2474 } } // namespace v8::internal
2465 2475
2466 #endif // V8_OBJECTS_INL_H_ 2476 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.cc ('K') | « src/objects.cc ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698