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

Side by Side Diff: src/objects.cc

Issue 2377983002: Allow empty first parts of ConsStrings (Closed)
Patch Set: Created 4 years, 2 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 | test/mjsunit/regress/regress-5440.js » ('j') | 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 <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 11074 matching lines...) Expand 10 before | Expand all | Expand 10 after
11085 cons_string = ConsString::cast(string); 11085 cons_string = ConsString::cast(string);
11086 PushRight(cons_string); 11086 PushRight(cons_string);
11087 // Need to traverse all the way left. 11087 // Need to traverse all the way left.
11088 while (true) { 11088 while (true) {
11089 // Continue left. 11089 // Continue left.
11090 string = cons_string->first(); 11090 string = cons_string->first();
11091 type = string->map()->instance_type(); 11091 type = string->map()->instance_type();
11092 if ((type & kStringRepresentationMask) != kConsStringTag) { 11092 if ((type & kStringRepresentationMask) != kConsStringTag) {
11093 AdjustMaximumDepth(); 11093 AdjustMaximumDepth();
11094 int length = string->length(); 11094 int length = string->length();
11095 DCHECK(length != 0); 11095 if (length == 0) break; // Skip empty left-hand sides of ConsStrings.
11096 consumed_ += length; 11096 consumed_ += length;
11097 return string; 11097 return string;
11098 } 11098 }
11099 cons_string = ConsString::cast(string); 11099 cons_string = ConsString::cast(string);
11100 PushLeft(cons_string); 11100 PushLeft(cons_string);
11101 } 11101 }
11102 } 11102 }
11103 UNREACHABLE(); 11103 UNREACHABLE();
11104 return NULL; 11104 return NULL;
11105 } 11105 }
(...skipping 8789 matching lines...) Expand 10 before | Expand all | Expand 10 after
19895 .is_null()) { 19895 .is_null()) {
19896 return false; 19896 return false;
19897 } 19897 }
19898 } 19898 }
19899 19899
19900 return true; 19900 return true;
19901 } 19901 }
19902 19902
19903 } // namespace internal 19903 } // namespace internal
19904 } // namespace v8 19904 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5440.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698