Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: src/jsregexp.cc

Issue 933673002: Cleanup: Remove DCHECK_RESULT macro. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: USE Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/base/logging.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/ast.h" 7 #include "src/ast.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/compilation-cache.h" 9 #include "src/compilation-cache.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 5580 matching lines...) Expand 10 before | Expand all | Expand 10 after
5591 5591
5592 const uc16 DispatchTable::Config::kNoKey = unibrow::Utf8::kBadChar; 5592 const uc16 DispatchTable::Config::kNoKey = unibrow::Utf8::kBadChar;
5593 5593
5594 5594
5595 void DispatchTable::AddRange(CharacterRange full_range, int value, 5595 void DispatchTable::AddRange(CharacterRange full_range, int value,
5596 Zone* zone) { 5596 Zone* zone) {
5597 CharacterRange current = full_range; 5597 CharacterRange current = full_range;
5598 if (tree()->is_empty()) { 5598 if (tree()->is_empty()) {
5599 // If this is the first range we just insert into the table. 5599 // If this is the first range we just insert into the table.
5600 ZoneSplayTree<Config>::Locator loc; 5600 ZoneSplayTree<Config>::Locator loc;
5601 DCHECK_RESULT(tree()->Insert(current.from(), &loc)); 5601 bool inserted = tree()->Insert(current.from(), &loc);
5602 DCHECK(inserted);
5603 USE(inserted);
5602 loc.set_value(Entry(current.from(), current.to(), 5604 loc.set_value(Entry(current.from(), current.to(),
5603 empty()->Extend(value, zone))); 5605 empty()->Extend(value, zone)));
5604 return; 5606 return;
5605 } 5607 }
5606 // First see if there is a range to the left of this one that 5608 // First see if there is a range to the left of this one that
5607 // overlaps. 5609 // overlaps.
5608 ZoneSplayTree<Config>::Locator loc; 5610 ZoneSplayTree<Config>::Locator loc;
5609 if (tree()->FindGreatestLessThan(current.from(), &loc)) { 5611 if (tree()->FindGreatestLessThan(current.from(), &loc)) {
5610 Entry* entry = &loc.value(); 5612 Entry* entry = &loc.value();
5611 // If we've found a range that overlaps with this one, and it 5613 // If we've found a range that overlaps with this one, and it
5612 // starts strictly to the left of this one, we have to fix it 5614 // starts strictly to the left of this one, we have to fix it
5613 // because the following code only handles ranges that start on 5615 // because the following code only handles ranges that start on
5614 // or after the start point of the range we're adding. 5616 // or after the start point of the range we're adding.
5615 if (entry->from() < current.from() && entry->to() >= current.from()) { 5617 if (entry->from() < current.from() && entry->to() >= current.from()) {
5616 // Snap the overlapping range in half around the start point of 5618 // Snap the overlapping range in half around the start point of
5617 // the range we're adding. 5619 // the range we're adding.
5618 CharacterRange left(entry->from(), current.from() - 1); 5620 CharacterRange left(entry->from(), current.from() - 1);
5619 CharacterRange right(current.from(), entry->to()); 5621 CharacterRange right(current.from(), entry->to());
5620 // The left part of the overlapping range doesn't overlap. 5622 // The left part of the overlapping range doesn't overlap.
5621 // Truncate the whole entry to be just the left part. 5623 // Truncate the whole entry to be just the left part.
5622 entry->set_to(left.to()); 5624 entry->set_to(left.to());
5623 // The right part is the one that overlaps. We add this part 5625 // The right part is the one that overlaps. We add this part
5624 // to the map and let the next step deal with merging it with 5626 // to the map and let the next step deal with merging it with
5625 // the range we're adding. 5627 // the range we're adding.
5626 ZoneSplayTree<Config>::Locator loc; 5628 ZoneSplayTree<Config>::Locator loc;
5627 DCHECK_RESULT(tree()->Insert(right.from(), &loc)); 5629 bool inserted = tree()->Insert(right.from(), &loc);
5630 DCHECK(inserted);
5631 USE(inserted);
5628 loc.set_value(Entry(right.from(), 5632 loc.set_value(Entry(right.from(),
5629 right.to(), 5633 right.to(),
5630 entry->out_set())); 5634 entry->out_set()));
5631 } 5635 }
5632 } 5636 }
5633 while (current.is_valid()) { 5637 while (current.is_valid()) {
5634 if (tree()->FindLeastGreaterThan(current.from(), &loc) && 5638 if (tree()->FindLeastGreaterThan(current.from(), &loc) &&
5635 (loc.value().from() <= current.to()) && 5639 (loc.value().from() <= current.to()) &&
5636 (loc.value().to() >= current.from())) { 5640 (loc.value().to() >= current.from())) {
5637 Entry* entry = &loc.value(); 5641 Entry* entry = &loc.value();
5638 // We have overlap. If there is space between the start point of 5642 // We have overlap. If there is space between the start point of
5639 // the range we're adding and where the overlapping range starts 5643 // the range we're adding and where the overlapping range starts
5640 // then we have to add a range covering just that space. 5644 // then we have to add a range covering just that space.
5641 if (current.from() < entry->from()) { 5645 if (current.from() < entry->from()) {
5642 ZoneSplayTree<Config>::Locator ins; 5646 ZoneSplayTree<Config>::Locator ins;
5643 DCHECK_RESULT(tree()->Insert(current.from(), &ins)); 5647 bool inserted = tree()->Insert(current.from(), &ins);
5648 DCHECK(inserted);
5649 USE(inserted);
5644 ins.set_value(Entry(current.from(), 5650 ins.set_value(Entry(current.from(),
5645 entry->from() - 1, 5651 entry->from() - 1,
5646 empty()->Extend(value, zone))); 5652 empty()->Extend(value, zone)));
5647 current.set_from(entry->from()); 5653 current.set_from(entry->from());
5648 } 5654 }
5649 DCHECK_EQ(current.from(), entry->from()); 5655 DCHECK_EQ(current.from(), entry->from());
5650 // If the overlapping range extends beyond the one we want to add 5656 // If the overlapping range extends beyond the one we want to add
5651 // we have to snap the right part off and add it separately. 5657 // we have to snap the right part off and add it separately.
5652 if (entry->to() > current.to()) { 5658 if (entry->to() > current.to()) {
5653 ZoneSplayTree<Config>::Locator ins; 5659 ZoneSplayTree<Config>::Locator ins;
5654 DCHECK_RESULT(tree()->Insert(current.to() + 1, &ins)); 5660 bool inserted = tree()->Insert(current.to() + 1, &ins);
5661 DCHECK(inserted);
5662 USE(inserted);
5655 ins.set_value(Entry(current.to() + 1, 5663 ins.set_value(Entry(current.to() + 1,
5656 entry->to(), 5664 entry->to(),
5657 entry->out_set())); 5665 entry->out_set()));
5658 entry->set_to(current.to()); 5666 entry->set_to(current.to());
5659 } 5667 }
5660 DCHECK(entry->to() <= current.to()); 5668 DCHECK(entry->to() <= current.to());
5661 // The overlapping range is now completely contained by the range 5669 // The overlapping range is now completely contained by the range
5662 // we're adding so we can just update it and move the start point 5670 // we're adding so we can just update it and move the start point
5663 // of the range we're adding just past it. 5671 // of the range we're adding just past it.
5664 entry->AddValue(value, zone); 5672 entry->AddValue(value, zone);
5665 // Bail out if the last interval ended at 0xFFFF since otherwise 5673 // Bail out if the last interval ended at 0xFFFF since otherwise
5666 // adding 1 will wrap around to 0. 5674 // adding 1 will wrap around to 0.
5667 if (entry->to() == String::kMaxUtf16CodeUnit) 5675 if (entry->to() == String::kMaxUtf16CodeUnit)
5668 break; 5676 break;
5669 DCHECK(entry->to() + 1 > current.from()); 5677 DCHECK(entry->to() + 1 > current.from());
5670 current.set_from(entry->to() + 1); 5678 current.set_from(entry->to() + 1);
5671 } else { 5679 } else {
5672 // There is no overlap so we can just add the range 5680 // There is no overlap so we can just add the range
5673 ZoneSplayTree<Config>::Locator ins; 5681 ZoneSplayTree<Config>::Locator ins;
5674 DCHECK_RESULT(tree()->Insert(current.from(), &ins)); 5682 bool inserted = tree()->Insert(current.from(), &ins);
5683 DCHECK(inserted);
5684 USE(inserted);
5675 ins.set_value(Entry(current.from(), 5685 ins.set_value(Entry(current.from(),
5676 current.to(), 5686 current.to(),
5677 empty()->Extend(value, zone))); 5687 empty()->Extend(value, zone)));
5678 break; 5688 break;
5679 } 5689 }
5680 } 5690 }
5681 } 5691 }
5682 5692
5683 5693
5684 OutSet* DispatchTable::Get(uc16 value) { 5694 OutSet* DispatchTable::Get(uc16 value) {
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
6153 Heap* heap = pattern->GetHeap(); 6163 Heap* heap = pattern->GetHeap();
6154 bool too_much = pattern->length() > RegExpImpl::kRegExpTooLargeToOptimize; 6164 bool too_much = pattern->length() > RegExpImpl::kRegExpTooLargeToOptimize;
6155 if (heap->total_regexp_code_generated() > RegExpImpl::kRegExpCompiledLimit && 6165 if (heap->total_regexp_code_generated() > RegExpImpl::kRegExpCompiledLimit &&
6156 heap->isolate()->memory_allocator()->SizeExecutable() > 6166 heap->isolate()->memory_allocator()->SizeExecutable() >
6157 RegExpImpl::kRegExpExecutableMemoryLimit) { 6167 RegExpImpl::kRegExpExecutableMemoryLimit) {
6158 too_much = true; 6168 too_much = true;
6159 } 6169 }
6160 return too_much; 6170 return too_much;
6161 } 6171 }
6162 }} // namespace v8::internal 6172 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/base/logging.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698