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

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

Issue 2777163002: Make codegen and optimizations depend more directly on data objects. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/interceptor_simplifier.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/codegen_helpers.dart
diff --git a/pkg/compiler/lib/src/ssa/codegen_helpers.dart b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
index 71ade2c62aa5ca9343de4a470351d3cf9327880e..630309bc8c6a325109078fc593a8fe0ece2a4ceb 100644
--- a/pkg/compiler/lib/src/ssa/codegen_helpers.dart
+++ b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
@@ -2,10 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import '../compiler.dart' show Compiler;
import '../constants/values.dart';
import '../elements/elements.dart';
import '../js_backend/js_backend.dart';
+import '../js_backend/interceptor_data.dart';
+import '../options.dart';
import '../types/types.dart';
import '../universe/selector.dart' show Selector;
import '../world.dart' show ClosedWorld;
@@ -16,13 +17,11 @@ import 'nodes.dart';
* Caches codegen information on nodes.
*/
class SsaInstructionSelection extends HBaseVisitor {
- final Compiler compiler;
- final ClosedWorld closedWorld;
+ final ClosedWorld _closedWorld;
+ final InterceptorData _interceptorData;
HGraph graph;
- SsaInstructionSelection(this.compiler, this.closedWorld);
-
- JavaScriptBackend get backend => compiler.backend;
+ SsaInstructionSelection(this._closedWorld, this._interceptorData);
void visitGraph(HGraph graph) {
this.graph = graph;
@@ -68,8 +67,8 @@ class SsaInstructionSelection extends HBaseVisitor {
if (node.kind == HIs.RAW_CHECK) {
HInstruction interceptor = node.interceptor;
if (interceptor != null) {
- return new HIsViaInterceptor(
- node.typeExpression, interceptor, closedWorld.commonMasks.boolType);
+ return new HIsViaInterceptor(node.typeExpression, interceptor,
+ _closedWorld.commonMasks.boolType);
}
}
return node;
@@ -88,7 +87,7 @@ class SsaInstructionSelection extends HBaseVisitor {
if (leftType.isNullable && rightType.isNullable) {
if (left.isConstantNull() ||
right.isConstantNull() ||
- (left.isPrimitive(closedWorld) && leftType == rightType)) {
+ (left.isPrimitive(_closedWorld) && leftType == rightType)) {
return '==';
}
return null;
@@ -105,7 +104,7 @@ class SsaInstructionSelection extends HBaseVisitor {
HInstruction visitInvokeSuper(HInvokeSuper node) {
if (node.isInterceptedCall) {
- TypeMask mask = node.getDartReceiver(closedWorld).instructionType;
+ TypeMask mask = node.getDartReceiver(_closedWorld).instructionType;
tryReplaceInterceptorWithDummy(node, node.selector, mask);
}
return node;
@@ -142,12 +141,12 @@ class SsaInstructionSelection extends HBaseVisitor {
HInstruction receiverArgument = node.inputs[1];
if (interceptor.nonCheck() == receiverArgument.nonCheck()) {
- if (backend.interceptorData.isInterceptedSelector(selector) &&
- !backend.interceptorData.isInterceptedMixinSelector(selector, mask)) {
+ if (_interceptorData.isInterceptedSelector(selector) &&
+ !_interceptorData.isInterceptedMixinSelector(selector, mask)) {
ConstantValue constant = new SyntheticConstantValue(
SyntheticConstantKind.DUMMY_INTERCEPTOR,
receiverArgument.instructionType);
- HConstant dummy = graph.addConstant(constant, closedWorld);
+ HConstant dummy = graph.addConstant(constant, _closedWorld);
receiverArgument.usedBy.remove(node);
node.inputs[1] = dummy;
dummy.usedBy.add(node);
@@ -244,7 +243,7 @@ class SsaInstructionSelection extends HBaseVisitor {
HInstruction bitop(String assignOp) {
// HBitAnd, HBitOr etc. are more difficult because HBitAnd(a.x, y)
// sometimes needs to be forced to unsigned: a.x = (a.x & y) >>> 0.
- if (op.isUInt31(closedWorld)) return simpleBinary(assignOp);
+ if (op.isUInt31(_closedWorld)) return simpleBinary(assignOp);
return noMatchingRead();
}
@@ -298,11 +297,12 @@ class SsaTypeKnownRemover extends HBaseVisitor {
* mode.
*/
class SsaTrustedCheckRemover extends HBaseVisitor {
- Compiler compiler;
- SsaTrustedCheckRemover(this.compiler);
+ final CompilerOptions _options;
+
+ SsaTrustedCheckRemover(this._options);
void visitGraph(HGraph graph) {
- if (!compiler.options.trustPrimitives) return;
+ if (!_options.trustPrimitives) return;
visitDominatorTree(graph);
}
@@ -334,7 +334,7 @@ class SsaTrustedCheckRemover extends HBaseVisitor {
* t2 = add(4, 3);
*/
class SsaInstructionMerger extends HBaseVisitor {
- final Compiler compiler;
+ final JavaScriptBackend _backend;
/**
* List of [HInstruction] that the instruction merger expects in
* order when visiting the inputs of an instruction.
@@ -353,9 +353,7 @@ class SsaInstructionMerger extends HBaseVisitor {
generateAtUseSite.add(instruction);
}
- SsaInstructionMerger(this.generateAtUseSite, this.compiler);
-
- JavaScriptBackend get backend => compiler.backend;
+ SsaInstructionMerger(this.generateAtUseSite, this._backend);
void visitGraph(HGraph graph) {
visitDominatorTree(graph);
@@ -438,7 +436,7 @@ class SsaInstructionMerger extends HBaseVisitor {
// after first access if we use lazy initialization.
// In this case, we therefore don't allow the receiver (the first argument)
// to be generated at use site, and only analyze all other arguments.
- if (!backend.canUseAliasedSuperMember(superMethod, selector)) {
+ if (!_backend.canUseAliasedSuperMember(superMethod, selector)) {
analyzeInputs(instruction, 1);
} else {
super.visitInvokeSuper(instruction);
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/interceptor_simplifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698