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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 12310103: Small cleanups in RegExp to avoid generating lots of code just because there is a try/catch in our … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/core_patch.dart » ('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 part of js_backend; 5 part of js_backend;
6 6
7 typedef void Recompile(Element element); 7 typedef void Recompile(Element element);
8 8
9 class ReturnInfo { 9 class ReturnInfo {
10 HType returnType; 10 HType returnType;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (node.inputs[i].instructionType != HType.UNKNOWN) { 83 if (node.inputs[i].instructionType != HType.UNKNOWN) {
84 allUnknown = false; 84 allUnknown = false;
85 break; 85 break;
86 } 86 }
87 } 87 }
88 if (allUnknown) return HTypeList.ALL_UNKNOWN; 88 if (allUnknown) return HTypeList.ALL_UNKNOWN;
89 89
90 HTypeList result = new HTypeList(node.inputs.length - 1); 90 HTypeList result = new HTypeList(node.inputs.length - 1);
91 for (int i = 0; i < result.types.length; i++) { 91 for (int i = 0; i < result.types.length; i++) {
92 result.types[i] = node.inputs[i + 1].instructionType; 92 result.types[i] = node.inputs[i + 1].instructionType;
93 assert(!result.types[i].isConflicting());
93 } 94 }
94 return result; 95 return result;
95 } 96 }
96 97
97 factory HTypeList.fromDynamicInvocation(HInvokeDynamic node, 98 factory HTypeList.fromDynamicInvocation(HInvokeDynamic node,
98 Selector selector) { 99 Selector selector) {
99 HTypeList result; 100 HTypeList result;
100 int argumentsCount = node.inputs.length - 1; 101 int argumentsCount = node.inputs.length - 1;
101 int startInvokeIndex = HInvoke.ARGUMENTS_OFFSET; 102 int startInvokeIndex = HInvoke.ARGUMENTS_OFFSET;
102 103
103 if (node.isInterceptorCall) { 104 if (node.isInterceptorCall) {
104 argumentsCount--; 105 argumentsCount--;
105 startInvokeIndex++; 106 startInvokeIndex++;
106 } 107 }
107 108
108 if (selector.namedArgumentCount > 0) { 109 if (selector.namedArgumentCount > 0) {
109 result = 110 result =
110 new HTypeList.withNamedArguments( 111 new HTypeList.withNamedArguments(
111 argumentsCount, selector.namedArguments); 112 argumentsCount, selector.namedArguments);
112 } else { 113 } else {
113 result = new HTypeList(argumentsCount); 114 result = new HTypeList(argumentsCount);
114 } 115 }
115 116
116 for (int i = 0; i < result.types.length; i++) { 117 for (int i = 0; i < result.types.length; i++) {
117 result.types[i] = node.inputs[i + startInvokeIndex].instructionType; 118 result.types[i] = node.inputs[i + startInvokeIndex].instructionType;
119 assert(!result.types[i].isConflicting());
118 } 120 }
119 return result; 121 return result;
120 } 122 }
121 123
122 static const HTypeList ALL_UNKNOWN = const HTypeList.withAllUnknown(); 124 static const HTypeList ALL_UNKNOWN = const HTypeList.withAllUnknown();
123 125
124 bool get allUnknown => types == null; 126 bool get allUnknown => types == null;
125 bool get hasNamedArguments => namedArguments != null; 127 bool get hasNamedArguments => namedArguments != null;
126 int get length => types.length; 128 int get length => types.length;
127 HType operator[](int index) => types[index]; 129 HType operator[](int index) => types[index];
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 int constructorCount(Element element) { 271 int constructorCount(Element element) {
270 assert(element.isClass()); 272 assert(element.isClass());
271 Set<Element> ctors = constructors[element]; 273 Set<Element> ctors = constructors[element];
272 return ctors == null ? 0 : ctors.length; 274 return ctors == null ? 0 : ctors.length;
273 } 275 }
274 276
275 void registerFieldType(Map<Element, HType> typeMap, 277 void registerFieldType(Map<Element, HType> typeMap,
276 Element field, 278 Element field,
277 HType type) { 279 HType type) {
278 assert(field.isField()); 280 assert(field.isField());
281 assert(!type.isConflicting());
279 HType before = optimisticFieldType(field); 282 HType before = optimisticFieldType(field);
280 283
281 HType oldType = typeMap[field]; 284 HType oldType = typeMap[field];
282 HType newType; 285 HType newType;
283 286
284 if (oldType != null) { 287 if (oldType != null) {
285 newType = oldType.union(type, compiler); 288 newType = oldType.union(type, compiler);
286 } else { 289 } else {
287 newType = type; 290 newType = type;
288 } 291 }
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 * 1499 *
1497 * Invariant: [element] must be a declaration element. 1500 * Invariant: [element] must be a declaration element.
1498 */ 1501 */
1499 void eagerRecompile(Element element) { 1502 void eagerRecompile(Element element) {
1500 assert(invariant(element, element.isDeclaration)); 1503 assert(invariant(element, element.isDeclaration));
1501 generatedCode.remove(element); 1504 generatedCode.remove(element);
1502 generatedBailoutCode.remove(element); 1505 generatedBailoutCode.remove(element);
1503 compiler.enqueuer.codegen.addToWorkList(element); 1506 compiler.enqueuer.codegen.addToWorkList(element);
1504 } 1507 }
1505 } 1508 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/core_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698