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

Side by Side Diff: src/objects.h

Issue 524059: Speed up compares with characters ie single-character strings.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/virtual-frame-ia32.h ('k') | src/objects-inl.h » ('j') | 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-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 STRUCT_LIST_ALL(V) \ 376 STRUCT_LIST_ALL(V) \
377 STRUCT_LIST_DEBUGGER(V) 377 STRUCT_LIST_DEBUGGER(V)
378 378
379 // We use the full 8 bits of the instance_type field to encode heap object 379 // We use the full 8 bits of the instance_type field to encode heap object
380 // instance types. The high-order bit (bit 7) is set if the object is not a 380 // instance types. The high-order bit (bit 7) is set if the object is not a
381 // string, and cleared if it is a string. 381 // string, and cleared if it is a string.
382 const uint32_t kIsNotStringMask = 0x80; 382 const uint32_t kIsNotStringMask = 0x80;
383 const uint32_t kStringTag = 0x0; 383 const uint32_t kStringTag = 0x0;
384 const uint32_t kNotStringTag = 0x80; 384 const uint32_t kNotStringTag = 0x80;
385 385
386 // If bit 7 is clear, bit 5 indicates that the string is a symbol (if set) or 386 // Bit 6 indicates that the object is a symbol (if set) or not (if cleared).
387 // not (if cleared). 387 // There are not enough types that the non-string types (with bit 7 set) can
388 const uint32_t kIsSymbolMask = 0x20; 388 // have bit 6 set too.
389 const uint32_t kIsSymbolMask = 0x40;
389 const uint32_t kNotSymbolTag = 0x0; 390 const uint32_t kNotSymbolTag = 0x0;
390 const uint32_t kSymbolTag = 0x20; 391 const uint32_t kSymbolTag = 0x40;
391 392
392 // If bit 7 is clear then bit 2 indicates whether the string consists of 393 // If bit 7 is clear then bit 2 indicates whether the string consists of
393 // two-byte characters or one-byte characters. 394 // two-byte characters or one-byte characters.
394 const uint32_t kStringEncodingMask = 0x4; 395 const uint32_t kStringEncodingMask = 0x4;
395 const uint32_t kTwoByteStringTag = 0x0; 396 const uint32_t kTwoByteStringTag = 0x0;
396 const uint32_t kAsciiStringTag = 0x4; 397 const uint32_t kAsciiStringTag = 0x4;
397 398
398 // If bit 7 is clear, the low-order 2 bits indicate the representation 399 // If bit 7 is clear, the low-order 2 bits indicate the representation
399 // of the string. 400 // of the string.
400 const uint32_t kStringRepresentationMask = 0x03; 401 const uint32_t kStringRepresentationMask = 0x03;
(...skipping 4549 matching lines...) Expand 10 before | Expand all | Expand 10 after
4950 } else { 4951 } else {
4951 value &= ~(1 << bit_position); 4952 value &= ~(1 << bit_position);
4952 } 4953 }
4953 return value; 4954 return value;
4954 } 4955 }
4955 }; 4956 };
4956 4957
4957 } } // namespace v8::internal 4958 } } // namespace v8::internal
4958 4959
4959 #endif // V8_OBJECTS_H_ 4960 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ia32/virtual-frame-ia32.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698