OLD | NEW |
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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 // If bit 7 is clear, the low-order 2 bits indicate the representation | 434 // If bit 7 is clear, the low-order 2 bits indicate the representation |
435 // of the string. | 435 // of the string. |
436 const uint32_t kStringRepresentationMask = 0x03; | 436 const uint32_t kStringRepresentationMask = 0x03; |
437 enum StringRepresentationTag { | 437 enum StringRepresentationTag { |
438 kSeqStringTag = 0x0, | 438 kSeqStringTag = 0x0, |
439 kConsStringTag = 0x1, | 439 kConsStringTag = 0x1, |
440 kSlicedStringTag = 0x2, | 440 kSlicedStringTag = 0x2, |
441 kExternalStringTag = 0x3 | 441 kExternalStringTag = 0x3 |
442 }; | 442 }; |
443 | 443 |
| 444 |
| 445 // A ConsString with an empty string as the right side is a candidate |
| 446 // for being shortcut by the garbage collector unless it is a |
| 447 // symbol. It's not common to have non-flat symbols, so we do not |
| 448 // shortcut them thereby avoiding turning symbols into strings. See |
| 449 // heap.cc and mark-compact.cc. |
| 450 STATIC_ASSERT(kNotStringTag != 0 && kSymbolTag != 0); |
| 451 const uint32_t kShortcutTypeMask = |
| 452 kIsNotStringMask | |
| 453 kIsSymbolMask | |
| 454 kStringRepresentationMask; |
| 455 const uint32_t kShortcutTypeTag = kConsStringTag; |
| 456 |
| 457 |
444 enum InstanceType { | 458 enum InstanceType { |
445 SHORT_SYMBOL_TYPE = kShortStringTag | kSymbolTag | kSeqStringTag, | 459 SHORT_SYMBOL_TYPE = kShortStringTag | kSymbolTag | kSeqStringTag, |
446 MEDIUM_SYMBOL_TYPE = kMediumStringTag | kSymbolTag | kSeqStringTag, | 460 MEDIUM_SYMBOL_TYPE = kMediumStringTag | kSymbolTag | kSeqStringTag, |
447 LONG_SYMBOL_TYPE = kLongStringTag | kSymbolTag | kSeqStringTag, | 461 LONG_SYMBOL_TYPE = kLongStringTag | kSymbolTag | kSeqStringTag, |
448 SHORT_ASCII_SYMBOL_TYPE = | 462 SHORT_ASCII_SYMBOL_TYPE = |
449 kShortStringTag | kAsciiStringTag | kSymbolTag | kSeqStringTag, | 463 kShortStringTag | kAsciiStringTag | kSymbolTag | kSeqStringTag, |
450 MEDIUM_ASCII_SYMBOL_TYPE = | 464 MEDIUM_ASCII_SYMBOL_TYPE = |
451 kMediumStringTag | kAsciiStringTag | kSymbolTag | kSeqStringTag, | 465 kMediumStringTag | kAsciiStringTag | kSymbolTag | kSeqStringTag, |
452 LONG_ASCII_SYMBOL_TYPE = | 466 LONG_ASCII_SYMBOL_TYPE = |
453 kLongStringTag | kAsciiStringTag | kSymbolTag | kSeqStringTag, | 467 kLongStringTag | kAsciiStringTag | kSymbolTag | kSeqStringTag, |
(...skipping 3861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4315 } else { | 4329 } else { |
4316 value &= ~(1 << bit_position); | 4330 value &= ~(1 << bit_position); |
4317 } | 4331 } |
4318 return value; | 4332 return value; |
4319 } | 4333 } |
4320 }; | 4334 }; |
4321 | 4335 |
4322 } } // namespace v8::internal | 4336 } } // namespace v8::internal |
4323 | 4337 |
4324 #endif // V8_OBJECTS_H_ | 4338 #endif // V8_OBJECTS_H_ |
OLD | NEW |