| 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 | 503 |
| 504 switch (representation_tag()) { | 504 switch (representation_tag()) { |
| 505 case kSlicedStringTag: { | 505 case kSlicedStringTag: { |
| 506 SlicedString* ss = SlicedString::cast(this); | 506 SlicedString* ss = SlicedString::cast(this); |
| 507 // The SlicedString constructor should ensure that there are no | 507 // The SlicedString constructor should ensure that there are no |
| 508 // SlicedStrings that are constructed directly on top of other | 508 // SlicedStrings that are constructed directly on top of other |
| 509 // SlicedStrings. | 509 // SlicedStrings. |
| 510 ASSERT(!ss->buffer()->IsSlicedString()); | 510 ASSERT(!ss->buffer()->IsSlicedString()); |
| 511 Object* ok = String::cast(ss->buffer())->Flatten(); | 511 Object* ok = String::cast(ss->buffer())->Flatten(); |
| 512 if (ok->IsFailure()) return ok; | 512 if (ok->IsFailure()) return ok; |
| 513 // Under certain circumstances (TryFlatten fails in String::Slice) |
| 514 // we can have a cons string under a slice. In this case we need |
| 515 // to get the flat string out of the cons! |
| 516 if (String::cast(ok)->StringIsConsString()) { |
| 517 ss->set_buffer(ConsString::cast(ok)->first()); |
| 518 } |
| 513 return this; | 519 return this; |
| 514 } | 520 } |
| 515 case kConsStringTag: { | 521 case kConsStringTag: { |
| 516 ConsString* cs = ConsString::cast(this); | 522 ConsString* cs = ConsString::cast(this); |
| 517 if (String::cast(cs->second())->length() == 0) { | 523 if (String::cast(cs->second())->length() == 0) { |
| 518 return this; | 524 return this; |
| 519 } | 525 } |
| 520 // There's little point in putting the flat string in new space if the | 526 // There's little point in putting the flat string in new space if the |
| 521 // cons string is in old space. It can never get GCed until there is | 527 // cons string is in old space. It can never get GCed until there is |
| 522 // an old space GC. | 528 // an old space GC. |
| (...skipping 5905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6428 // No break point. | 6434 // No break point. |
| 6429 if (break_point_objects()->IsUndefined()) return 0; | 6435 if (break_point_objects()->IsUndefined()) return 0; |
| 6430 // Single beak point. | 6436 // Single beak point. |
| 6431 if (!break_point_objects()->IsFixedArray()) return 1; | 6437 if (!break_point_objects()->IsFixedArray()) return 1; |
| 6432 // Multiple break points. | 6438 // Multiple break points. |
| 6433 return FixedArray::cast(break_point_objects())->length(); | 6439 return FixedArray::cast(break_point_objects())->length(); |
| 6434 } | 6440 } |
| 6435 | 6441 |
| 6436 | 6442 |
| 6437 } } // namespace v8::internal | 6443 } } // namespace v8::internal |
| OLD | NEW |