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

Unified Diff: src/objects.h

Issue 8187: Serendipitously arrange the tags so that String.length() becomes a branch-fre... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: src/objects.h
===================================================================
--- src/objects.h (revision 595)
+++ src/objects.h (working copy)
@@ -395,29 +395,28 @@
const uint32_t kStringTag = 0x0;
const uint32_t kNotStringTag = 0x80;
-// If bit 7 is clear, bits 5 and 6 are the string's size (short, medium, or
-// long).
-const uint32_t kStringSizeMask = 0x60;
-const uint32_t kShortStringTag = 0x0;
-const uint32_t kMediumStringTag = 0x20;
-const uint32_t kLongStringTag = 0x40;
+// If bit 7 is clear, bits 5 and 6 are the string's size (short, medium or long).
Mads Ager (chromium) 2008/10/27 09:37:00 This is now bits 4 and 5? Also, you should add a
+const uint32_t kStringSizeMask = 0x18;
+const uint32_t kShortStringTag = 0x18;
+const uint32_t kMediumStringTag = 0x10;
+const uint32_t kLongStringTag = 0x00;
// If bit 7 is clear, bit 4 indicates that the string is a symbol (if set) or
Mads Ager (chromium) 2008/10/27 09:37:00 And this is now bit 5?
// not (if cleared).
-const uint32_t kIsSymbolMask = 0x10;
+const uint32_t kIsSymbolMask = 0x20;
const uint32_t kNotSymbolTag = 0x0;
-const uint32_t kSymbolTag = 0x10;
+const uint32_t kSymbolTag = 0x20;
// If bit 7 is clear, and the string representation is a sequential string,
// then bit 3 indicates whether the string consists of two-byte characters or
// one-byte characters.
-const uint32_t kStringEncodingMask = 0x8;
+const uint32_t kStringEncodingMask = 0x4;
const uint32_t kTwoByteStringTag = 0x0;
-const uint32_t kAsciiStringTag = 0x8;
+const uint32_t kAsciiStringTag = 0x4;
// If bit 7 is clear, the low-order 3 bits indicate the representation
Mads Ager (chromium) 2008/10/27 09:37:00 3 -> 2 bits.
// of the string.
-const uint32_t kStringRepresentationMask = 0x07;
+const uint32_t kStringRepresentationMask = 0x03;
enum StringRepresentationTag {
kSeqStringTag = 0x0,
kConsStringTag = 0x1,
@@ -3154,8 +3153,8 @@
static const int kSize = kLengthOffset + kIntSize;
// Limits on sizes of different types of strings.
- static const int kMaxShortStringSize = 255;
- static const int kMaxMediumStringSize = 65535;
+ static const int kMaxShortStringSize = 63;
+ static const int kMaxMediumStringSize = 16383;
Mads Ager (chromium) 2008/10/27 09:37:00 These reductions in the limits is the only thing t
static const int kMaxArrayIndexSize = 10;
@@ -3176,13 +3175,13 @@
// Array index strings this short can keep their index in the hash
// field.
- static const int kMaxCachedArrayIndexLength = 6;
+ static const int kMaxCachedArrayIndexLength = 7;
// Shift constants for retriving length and hash code from
// length/hash field.
static const int kHashShift = kNofLengthBitFields;
- static const int kShortLengthShift = 3 * kBitsPerByte;
- static const int kMediumLengthShift = 2 * kBitsPerByte;
+ static const int kShortLengthShift = 26;
Mads Ager (chromium) 2008/10/27 09:37:00 Could we write these as kShortStringTag + kReprese
+ static const int kMediumLengthShift = 18;
static const int kLongLengthShift = kHashShift;
// Limit for truncation in short printing.

Powered by Google App Engine
This is Rietveld 408576698