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 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 | 1633 |
1634 bool String::Equals(String* other) { | 1634 bool String::Equals(String* other) { |
1635 if (other == this) return true; | 1635 if (other == this) return true; |
1636 if (StringShape(this).IsSymbol() && StringShape(other).IsSymbol()) { | 1636 if (StringShape(this).IsSymbol() && StringShape(other).IsSymbol()) { |
1637 return false; | 1637 return false; |
1638 } | 1638 } |
1639 return SlowEquals(other); | 1639 return SlowEquals(other); |
1640 } | 1640 } |
1641 | 1641 |
1642 | 1642 |
1643 Object* String::TryFlattenIfNotFlat() { | 1643 Object* String::TryFlatten(PretenureFlag pretenure) { |
1644 // We don't need to flatten strings that are already flat. Since this code | 1644 // We don't need to flatten strings that are already flat. Since this code |
1645 // is inlined, it can be helpful in the flat case to not call out to Flatten. | 1645 // is inlined, it can be helpful in the flat case to not call out to Flatten. |
1646 if (!IsFlat()) { | 1646 if (IsFlat()) return this; |
1647 return TryFlatten(); | 1647 return SlowTryFlatten(pretenure); |
1648 } | |
1649 return this; | |
1650 } | 1648 } |
1651 | 1649 |
1652 | 1650 |
1653 uint16_t String::Get(int index) { | 1651 uint16_t String::Get(int index) { |
1654 ASSERT(index >= 0 && index < length()); | 1652 ASSERT(index >= 0 && index < length()); |
1655 switch (StringShape(this).full_representation_tag()) { | 1653 switch (StringShape(this).full_representation_tag()) { |
1656 case kSeqStringTag | kAsciiStringTag: | 1654 case kSeqStringTag | kAsciiStringTag: |
1657 return SeqAsciiString::cast(this)->SeqAsciiStringGet(index); | 1655 return SeqAsciiString::cast(this)->SeqAsciiStringGet(index); |
1658 case kSeqStringTag | kTwoByteStringTag: | 1656 case kSeqStringTag | kTwoByteStringTag: |
1659 return SeqTwoByteString::cast(this)->SeqTwoByteStringGet(index); | 1657 return SeqTwoByteString::cast(this)->SeqTwoByteStringGet(index); |
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3050 #undef WRITE_INT_FIELD | 3048 #undef WRITE_INT_FIELD |
3051 #undef READ_SHORT_FIELD | 3049 #undef READ_SHORT_FIELD |
3052 #undef WRITE_SHORT_FIELD | 3050 #undef WRITE_SHORT_FIELD |
3053 #undef READ_BYTE_FIELD | 3051 #undef READ_BYTE_FIELD |
3054 #undef WRITE_BYTE_FIELD | 3052 #undef WRITE_BYTE_FIELD |
3055 | 3053 |
3056 | 3054 |
3057 } } // namespace v8::internal | 3055 } } // namespace v8::internal |
3058 | 3056 |
3059 #endif // V8_OBJECTS_INL_H_ | 3057 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |