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

Side by Side Diff: src/objects.cc

Issue 1798073002: Optimize flattening of cons strings with equal left and right-side. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 11521 matching lines...) Expand 10 before | Expand all | Expand 10 after
11532 } 11532 }
11533 case kOneByteStringTag | kConsStringTag: 11533 case kOneByteStringTag | kConsStringTag:
11534 case kTwoByteStringTag | kConsStringTag: { 11534 case kTwoByteStringTag | kConsStringTag: {
11535 ConsString* cons_string = ConsString::cast(source); 11535 ConsString* cons_string = ConsString::cast(source);
11536 String* first = cons_string->first(); 11536 String* first = cons_string->first();
11537 int boundary = first->length(); 11537 int boundary = first->length();
11538 if (to - boundary >= boundary - from) { 11538 if (to - boundary >= boundary - from) {
11539 // Right hand side is longer. Recurse over left. 11539 // Right hand side is longer. Recurse over left.
11540 if (from < boundary) { 11540 if (from < boundary) {
11541 WriteToFlat(first, sink, from, boundary); 11541 WriteToFlat(first, sink, from, boundary);
11542 if (from == 0 && cons_string->second() == first) {
11543 CopyChars(sink + boundary, sink, boundary);
11544 return;
11545 }
11542 sink += boundary - from; 11546 sink += boundary - from;
11543 from = 0; 11547 from = 0;
11544 } else { 11548 } else {
11545 from -= boundary; 11549 from -= boundary;
11546 } 11550 }
11547 to -= boundary; 11551 to -= boundary;
11548 source = cons_string->second(); 11552 source = cons_string->second();
11549 } else { 11553 } else {
11550 // Left hand side is longer. Recurse over right. 11554 // Left hand side is longer. Recurse over right.
11551 if (to > boundary) { 11555 if (to > boundary) {
(...skipping 8232 matching lines...) Expand 10 before | Expand all | Expand 10 after
19784 if (cell->value() != *new_value) { 19788 if (cell->value() != *new_value) {
19785 cell->set_value(*new_value); 19789 cell->set_value(*new_value);
19786 Isolate* isolate = cell->GetIsolate(); 19790 Isolate* isolate = cell->GetIsolate();
19787 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19791 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19788 isolate, DependentCode::kPropertyCellChangedGroup); 19792 isolate, DependentCode::kPropertyCellChangedGroup);
19789 } 19793 }
19790 } 19794 }
19791 19795
19792 } // namespace internal 19796 } // namespace internal
19793 } // namespace v8 19797 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698