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

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

Issue 1250633002: Add operators test to source_mapping_test. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup Created 5 years, 5 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: pkg/compiler/lib/src/ssa/builder.dart
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index 133567486ff7df32adf2493e20b90bed4e0f285f..44fd0c747a7c2ea77cb9d5fa21c1891b0062618c 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -492,7 +492,12 @@ class LocalsHandler {
"Cannot find value $local.");
}
}
- return directLocals[local];
+ HInstruction value = directLocals[local];
+ if (sourceInformation != null) {
+ value = new HRef(value, sourceInformation);
+ builder.add(value);
+ }
+ return value;
} else if (isStoredInClosureField(local)) {
ClosureFieldElement redirect = redirectionMapping[local];
HInstruction receiver = readLocal(closureData.closureElement);
@@ -518,9 +523,9 @@ class LocalsHandler {
assert(isUsedInTryOrGenerator(local));
HLocalValue localValue = getLocal(local);
HInstruction instruction = new HLocalGet(
- local, localValue, builder.backend.dynamicType);
+ local, localValue, builder.backend.dynamicType, sourceInformation);
builder.add(instruction);
- return instruction..sourceInformation = sourceInformation;
+ return instruction;
}
}
@@ -562,6 +567,10 @@ class LocalsHandler {
*/
void updateLocal(Local local, HInstruction value,
{SourceInformation sourceInformation}) {
+ if (value is HRef) {
+ HRef ref = value;
+ value = ref.value;
+ }
assert(!isStoredInClosureField(local));
if (isAccessedDirectly(local)) {
directLocals[local] = value;
@@ -1649,12 +1658,13 @@ class SsaBuilder extends ast.Visitor
backend.boolType));
},
visitThen: () {
- // TODO(johnniwinther): Add source information.
closeAndGotoExit(new HReturn(
graph.addConstantBool(false, compiler),
- null));
+ sourceInformationBuilder
+ .buildImplicitReturn(functionElement)));
},
- visitElse: null);
+ visitElse: null,
+ sourceInformation: sourceInformationBuilder.buildIf(function.body));
}
}
function.body.accept(this);
@@ -4897,7 +4907,13 @@ class SsaBuilder extends ast.Visitor
// The new object will now be referenced through the
// `setRuntimeTypeInfo` call. We therefore set the type of that
// instruction to be of the object's type.
- assert(stack.last is HInvokeStatic || stack.last == newObject);
+ assert(invariant(
+ CURRENT_ELEMENT_SPANNABLE,
+ stack.last is HInvokeStatic || stack.last == newObject,
+ message:
+ "Unexpected `stack.last`: Found ${stack.last}, "
+ "expected ${newObject} or an HInvokeStatic. "
+ "State: element=$element, rtiInputs=$rtiInputs, stack=$stack."));
stack.last.instructionType = newObject.instructionType;
return pop();
}

Powered by Google App Engine
This is Rietveld 408576698