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

Unified Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10915104: Move namer into javascript backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
Index: lib/compiler/implementation/ssa/codegen.dart
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index ffd3a8b95940ec729d808c55609d1d9b6503aa09..f39df734016d11cc36a221d2cf6a456c8bbd92bc 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -677,22 +677,22 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
void continueAsBreak(LabelElement target) {
- pushStatement(new js.Break(compiler.namer.continueLabelName(target)));
+ pushStatement(new js.Break(backend.namer.continueLabelName(target)));
}
void implicitContinueAsBreak(TargetElement target) {
pushStatement(new js.Break(
- compiler.namer.implicitContinueLabelName(target)));
+ backend.namer.implicitContinueLabelName(target)));
}
void implicitBreakWithLabel(TargetElement target) {
- pushStatement(new js.Break(compiler.namer.implicitBreakLabelName(target)));
+ pushStatement(new js.Break(backend.namer.implicitBreakLabelName(target)));
}
js.Statement wrapIntoLabels(js.Statement result, List<LabelElement> labels) {
for (LabelElement label in labels) {
if (label.isTarget) {
- String breakLabelString = compiler.namer.breakLabelName(label);
+ String breakLabelString = backend.namer.breakLabelName(label);
result = new js.LabeledStatement(breakLabelString, result);
}
}
@@ -952,7 +952,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
if (labeledBlockInfo.isContinue) {
for (LabelElement label in labeledBlockInfo.labels) {
if (label.isContinueTarget) {
- String labelName = compiler.namer.continueLabelName(label);
+ String labelName = backend.namer.continueLabelName(label);
result = new js.LabeledStatement(labelName, result);
continueAction[label] = continueAsBreak;
continueOverrides = continueOverrides.prepend(label);
@@ -962,14 +962,14 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
// TODO(lrn): Consider recording whether the target is in fact
// a target of an unlabeled continue, and not generate this if it isn't.
TargetElement target = labeledBlockInfo.target;
- String labelName = compiler.namer.implicitContinueLabelName(target);
+ String labelName = backend.namer.implicitContinueLabelName(target);
result = new js.LabeledStatement(labelName, result);
continueAction[target] = implicitContinueAsBreak;
continueOverrides = continueOverrides.prepend(target);
} else {
for (LabelElement label in labeledBlockInfo.labels) {
if (label.isBreakTarget) {
- String labelName = compiler.namer.breakLabelName(label);
+ String labelName = backend.namer.breakLabelName(label);
result = new js.LabeledStatement(labelName, result);
}
}
@@ -978,7 +978,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
// This is an extra block around a switch that is generated
// as a nested if/else chain. We add an extra break target
// so that case code can break.
- String labelName = compiler.namer.implicitBreakLabelName(target);
+ String labelName = backend.namer.implicitBreakLabelName(target);
result = new js.LabeledStatement(labelName, result);
breakAction[target] = implicitBreakWithLabel;
}
@@ -1014,12 +1014,12 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
js.Statement result = body;
for (LabelElement label in info.labels) {
if (label.isContinueTarget) {
- String labelName = compiler.namer.continueLabelName(label);
+ String labelName = backend.namer.continueLabelName(label);
result = new js.LabeledStatement(labelName, result);
continueAction[label] = continueAsBreak;
}
}
- String labelName = compiler.namer.implicitContinueLabelName(target);
+ String labelName = backend.namer.implicitContinueLabelName(target);
result = new js.LabeledStatement(labelName, result);
continueAction[info.target] = implicitContinueAsBreak;
visitBodyIgnoreLabels(info);
@@ -1338,7 +1338,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
if (node.label !== null) {
LabelElement label = node.label;
if (!tryCallAction(breakAction, label)) {
- pushStatement(new js.Break(compiler.namer.breakLabelName(label)), node);
+ pushStatement(new js.Break(backend.namer.breakLabelName(label)), node);
}
} else {
TargetElement target = node.target;
@@ -1354,7 +1354,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
LabelElement label = node.label;
if (!tryCallAction(continueAction, label)) {
// TODO(floitsch): should this really be the breakLabelName?
- pushStatement(new js.Continue(compiler.namer.breakLabelName(label)),
+ pushStatement(new js.Continue(backend.namer.breakLabelName(label)),
node);
}
} else {
@@ -1462,7 +1462,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
methodName = name.slowToString();
arguments = visitArguments(node.inputs);
} else {
- methodName = compiler.namer.instanceMethodInvocationName(
+ methodName = backend.namer.instanceMethodInvocationName(
node.selector.library, name, node.selector);
arguments = visitArguments(node.inputs);
bool inLoop = node.block.enclosingLoopHeader !== null;
@@ -1512,7 +1512,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
use(node.receiver);
Selector setter = node.selector;
- String name = compiler.namer.setterName(setter.library, setter.name);
+ String name = backend.namer.setterName(setter.library, setter.name);
push(jsPropertyCall(pop(), name, visitArguments(node.inputs)), node);
world.registerDynamicSetter(
setter.name, getOptimizedSelectorFor(node, setter));
@@ -1521,7 +1521,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
visitInvokeDynamicGetter(HInvokeDynamicGetter node) {
use(node.receiver);
Selector getter = node.selector;
- String name = compiler.namer.getterName(getter.library, getter.name);
+ String name = backend.namer.getterName(getter.library, getter.name);
push(jsPropertyCall(pop(), name, visitArguments(node.inputs)), node);
world.registerDynamicGetter(
getter.name, getOptimizedSelectorFor(node, getter));
@@ -1530,7 +1530,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
visitInvokeClosure(HInvokeClosure node) {
use(node.receiver);
push(jsPropertyCall(pop(),
- compiler.namer.closureInvocationName(node.selector),
+ backend.namer.closureInvocationName(node.selector),
visitArguments(node.inputs)),
node);
Selector call = new Selector.callClosureFrom(node.selector);
@@ -1561,11 +1561,11 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
String fieldName;
if (currentClass.isShadowedByField(superMethod)) {
- fieldName = compiler.namer.shadowedFieldName(superMethod);
+ fieldName = backend.namer.shadowedFieldName(superMethod);
} else {
LibraryElement library = superMethod.getLibrary();
SourceString name = superMethod.name;
- fieldName = compiler.namer.instanceFieldName(library, name);
+ fieldName = backend.namer.instanceFieldName(library, name);
}
use(node.inputs[1]);
js.PropertyAccess access =
@@ -1580,17 +1580,17 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
String methodName;
if (superMethod.kind == ElementKind.FUNCTION ||
superMethod.kind == ElementKind.GENERATIVE_CONSTRUCTOR) {
- methodName = compiler.namer.instanceMethodName(
+ methodName = backend.namer.instanceMethodName(
currentLibrary, superMethod.name, argumentCount);
} else if (superMethod.kind == ElementKind.GETTER) {
methodName =
- compiler.namer.getterName(currentLibrary, superMethod.name);
+ backend.namer.getterName(currentLibrary, superMethod.name);
} else {
assert(superMethod.kind == ElementKind.SETTER);
methodName =
- compiler.namer.setterName(currentLibrary, superMethod.name);
+ backend.namer.setterName(currentLibrary, superMethod.name);
}
- String className = compiler.namer.isolateAccess(superClass);
+ String className = backend.namer.isolateAccess(superClass);
js.VariableUse classReference = new js.VariableUse(className);
js.PropertyAccess prototype =
new js.PropertyAccess.field(classReference, "prototype");
@@ -1602,7 +1602,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
visitFieldGet(HFieldGet node) {
- String name = compiler.namer.getName(node.element);
+ String name = backend.namer.getName(node.element);
use(node.receiver);
push(new js.PropertyAccess.field(pop(), name), node);
HType receiverHType = types[node.receiver];
@@ -1634,7 +1634,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
backend.updateFieldConstructorSetters(node.element,
node.value.guaranteedType);
}
- String name = compiler.namer.getName(node.element);
+ String name = backend.namer.getName(node.element);
DartType type = types[node.receiver].computeType(compiler);
if (type != null) {
if (!work.element.isGenerativeConstructorBody()) {
@@ -1700,7 +1700,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
backend.updateFieldInitializers(member, types[node.inputs[j]]);
j++;
});
- String jsClassReference = compiler.namer.isolateAccess(node.element);
+ String jsClassReference = backend.namer.isolateAccess(node.element);
List<HInstruction> inputs = node.inputs;
// We can't use 'visitArguments', since our arguments start at input[0].
List<js.Expression> arguments = <js.Expression>[];
@@ -1736,7 +1736,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
FunctionConstant function = constant;
world.registerStaticUse(function.element);
push(new js.VariableUse(
- compiler.namer.isolateAccess(function.element)));
+ backend.namer.isolateAccess(function.element)));
} else if (constant.isSentinel()) {
// TODO(floitsch): get rid of the code buffer.
CodeBuffer buffer = new CodeBuffer();
@@ -1749,7 +1749,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
} else {
js.VariableUse currentIsolateUse =
- new js.VariableUse(compiler.namer.CURRENT_ISOLATE);
+ new js.VariableUse(backend.namer.CURRENT_ISOLATE);
push(new js.PropertyAccess.field(currentIsolateUse, name));
}
}
@@ -1958,7 +1958,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
Element helper = compiler.findHelper(new SourceString(helperName));
world.registerStaticUse(helper);
js.VariableUse jsHelper =
- new js.VariableUse(compiler.namer.isolateAccess(helper));
+ new js.VariableUse(backend.namer.isolateAccess(helper));
js.Call value = new js.Call(jsHelper, visitArguments([null, argument]));
attachLocation(value, argument);
// BUG(4906): Using throw here adds to the size of the generated code
@@ -1991,13 +1991,13 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
}
});
world.registerStaticUse(node.element);
- push(new js.VariableUse(compiler.namer.isolateAccess(node.element)));
+ push(new js.VariableUse(backend.namer.isolateAccess(node.element)));
}
void visitLazyStatic(HLazyStatic node) {
Element element = node.element;
world.registerStaticUse(element);
- String lazyGetter = compiler.namer.isolateLazyInitializerAccess(element);
+ String lazyGetter = backend.namer.isolateLazyInitializerAccess(element);
js.VariableUse target = new js.VariableUse(lazyGetter);
js.Call call = new js.Call(target, <js.Expression>[]);
push(call, node);
@@ -2006,7 +2006,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
void visitStaticStore(HStaticStore node) {
world.registerStaticUse(node.element);
js.VariableUse variableUse =
- new js.VariableUse(compiler.namer.isolateAccess(node.element));
+ new js.VariableUse(backend.namer.isolateAccess(node.element));
use(node.inputs[0]);
push(new js.Assignment(variableUse, pop()), node);
}
@@ -2038,7 +2038,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
Element convertToString = compiler.findHelper(const SourceString("S"));
world.registerStaticUse(convertToString);
js.VariableUse variableUse =
- new js.VariableUse(compiler.namer.isolateAccess(convertToString));
+ new js.VariableUse(backend.namer.isolateAccess(convertToString));
use(node);
push(new js.Call(variableUse, <js.Expression>[pop()]), node);
}
@@ -2231,7 +2231,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
world.registerIsCheck(element);
use(input);
js.PropertyAccess field =
- new js.PropertyAccess.field(pop(), compiler.namer.operatorIs(element));
+ new js.PropertyAccess.field(pop(), backend.namer.operatorIs(element));
if (backend.emitter.nativeEmitter.requiresNativeIsCheck(element)) {
push(new js.Call(field, <js.Expression>[]));
if (negative) push(new js.Prefix('!', pop()));
@@ -2404,7 +2404,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
assert(node.isCheckedModeCheck || node.isCastTypeCheck);
SourceString helper = backend.getCheckedModeHelper(type);
- String additionalArgument = compiler.namer.operatorIs(element);
+ String additionalArgument = backend.namer.operatorIs(element);
if (node.isCastTypeCheck) {
helper = castNames[helper.stringValue];
}
@@ -2414,7 +2414,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
use(node.checkedInput);
arguments.add(pop());
arguments.add(new js.LiteralString("'$additionalArgument'"));
- String helperName = compiler.namer.isolateAccess(helperElement);
+ String helperName = backend.namer.isolateAccess(helperElement);
push(new js.Call(new js.VariableUse(helperName), arguments));
} else {
use(node.checkedInput);
@@ -2450,7 +2450,7 @@ class SsaOptimizedCodeGenerator extends SsaCodeGenerator {
}
HInstruction input = guard.guarded;
HBailoutTarget target = guard.bailoutTarget;
- Namer namer = compiler.namer;
+ Namer namer = backend.namer;
Element element = work.element;
List<js.Expression> arguments = <js.Expression>[];
arguments.add(new js.LiteralNumber("${guard.state}"));

Powered by Google App Engine
This is Rietveld 408576698