| OLD | NEW |
| 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 class InvocationInfo { | 5 class InvocationInfo { |
| 6 int parameterCount = -1; | 6 int parameterCount = -1; |
| 7 List<HType> providedTypes; | 7 List<HType> providedTypes; |
| 8 List<Element> compiledFunctions; | 8 List<Element> compiledFunctions; |
| 9 | 9 |
| 10 InvocationInfo(HInvoke node, HTypeMap types) | 10 InvocationInfo(HInvoke node, HTypeMap types) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 compiledFunctions.clear(); | 55 compiledFunctions.clear(); |
| 56 } | 56 } |
| 57 // If all information is lost no need to keep it around. | 57 // If all information is lost no need to keep it around. |
| 58 if (allUnknown) clearTypeInformation(); | 58 if (allUnknown) clearTypeInformation(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 addCompiledFunction(FunctionElement function) => | 61 addCompiledFunction(FunctionElement function) => |
| 62 compiledFunctions.add(function); | 62 compiledFunctions.add(function); |
| 63 | 63 |
| 64 void clearTypeInformation() { providedTypes = null; } | 64 void clearTypeInformation() { providedTypes = null; } |
| 65 bool get hasTypeInformation() => providedTypes != null; | 65 bool get hasTypeInformation => providedTypes != null; |
| 66 | 66 |
| 67 } | 67 } |
| 68 | 68 |
| 69 class ReturnInfo { | 69 class ReturnInfo { |
| 70 HType returnType; | 70 HType returnType; |
| 71 List<Element> compiledFunctions; | 71 List<Element> compiledFunctions; |
| 72 | 72 |
| 73 ReturnInfo(HType this.returnType) | 73 ReturnInfo(HType this.returnType) |
| 74 : compiledFunctions = new List<Element>(); | 74 : compiledFunctions = new List<Element>(); |
| 75 | 75 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 final Map<Element, Map<Element, HType>> fieldInitializers; | 111 final Map<Element, Map<Element, HType>> fieldInitializers; |
| 112 final Map<Element, Map<Element, HType>> fieldConstructorSetters; | 112 final Map<Element, Map<Element, HType>> fieldConstructorSetters; |
| 113 final Map<Element, Map<Element, HType>> fieldSettersType; | 113 final Map<Element, Map<Element, HType>> fieldSettersType; |
| 114 | 114 |
| 115 final Map<Element, InvocationInfo> staticInvocationInfo; | 115 final Map<Element, InvocationInfo> staticInvocationInfo; |
| 116 final Map<SourceString, Map<Selector, InvocationInfo>> invocationInfo; | 116 final Map<SourceString, Map<Selector, InvocationInfo>> invocationInfo; |
| 117 final Map<Element, ReturnInfo> returnInfo; | 117 final Map<Element, ReturnInfo> returnInfo; |
| 118 | 118 |
| 119 final List<Element> invalidateAfterCodegen; | 119 final List<Element> invalidateAfterCodegen; |
| 120 | 120 |
| 121 List<CompilerTask> get tasks() { | 121 List<CompilerTask> get tasks { |
| 122 return <CompilerTask>[builder, optimizer, generator, emitter]; | 122 return <CompilerTask>[builder, optimizer, generator, emitter]; |
| 123 } | 123 } |
| 124 | 124 |
| 125 JavaScriptBackend(Compiler compiler, bool generateSourceMap) | 125 JavaScriptBackend(Compiler compiler, bool generateSourceMap) |
| 126 : emitter = new CodeEmitterTask(compiler, generateSourceMap), | 126 : emitter = new CodeEmitterTask(compiler, generateSourceMap), |
| 127 fieldInitializers = new Map<Element, Map<Element, HType>>(), | 127 fieldInitializers = new Map<Element, Map<Element, HType>>(), |
| 128 fieldConstructorSetters = new Map<Element, Map<Element, HType>>(), | 128 fieldConstructorSetters = new Map<Element, Map<Element, HType>>(), |
| 129 fieldSettersType = new Map<Element, Map<Element, HType>>(), | 129 fieldSettersType = new Map<Element, Map<Element, HType>>(), |
| 130 invocationInfo = new Map<SourceString, Map<Selector, InvocationInfo>>(), | 130 invocationInfo = new Map<SourceString, Map<Selector, InvocationInfo>>(), |
| 131 staticInvocationInfo = new Map<Element, InvocationInfo>(), | 131 staticInvocationInfo = new Map<Element, InvocationInfo>(), |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 HType optimisticReturnTypesWithRecompilationOnTypeChange( | 411 HType optimisticReturnTypesWithRecompilationOnTypeChange( |
| 412 FunctionElement caller, FunctionElement callee) { | 412 FunctionElement caller, FunctionElement callee) { |
| 413 returnInfo.putIfAbsent(callee, () => new ReturnInfo.unknownType()); | 413 returnInfo.putIfAbsent(callee, () => new ReturnInfo.unknownType()); |
| 414 ReturnInfo info = returnInfo[callee]; | 414 ReturnInfo info = returnInfo[callee]; |
| 415 if (info.returnType != HType.UNKNOWN && caller != null) { | 415 if (info.returnType != HType.UNKNOWN && caller != null) { |
| 416 info.addCompiledFunction(caller); | 416 info.addCompiledFunction(caller); |
| 417 } | 417 } |
| 418 return info.returnType; | 418 return info.returnType; |
| 419 } | 419 } |
| 420 } | 420 } |
| OLD | NEW |