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

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

Issue 2338093002: Build entire program with kernel for conversion to ssa. (Closed)
Patch Set: some tweaks Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | pkg/compiler/lib/src/ssa/kernel_impact.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 8682d351d131b39628b3b02079cbcc49e6697177..89ba30e56ce1fef3d7af51928b71b8168065b6d5 100644
--- a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
@@ -34,9 +34,14 @@ class KernelAstAdapter {
this._resolvedAst,
this._nodeToAst,
this._nodeToElement,
+ Map<FieldElement, ir.Field> fields,
Map<FunctionElement, ir.Member> functions,
Map<ClassElement, ir.Class> classes,
Map<LibraryElement, ir.Library> libraries) {
+ // TODO(het): Maybe just use all of the kernel maps directly?
+ for (FieldElement fieldElement in fields.keys) {
+ _nodeToElement[fields[fieldElement]] = fieldElement;
+ }
for (FunctionElement functionElement in functions.keys) {
_nodeToElement[functions[functionElement]] = functionElement;
}
@@ -73,12 +78,11 @@ class KernelAstAdapter {
return result;
}
- bool getCanThrow(ir.Procedure procedure) {
- FunctionElement function = getElement(procedure);
- return !_compiler.world.getCannotThrow(function);
+ bool getCanThrow(ir.Node procedure) {
+ return !_compiler.world.getCannotThrow(getElement(procedure));
}
- TypeMask returnTypeOf(ir.Procedure node) {
+ TypeMask returnTypeOf(ir.Member node) {
return TypeMaskFactory.inferredReturnTypeForElement(
getElement(node), _compiler);
}
@@ -94,10 +98,13 @@ class KernelAstAdapter {
}
// TODO(het): Create the selector directly from the invocation
- Selector getSelector(ir.MethodInvocation invocation) {
+ Selector getSelector(ir.InvocationExpression invocation) {
SelectorKind kind = Elements.isOperatorName(invocation.name.name)
? SelectorKind.OPERATOR
: SelectorKind.CALL;
+ if (invocation.name.name == '[]' || invocation.name.name == '[]=') {
+ kind = SelectorKind.INDEX;
+ }
ir.Name irName = invocation.name;
Name name = new Name(
@@ -107,18 +114,45 @@ class KernelAstAdapter {
return new Selector(kind, name, callStructure);
}
+ Selector getGetterSelector(ir.PropertyGet getter) {
+ ir.Name irName = getter.name;
+ Name name = new Name(
+ irName.name, irName.isPrivate ? getElement(irName.library) : null);
+ return new Selector.getter(name);
+ }
+
TypeMask typeOfInvocation(ir.MethodInvocation invocation) {
return _compiler.globalInference.results
.typeOfSend(getNode(invocation), _elements);
}
+ TypeMask typeOfGet(ir.PropertyGet getter) {
+ return _compiler.globalInference.results
+ .typeOfSend(getNode(getter), _elements);
+ }
+
+ TypeMask inferredTypeOf(ir.Member node) {
+ return TypeMaskFactory.inferredTypeForElement(getElement(node), _compiler);
+ }
+
TypeMask selectorTypeOf(ir.MethodInvocation invocation) {
return TypeMaskFactory.inferredTypeForSelector(
getSelector(invocation), typeOfInvocation(invocation), _compiler);
}
- bool isIntercepted(ir.MethodInvocation invocation) {
- return _backend.isInterceptedSelector(getSelector(invocation));
+ TypeMask selectorGetterTypeOf(ir.PropertyGet getter) {
+ return TypeMaskFactory.inferredTypeForSelector(
+ getGetterSelector(getter), typeOfGet(getter), _compiler);
+ }
+
+ bool isIntercepted(ir.Node node) {
+ Selector selector;
+ if (node is ir.PropertyGet) {
+ selector = getGetterSelector(node);
+ } else {
+ selector = getSelector(node);
+ }
+ return _backend.isInterceptedSelector(selector);
}
DartType getDartType(ir.DartType type) {
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | pkg/compiler/lib/src/ssa/kernel_impact.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698