OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2635 continue; | 2635 continue; |
2636 | 2636 |
2637 default: | 2637 default: |
2638 UNREACHABLE(); | 2638 UNREACHABLE(); |
2639 return; | 2639 return; |
2640 } | 2640 } |
2641 } | 2641 } |
2642 } | 2642 } |
2643 | 2643 |
2644 | 2644 |
| 2645 // TODO(dcarney): Remove this class after conversion to VisitFlat. |
| 2646 class ConsStringCaptureOp { |
| 2647 public: |
| 2648 inline ConsStringCaptureOp() : cons_string_(NULL) {} |
| 2649 inline String* Operate(String* string, unsigned*, int32_t*, unsigned*) { |
| 2650 cons_string_ = ConsString::cast(string); |
| 2651 return NULL; |
| 2652 } |
| 2653 ConsString* cons_string_; |
| 2654 }; |
| 2655 |
| 2656 |
| 2657 template<class Visitor> |
| 2658 ConsString* String::VisitFlat(Visitor* visitor, |
| 2659 String* string, |
| 2660 int offset, |
| 2661 int length, |
| 2662 int32_t type) { |
| 2663 ASSERT(length >= 0 && length == string->length()); |
| 2664 ASSERT(offset >= 0 && offset <= length); |
| 2665 ConsStringCaptureOp op; |
| 2666 Visit(string, offset, *visitor, op, type, static_cast<unsigned>(length)); |
| 2667 return op.cons_string_; |
| 2668 } |
| 2669 |
| 2670 |
2645 uint16_t SeqOneByteString::SeqOneByteStringGet(int index) { | 2671 uint16_t SeqOneByteString::SeqOneByteStringGet(int index) { |
2646 ASSERT(index >= 0 && index < length()); | 2672 ASSERT(index >= 0 && index < length()); |
2647 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); | 2673 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); |
2648 } | 2674 } |
2649 | 2675 |
2650 | 2676 |
2651 void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) { | 2677 void SeqOneByteString::SeqOneByteStringSet(int index, uint16_t value) { |
2652 ASSERT(index >= 0 && index < length() && value <= kMaxOneByteCharCode); | 2678 ASSERT(index >= 0 && index < length() && value <= kMaxOneByteCharCode); |
2653 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, | 2679 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, |
2654 static_cast<byte>(value)); | 2680 static_cast<byte>(value)); |
(...skipping 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5947 #undef WRITE_UINT32_FIELD | 5973 #undef WRITE_UINT32_FIELD |
5948 #undef READ_SHORT_FIELD | 5974 #undef READ_SHORT_FIELD |
5949 #undef WRITE_SHORT_FIELD | 5975 #undef WRITE_SHORT_FIELD |
5950 #undef READ_BYTE_FIELD | 5976 #undef READ_BYTE_FIELD |
5951 #undef WRITE_BYTE_FIELD | 5977 #undef WRITE_BYTE_FIELD |
5952 | 5978 |
5953 | 5979 |
5954 } } // namespace v8::internal | 5980 } } // namespace v8::internal |
5955 | 5981 |
5956 #endif // V8_OBJECTS_INL_H_ | 5982 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |