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 3483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3494 } | 3494 } |
3495 default: | 3495 default: |
3496 break; | 3496 break; |
3497 } | 3497 } |
3498 | 3498 |
3499 UNREACHABLE(); | 3499 UNREACHABLE(); |
3500 return 0; | 3500 return 0; |
3501 } | 3501 } |
3502 | 3502 |
3503 | 3503 |
3504 FlatStringReader* FlatStringReader::top_ = NULL; | |
3505 | |
3506 | |
3507 FlatStringReader::FlatStringReader(Handle<String> str) | |
3508 : str_(str.location()), | |
Mads Ager (chromium)
2008/11/25 21:09:41
Four space indent. More occurrences below.
Christian Plesner Hansen
2008/11/26 06:49:56
Fixed.
| |
3509 length_(str->length()), | |
3510 prev_(top_) { | |
3511 top_ = this; | |
3512 RefreshState(); | |
3513 } | |
3514 | |
3515 | |
3516 FlatStringReader::FlatStringReader(Vector<const char> input) | |
3517 : str_(NULL), | |
3518 is_ascii_(true), | |
3519 length_(input.length()), | |
3520 start_(input.start()), | |
3521 prev_(top_) { | |
3522 top_ = this; | |
3523 } | |
3524 | |
3525 | |
3526 FlatStringReader::~FlatStringReader() { | |
3527 ASSERT_EQ(top_, this); | |
3528 top_ = prev_; | |
3529 } | |
3530 | |
3531 | |
3532 void FlatStringReader::RefreshState() { | |
3533 if (str_ == NULL) return; | |
3534 Handle<String> str(str_); | |
3535 StringShape shape(*str); | |
3536 ASSERT(str->IsFlat(shape)); | |
3537 is_ascii_ = shape.IsAsciiRepresentation(); | |
3538 if (is_ascii_) { | |
3539 start_ = str->ToAsciiVector().start(); | |
3540 } else { | |
3541 start_ = str->ToUC16Vector().start(); | |
3542 } | |
3543 } | |
3544 | |
3545 | |
3546 void FlatStringReader::PostGarbageCollectionProcessing() { | |
3547 FlatStringReader* current = top_; | |
3548 while (current != NULL) { | |
3549 current->RefreshState(); | |
3550 current = current->prev_; | |
3551 } | |
3552 } | |
3553 | |
3554 | |
3504 void StringInputBuffer::Seek(unsigned pos) { | 3555 void StringInputBuffer::Seek(unsigned pos) { |
3505 Reset(pos, input_); | 3556 Reset(pos, input_); |
3506 } | 3557 } |
3507 | 3558 |
3508 | 3559 |
3509 void SafeStringInputBuffer::Seek(unsigned pos) { | 3560 void SafeStringInputBuffer::Seek(unsigned pos) { |
3510 Reset(pos, input_); | 3561 Reset(pos, input_); |
3511 } | 3562 } |
3512 | 3563 |
3513 | 3564 |
(...skipping 3389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6903 // No break point. | 6954 // No break point. |
6904 if (break_point_objects()->IsUndefined()) return 0; | 6955 if (break_point_objects()->IsUndefined()) return 0; |
6905 // Single beak point. | 6956 // Single beak point. |
6906 if (!break_point_objects()->IsFixedArray()) return 1; | 6957 if (!break_point_objects()->IsFixedArray()) return 1; |
6907 // Multiple break points. | 6958 // Multiple break points. |
6908 return FixedArray::cast(break_point_objects())->length(); | 6959 return FixedArray::cast(break_point_objects())->length(); |
6909 } | 6960 } |
6910 | 6961 |
6911 | 6962 |
6912 } } // namespace v8::internal | 6963 } } // namespace v8::internal |
OLD | NEW |