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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/tracer.dart

Issue 15724021: Move array and string related HType from const to a field in the backend. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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: sdk/lib/_internal/compiler/implementation/ssa/tracer.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/tracer.dart (revision 23812)
+++ sdk/lib/_internal/compiler/implementation/ssa/tracer.dart (working copy)
@@ -14,6 +14,7 @@
const String SSA_TRACE_FILTER = null;
class HTracer extends HGraphVisitor implements Tracer {
+ Compiler compiler;
JavaScriptItemCompilationContext context;
int indent = 0;
final EventSink<String> output;
@@ -27,9 +28,11 @@
}
void traceCompilation(String methodName,
- JavaScriptItemCompilationContext compilationContext) {
+ JavaScriptItemCompilationContext compilationContext,
+ Compiler compiler) {
if (!enabled) return;
this.context = compilationContext;
+ this.compiler = compiler;
traceActive =
SSA_TRACE_FILTER == null || methodName.contains(SSA_TRACE_FILTER);
if (!traceActive) return;
@@ -92,7 +95,7 @@
void visitBasicBlock(HBasicBlock block) {
HInstructionStringifier stringifier =
- new HInstructionStringifier(context, block);
+ new HInstructionStringifier(context, block, compiler);
assert(block.id != null);
tag("block", () {
printProperty("name", "B${block.id}");
@@ -165,21 +168,22 @@
}
class HInstructionStringifier implements HVisitor<String> {
- JavaScriptItemCompilationContext context;
- HBasicBlock currentBlock;
+ final Compiler compiler;
+ final JavaScriptItemCompilationContext context;
+ final HBasicBlock currentBlock;
- HInstructionStringifier(this.context, this.currentBlock);
+ HInstructionStringifier(this.context, this.currentBlock, this.compiler);
visit(HInstruction node) => node.accept(this);
String temporaryId(HInstruction instruction) {
String prefix;
HType type = instruction.instructionType;
- if (type == HType.MUTABLE_ARRAY) {
+ if (type.isMutableArray(compiler)) {
prefix = 'm';
- } else if (type == HType.READABLE_ARRAY) {
+ } else if (type.isReadableArray(compiler)) {
prefix = 'a';
- } else if (type == HType.EXTENDABLE_ARRAY) {
+ } else if (type.isExtendableArray(compiler)) {
prefix = 'e';
} else if (type == HType.BOOLEAN) {
prefix = 'b';
@@ -189,13 +193,13 @@
prefix = 'd';
} else if (type == HType.NUMBER) {
prefix = 'n';
- } else if (type == HType.STRING) {
+ } else if (type.isString(compiler)) {
prefix = 's';
} else if (type == HType.UNKNOWN) {
prefix = 'v';
} else if (type == HType.CONFLICTING) {
prefix = 'c';
- } else if (type == HType.INDEXABLE_PRIMITIVE) {
+ } else if (type.isIndexable(compiler)) {
prefix = 'r';
} else if (type == HType.NULL) {
prefix = 'u';
@@ -505,12 +509,12 @@
String visitTypeGuard(HTypeGuard node) {
String type;
HType guardedType = node.guardedType;
- if (guardedType == HType.MUTABLE_ARRAY) {
+ if (guardedType.isExtendableArray(compiler)) {
+ type = "extendable_array";
+ } else if (guardedType.isMutableArray(compiler)) {
type = "mutable_array";
- } else if (guardedType == HType.READABLE_ARRAY) {
+ } else if (guardedType.isReadableArray(compiler)) {
type = "readable_array";
- } else if (guardedType == HType.EXTENDABLE_ARRAY) {
- type = "extendable_array";
} else if (guardedType == HType.BOOLEAN) {
type = "bool";
} else if (guardedType == HType.INTEGER) {
@@ -519,9 +523,9 @@
type = "double";
} else if (guardedType == HType.NUMBER) {
type = "number";
- } else if (guardedType == HType.STRING) {
+ } else if (guardedType.isString(compiler)) {
type = "string";
- } else if (guardedType == HType.INDEXABLE_PRIMITIVE) {
+ } else if (guardedType.isIndexable(compiler)) {
type = "string_or_array";
} else if (guardedType == HType.UNKNOWN) {
type = 'unknown';

Powered by Google App Engine
This is Rietveld 408576698