OLD | NEW |
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 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 if (type < FIRST_NONSTRING_TYPE) { | 1131 if (type < FIRST_NONSTRING_TYPE) { |
1132 switch (type & kStringRepresentationMask) { | 1132 switch (type & kStringRepresentationMask) { |
1133 case kSeqStringTag: | 1133 case kSeqStringTag: |
1134 break; | 1134 break; |
1135 case kConsStringTag: | 1135 case kConsStringTag: |
1136 reinterpret_cast<ConsString*>(this)->ConsStringIterateBody(v); | 1136 reinterpret_cast<ConsString*>(this)->ConsStringIterateBody(v); |
1137 break; | 1137 break; |
1138 case kSlicedStringTag: | 1138 case kSlicedStringTag: |
1139 reinterpret_cast<SlicedString*>(this)->SlicedStringIterateBody(v); | 1139 reinterpret_cast<SlicedString*>(this)->SlicedStringIterateBody(v); |
1140 break; | 1140 break; |
| 1141 case kExternalStringTag: |
| 1142 if ((type & kStringEncodingMask) == kAsciiStringTag) { |
| 1143 reinterpret_cast<ExternalAsciiString*>(this)-> |
| 1144 ExternalAsciiStringIterateBody(v); |
| 1145 } else { |
| 1146 reinterpret_cast<ExternalTwoByteString*>(this)-> |
| 1147 ExternalTwoByteStringIterateBody(v); |
| 1148 } |
| 1149 break; |
1141 } | 1150 } |
1142 return; | 1151 return; |
1143 } | 1152 } |
1144 | 1153 |
1145 switch (type) { | 1154 switch (type) { |
1146 case FIXED_ARRAY_TYPE: | 1155 case FIXED_ARRAY_TYPE: |
1147 reinterpret_cast<FixedArray*>(this)->FixedArrayIterateBody(v); | 1156 reinterpret_cast<FixedArray*>(this)->FixedArrayIterateBody(v); |
1148 break; | 1157 break; |
1149 case JS_OBJECT_TYPE: | 1158 case JS_OBJECT_TYPE: |
1150 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: | 1159 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
(...skipping 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4139 offset_ptr, | 4148 offset_ptr, |
4140 max_chars); | 4149 max_chars); |
4141 return; | 4150 return; |
4142 case kSlicedStringTag: | 4151 case kSlicedStringTag: |
4143 SlicedString::cast(input)->SlicedStringReadBlockIntoBuffer(rbb, | 4152 SlicedString::cast(input)->SlicedStringReadBlockIntoBuffer(rbb, |
4144 offset_ptr, | 4153 offset_ptr, |
4145 max_chars); | 4154 max_chars); |
4146 return; | 4155 return; |
4147 case kExternalStringTag: | 4156 case kExternalStringTag: |
4148 if (input->IsAsciiRepresentation()) { | 4157 if (input->IsAsciiRepresentation()) { |
4149 ExternalAsciiString::cast(input)-> | 4158 ExternalAsciiString::cast(input)-> |
4150 ExternalAsciiStringReadBlockIntoBuffer(rbb, offset_ptr, max_chars); | 4159 ExternalAsciiStringReadBlockIntoBuffer(rbb, offset_ptr, max_chars); |
4151 } else { | 4160 } else { |
4152 ExternalTwoByteString::cast(input)-> | 4161 ExternalTwoByteString::cast(input)-> |
4153 ExternalTwoByteStringReadBlockIntoBuffer(rbb, | 4162 ExternalTwoByteStringReadBlockIntoBuffer(rbb, |
4154 offset_ptr, | 4163 offset_ptr, |
4155 max_chars); | 4164 max_chars); |
4156 } | 4165 } |
4157 return; | 4166 return; |
4158 default: | 4167 default: |
4159 break; | 4168 break; |
4160 } | 4169 } |
4161 | 4170 |
4162 UNREACHABLE(); | 4171 UNREACHABLE(); |
4163 return; | 4172 return; |
4164 } | 4173 } |
4165 | 4174 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4391 } | 4400 } |
4392 } | 4401 } |
4393 } | 4402 } |
4394 } | 4403 } |
4395 | 4404 |
4396 | 4405 |
4397 void SlicedString::SlicedStringIterateBody(ObjectVisitor* v) { | 4406 void SlicedString::SlicedStringIterateBody(ObjectVisitor* v) { |
4398 IteratePointer(v, kBufferOffset); | 4407 IteratePointer(v, kBufferOffset); |
4399 } | 4408 } |
4400 | 4409 |
| 4410 #define FIELD_ADDR(p, offset) \ |
| 4411 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |
| 4412 |
| 4413 void ExternalAsciiString::ExternalAsciiStringIterateBody(ObjectVisitor* v) { |
| 4414 typedef v8::String::ExternalAsciiStringResource Resource; |
| 4415 v->VisitExternalAsciiString( |
| 4416 reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset))); |
| 4417 } |
| 4418 |
| 4419 |
| 4420 void ExternalTwoByteString::ExternalTwoByteStringIterateBody(ObjectVisitor* v) { |
| 4421 typedef v8::String::ExternalStringResource Resource; |
| 4422 v->VisitExternalTwoByteString( |
| 4423 reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset))); |
| 4424 } |
| 4425 |
| 4426 #undef FIELD_ADDR |
4401 | 4427 |
4402 uint16_t SlicedString::SlicedStringGet(int index) { | 4428 uint16_t SlicedString::SlicedStringGet(int index) { |
4403 ASSERT(index >= 0 && index < this->length()); | 4429 ASSERT(index >= 0 && index < this->length()); |
4404 // Delegate to the buffer string. | 4430 // Delegate to the buffer string. |
4405 String* underlying = buffer(); | 4431 String* underlying = buffer(); |
4406 return underlying->Get(start() + index); | 4432 return underlying->Get(start() + index); |
4407 } | 4433 } |
4408 | 4434 |
4409 | 4435 |
4410 template <typename IteratorA, typename IteratorB> | 4436 template <typename IteratorA, typename IteratorB> |
(...skipping 3896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8307 if (break_point_objects()->IsUndefined()) return 0; | 8333 if (break_point_objects()->IsUndefined()) return 0; |
8308 // Single beak point. | 8334 // Single beak point. |
8309 if (!break_point_objects()->IsFixedArray()) return 1; | 8335 if (!break_point_objects()->IsFixedArray()) return 1; |
8310 // Multiple break points. | 8336 // Multiple break points. |
8311 return FixedArray::cast(break_point_objects())->length(); | 8337 return FixedArray::cast(break_point_objects())->length(); |
8312 } | 8338 } |
8313 #endif | 8339 #endif |
8314 | 8340 |
8315 | 8341 |
8316 } } // namespace v8::internal | 8342 } } // namespace v8::internal |
OLD | NEW |