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

Unified Diff: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart

Issue 2575083002: Pass ClosedWorld directly to codegen tasks (Closed)
Patch Set: Updated cf. comment. Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/interceptor_simplifier.dart ('k') | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
diff --git a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
index 3c85ff073254ae904a1e80ac34864caacfd91184..dbe6749fa5cb1b7e02dc3c06eb7d63ac90bd291e 100644
--- a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
@@ -67,7 +67,6 @@ class KernelAstAdapter {
TreeElements get elements => _resolvedAst.elements;
DiagnosticReporter get reporter => _compiler.reporter;
Element get _target => _resolvedAst.element;
- ClosedWorld get _closedWorld => _compiler.closedWorld;
GlobalTypeInferenceResults get _globalInferenceResults =>
_compiler.globalInference.results;
@@ -129,9 +128,9 @@ class KernelAstAdapter {
return getElement(variable) as LocalElement;
}
- bool getCanThrow(ir.Node procedure) {
+ bool getCanThrow(ir.Node procedure, ClosedWorld closedWorld) {
FunctionElement function = getElement(procedure);
- return !_closedWorld.getCannotThrow(function);
+ return !closedWorld.getCannotThrow(function);
}
TypeMask returnTypeOf(ir.Member node) {
@@ -139,8 +138,8 @@ class KernelAstAdapter {
getElement(node), _globalInferenceResults);
}
- SideEffects getSideEffects(ir.Node node) {
- return _closedWorld.getSideEffectsOfElement(getElement(node));
+ SideEffects getSideEffects(ir.Node node, ClosedWorld closedWorld) {
+ return closedWorld.getSideEffectsOfElement(getElement(node));
}
CallStructure getCallStructure(ir.Arguments arguments) {
@@ -202,13 +201,13 @@ class KernelAstAdapter {
return new Selector.setter(name);
}
- TypeMask typeOfInvocation(ir.MethodInvocation send) {
+ TypeMask typeOfInvocation(ir.MethodInvocation send, ClosedWorld closedWorld) {
ast.Node operatorNode = kernel.nodeToAstOperator[send];
if (operatorNode != null) {
return _resultOf(_target).typeOfOperator(operatorNode);
}
if (send.name.name == '[]=') {
- return _compiler.closedWorld.commonMasks.dynamicType;
+ return closedWorld.commonMasks.dynamicType;
}
return _resultOf(_target).typeOfSend(getNode(send));
}
@@ -217,8 +216,8 @@ class KernelAstAdapter {
return _resultOf(_target).typeOfSend(getNode(getter));
}
- TypeMask typeOfSet(ir.PropertySet setter) {
- return _closedWorld.commonMasks.dynamicType;
+ TypeMask typeOfSet(ir.PropertySet setter, ClosedWorld closedWorld) {
+ return closedWorld.commonMasks.dynamicType;
}
TypeMask typeOfSend(ir.Expression send) {
@@ -226,14 +225,15 @@ class KernelAstAdapter {
return _resultOf(_target).typeOfSend(getNode(send));
}
- TypeMask typeOfListLiteral(Element owner, ir.ListLiteral listLiteral) {
+ TypeMask typeOfListLiteral(
+ Element owner, ir.ListLiteral listLiteral, ClosedWorld closedWorld) {
ast.Node node = getNodeOrNull(listLiteral);
if (node == null) {
assertNodeIsSynthetic(listLiteral);
- return _closedWorld.commonMasks.growableListType;
+ return closedWorld.commonMasks.growableListType;
}
return _resultOf(owner).typeOfNewList(getNode(listLiteral)) ??
- _closedWorld.commonMasks.dynamicType;
+ closedWorld.commonMasks.dynamicType;
}
TypeMask typeOfIterator(ir.ForInStatement forInStatement) {
@@ -248,27 +248,25 @@ class KernelAstAdapter {
return _resultOf(_target).typeOfIteratorMoveNext(getNode(forInStatement));
}
- bool isJsIndexableIterator(ir.ForInStatement forInStatement) {
+ bool isJsIndexableIterator(
+ ir.ForInStatement forInStatement, ClosedWorld closedWorld) {
TypeMask mask = typeOfIterator(forInStatement);
return mask != null &&
- mask.satisfies(_backend.helpers.jsIndexableClass, _closedWorld) &&
+ mask.satisfies(_backend.helpers.jsIndexableClass, closedWorld) &&
// String is indexable but not iterable.
- !mask.satisfies(_backend.helpers.jsStringClass, _closedWorld);
+ !mask.satisfies(_backend.helpers.jsStringClass, closedWorld);
}
- bool isFixedLength(TypeMask mask) {
- JavaScriptBackend backend = _compiler.backend;
+ bool isFixedLength(TypeMask mask, ClosedWorld closedWorld) {
if (mask.isContainer && (mask as ContainerTypeMask).length != null) {
// A container on which we have inferred the length.
return true;
}
// TODO(sra): Recognize any combination of fixed length indexables.
- if (mask.containsOnly(
- _closedWorld.backendClasses.fixedListImplementation) ||
- mask.containsOnly(
- _closedWorld.backendClasses.constListImplementation) ||
- mask.containsOnlyString(_closedWorld) ||
- _closedWorld.commonMasks.isTypedArray(mask)) {
+ if (mask.containsOnly(closedWorld.backendClasses.fixedListImplementation) ||
+ mask.containsOnly(closedWorld.backendClasses.constListImplementation) ||
+ mask.containsOnlyString(closedWorld) ||
+ closedWorld.commonMasks.isTypedArray(mask)) {
return true;
}
return false;
@@ -289,8 +287,9 @@ class KernelAstAdapter {
selector, mask, _globalInferenceResults);
}
- TypeMask typeFromNativeBehavior(native.NativeBehavior nativeBehavior) {
- return TypeMaskFactory.fromNativeBehavior(nativeBehavior, _closedWorld);
+ TypeMask typeFromNativeBehavior(
+ native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) {
+ return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld);
}
ConstantValue getConstantFor(ir.Node node) {
« no previous file with comments | « pkg/compiler/lib/src/ssa/interceptor_simplifier.dart ('k') | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698