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 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 24 matching lines...) Expand all Loading... |
35 // Note that lazy initializers are treated like functions (but are not | 35 // Note that lazy initializers are treated like functions (but are not |
36 // of type [FunctionElement]. | 36 // of type [FunctionElement]. |
37 addCompiledFunction(Element function) => compiledFunctions.add(function); | 37 addCompiledFunction(Element function) => compiledFunctions.add(function); |
38 } | 38 } |
39 | 39 |
40 class OptionalParameterTypes { | 40 class OptionalParameterTypes { |
41 final List<SourceString> names; | 41 final List<SourceString> names; |
42 final List<HType> types; | 42 final List<HType> types; |
43 | 43 |
44 OptionalParameterTypes(int optionalArgumentsCount) | 44 OptionalParameterTypes(int optionalArgumentsCount) |
45 : names = new List<SourceString>.fixedLength(optionalArgumentsCount), | 45 : names = new List<SourceString>(optionalArgumentsCount), |
46 types = new List<HType>.fixedLength(optionalArgumentsCount); | 46 types = new List<HType>(optionalArgumentsCount); |
47 | 47 |
48 int get length => names.length; | 48 int get length => names.length; |
49 SourceString name(int index) => names[index]; | 49 SourceString name(int index) => names[index]; |
50 HType type(int index) => types[index]; | 50 HType type(int index) => types[index]; |
51 int indexOf(SourceString name) => names.indexOf(name); | 51 int indexOf(SourceString name) => names.indexOf(name); |
52 | 52 |
53 HType typeFor(SourceString name) { | 53 HType typeFor(SourceString name) { |
54 int index = indexOf(name); | 54 int index = indexOf(name); |
55 if (index == -1) return null; | 55 if (index == -1) return null; |
56 return type(index); | 56 return type(index); |
57 } | 57 } |
58 | 58 |
59 void update(int index, SourceString name, HType type) { | 59 void update(int index, SourceString name, HType type) { |
60 names[index] = name; | 60 names[index] = name; |
61 types[index] = type; | 61 types[index] = type; |
62 } | 62 } |
63 | 63 |
64 String toString() => "OptionalParameterTypes($names, $types)"; | 64 String toString() => "OptionalParameterTypes($names, $types)"; |
65 } | 65 } |
66 | 66 |
67 class HTypeList { | 67 class HTypeList { |
68 final List<HType> types; | 68 final List<HType> types; |
69 final List<SourceString> namedArguments; | 69 final List<SourceString> namedArguments; |
70 | 70 |
71 HTypeList(int length) | 71 HTypeList(int length) |
72 : types = new List<HType>.fixedLength(length), | 72 : types = new List<HType>(length), |
73 namedArguments = null; | 73 namedArguments = null; |
74 HTypeList.withNamedArguments(int length, this.namedArguments) | 74 HTypeList.withNamedArguments(int length, this.namedArguments) |
75 : types = new List<HType>.fixedLength(length); | 75 : types = new List<HType>(length); |
76 const HTypeList.withAllUnknown() | 76 const HTypeList.withAllUnknown() |
77 : types = null, | 77 : types = null, |
78 namedArguments = null; | 78 namedArguments = null; |
79 | 79 |
80 factory HTypeList.fromStaticInvocation(HInvokeStatic node) { | 80 factory HTypeList.fromStaticInvocation(HInvokeStatic node) { |
81 bool allUnknown = true; | 81 bool allUnknown = true; |
82 for (int i = 1; i < node.inputs.length; i++) { | 82 for (int i = 1; i < node.inputs.length; i++) { |
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; |
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 * | 1499 * |
1500 * Invariant: [element] must be a declaration element. | 1500 * Invariant: [element] must be a declaration element. |
1501 */ | 1501 */ |
1502 void eagerRecompile(Element element) { | 1502 void eagerRecompile(Element element) { |
1503 assert(invariant(element, element.isDeclaration)); | 1503 assert(invariant(element, element.isDeclaration)); |
1504 generatedCode.remove(element); | 1504 generatedCode.remove(element); |
1505 generatedBailoutCode.remove(element); | 1505 generatedBailoutCode.remove(element); |
1506 compiler.enqueuer.codegen.addToWorkList(element); | 1506 compiler.enqueuer.codegen.addToWorkList(element); |
1507 } | 1507 } |
1508 } | 1508 } |
OLD | NEW |