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 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 } | 1413 } |
1414 | 1414 |
1415 | 1415 |
1416 Handle<String> NewRawTwoByteString(int size) { | 1416 Handle<String> NewRawTwoByteString(int size) { |
1417 CALL_HEAP_FUNCTION(Heap::AllocateRawTwoByteString(size), String); | 1417 CALL_HEAP_FUNCTION(Heap::AllocateRawTwoByteString(size), String); |
1418 } | 1418 } |
1419 | 1419 |
1420 | 1420 |
1421 void AddElement(Object* element) { | 1421 void AddElement(Object* element) { |
1422 ASSERT(element->IsSmi() || element->IsString()); | 1422 ASSERT(element->IsSmi() || element->IsString()); |
| 1423 ASSERT(parts_->length() > part_count_); |
1423 parts_->set(part_count_, element); | 1424 parts_->set(part_count_, element); |
1424 part_count_++; | 1425 part_count_++; |
1425 } | 1426 } |
1426 | 1427 |
1427 Handle<String> subject_; | 1428 Handle<String> subject_; |
1428 Handle<FixedArray> parts_; | 1429 Handle<FixedArray> parts_; |
1429 int part_count_; | 1430 int part_count_; |
1430 int character_count_; | 1431 int character_count_; |
1431 bool is_ascii_; | 1432 bool is_ascii_; |
1432 }; | 1433 }; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 if (double_digit_ref <= capture_count) { | 1583 if (double_digit_ref <= capture_count) { |
1583 next_index = second_digit_index; | 1584 next_index = second_digit_index; |
1584 capture_ref = double_digit_ref; | 1585 capture_ref = double_digit_ref; |
1585 } | 1586 } |
1586 } | 1587 } |
1587 } | 1588 } |
1588 if (capture_ref > 0) { | 1589 if (capture_ref > 0) { |
1589 if (i > last) { | 1590 if (i > last) { |
1590 parts->Add(ReplacementPart::ReplacementSubString(last, i)); | 1591 parts->Add(ReplacementPart::ReplacementSubString(last, i)); |
1591 } | 1592 } |
| 1593 ASSERT(capture_ref <= capture_count); |
1592 parts->Add(ReplacementPart::SubjectCapture(capture_ref)); | 1594 parts->Add(ReplacementPart::SubjectCapture(capture_ref)); |
1593 last = next_index + 1; | 1595 last = next_index + 1; |
1594 } | 1596 } |
1595 i = next_index; | 1597 i = next_index; |
1596 break; | 1598 break; |
1597 } | 1599 } |
1598 default: | 1600 default: |
1599 i = next_index; | 1601 i = next_index; |
1600 break; | 1602 break; |
1601 } | 1603 } |
(...skipping 5481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7083 } else { | 7085 } else { |
7084 // Handle last resort GC and make sure to allow future allocations | 7086 // Handle last resort GC and make sure to allow future allocations |
7085 // to grow the heap without causing GCs (if possible). | 7087 // to grow the heap without causing GCs (if possible). |
7086 Counters::gc_last_resort_from_js.Increment(); | 7088 Counters::gc_last_resort_from_js.Increment(); |
7087 Heap::CollectAllGarbage(); | 7089 Heap::CollectAllGarbage(); |
7088 } | 7090 } |
7089 } | 7091 } |
7090 | 7092 |
7091 | 7093 |
7092 } } // namespace v8::internal | 7094 } } // namespace v8::internal |
OLD | NEW |