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

Side by Side Diff: runtime/lib/string_patch.dart

Issue 2453463006: Revert "Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern."" (Closed)
Patch Set: Created 4 years, 1 month 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 | « runtime/lib/object_patch.dart ('k') | runtime/vm/aot_optimizer.h » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 const int _maxAscii = 0x7f; 5 const int _maxAscii = 0x7f;
6 const int _maxLatin1 = 0xff; 6 const int _maxLatin1 = 0xff;
7 const int _maxUtf16 = 0xffff; 7 const int _maxUtf16 = 0xffff;
8 const int _maxUnicode = 0x10ffff; 8 const int _maxUnicode = 0x10ffff;
9 9
10 @patch class String { 10 @patch class String {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // For longer strings, calling into C++ to create the result of a 76 // For longer strings, calling into C++ to create the result of a
77 // [replaceAll] is faster than [_joinReplaceAllOneByteResult]. 77 // [replaceAll] is faster than [_joinReplaceAllOneByteResult].
78 // TODO(lrn): See if this limit can be tweaked. 78 // TODO(lrn): See if this limit can be tweaked.
79 static const int _maxJoinReplaceOneByteStringLength = 500; 79 static const int _maxJoinReplaceOneByteStringLength = 500;
80 80
81 factory _StringBase._uninstantiable() { 81 factory _StringBase._uninstantiable() {
82 throw new UnsupportedError( 82 throw new UnsupportedError(
83 "_StringBase can't be instaniated"); 83 "_StringBase can't be instaniated");
84 } 84 }
85 85
86 Type get runtimeType => String;
87
88 int get hashCode native "String_getHashCode"; 86 int get hashCode native "String_getHashCode";
89 87
90 bool get _isOneByte { 88 bool get _isOneByte {
91 // Alternatively return false and override it on one-byte string classes. 89 // Alternatively return false and override it on one-byte string classes.
92 int id = ClassID.getID(this); 90 int id = ClassID.getID(this);
93 return id == ClassID.cidOneByteString || 91 return id == ClassID.cidOneByteString ||
94 id == ClassID.cidExternalOneByteString; 92 id == ClassID.cidExternalOneByteString;
95 } 93 }
96 94
97 /** 95 /**
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 int end = index + _pattern.length; 1357 int end = index + _pattern.length;
1360 _current = new _StringMatch(index, _input, _pattern); 1358 _current = new _StringMatch(index, _input, _pattern);
1361 // Empty match, don't start at same location again. 1359 // Empty match, don't start at same location again.
1362 if (end == _index) end++; 1360 if (end == _index) end++;
1363 _index = end; 1361 _index = end;
1364 return true; 1362 return true;
1365 } 1363 }
1366 1364
1367 Match get current => _current; 1365 Match get current => _current;
1368 } 1366 }
OLDNEW
« no previous file with comments | « runtime/lib/object_patch.dart ('k') | runtime/vm/aot_optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698