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

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

Issue 1020853003: Split HForeign into HForeignCode and abstract base class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Formatting Created 5 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/ssa_tracer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/nodes.dart
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index e6db5e3cba080718a121f8e898e80af67afba06b..f4e813b870b72674a4401c262ebc78b05794359c 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -21,7 +21,7 @@ abstract class HVisitor<R> {
R visitExitTry(HExitTry node);
R visitFieldGet(HFieldGet node);
R visitFieldSet(HFieldSet node);
- R visitForeign(HForeign node);
+ R visitForeignCode(HForeignCode node);
R visitForeignNew(HForeignNew node);
R visitGoto(HGoto node);
R visitGreater(HGreater node);
@@ -292,8 +292,8 @@ class HBaseVisitor extends HGraphVisitor implements HVisitor {
visitExitTry(HExitTry node) => visitControlFlow(node);
visitFieldGet(HFieldGet node) => visitFieldAccess(node);
visitFieldSet(HFieldSet node) => visitFieldAccess(node);
- visitForeign(HForeign node) => visitInstruction(node);
- visitForeignNew(HForeignNew node) => visitForeign(node);
+ visitForeignCode(HForeignCode node) => visitInstruction(node);
+ visitForeignNew(HForeignNew node) => visitInstruction(node);
visitGoto(HGoto node) => visitControlFlow(node);
visitGreater(HGreater node) => visitRelational(node);
visitGreaterEqual(HGreaterEqual node) => visitRelational(node);
@@ -1698,13 +1698,25 @@ class HLocalSet extends HLocalAccess {
bool isJsStatement() => true;
}
-class HForeign extends HInstruction {
+abstract class HForeign extends HInstruction {
+ HForeign(TypeMask type, List<HInstruction> inputs) : super(inputs, type);
+
+ bool get isStatement => false;
+ native.NativeBehavior get nativeBehavior => null;
+
+ bool canThrow() {
+ return sideEffects.hasSideEffects()
+ || sideEffects.dependsOnSomething();
+ }
+}
+
+class HForeignCode extends HForeign {
final js.Template codeTemplate;
final bool isStatement;
final bool _canThrow;
final native.NativeBehavior nativeBehavior;
- HForeign(this.codeTemplate,
+ HForeignCode(this.codeTemplate,
TypeMask type,
List<HInstruction> inputs,
{this.isStatement: false,
@@ -1713,28 +1725,25 @@ class HForeign extends HInstruction {
canThrow: false})
: this.nativeBehavior = nativeBehavior,
this._canThrow = canThrow,
- super(inputs, type) {
+ super(type, inputs) {
+ if(codeTemplate == null) throw this;
sra1 2015/03/24 03:00:47 space after 'if'
herhut 2015/05/26 14:32:18 This has been fixed in the meanwhile.
if (effects == null && nativeBehavior != null) {
effects = nativeBehavior.sideEffects;
}
if (effects != null) sideEffects.add(effects);
}
- HForeign.statement(codeTemplate, List<HInstruction> inputs,
+ HForeignCode.statement(codeTemplate, List<HInstruction> inputs,
SideEffects effects,
native.NativeBehavior nativeBehavior,
TypeMask type)
: this(codeTemplate, type, inputs, isStatement: true,
effects: effects, nativeBehavior: nativeBehavior);
- accept(HVisitor visitor) => visitor.visitForeign(this);
+ accept(HVisitor visitor) => visitor.visitForeignCode(this);
bool isJsStatement() => isStatement;
- bool canThrow() {
- return _canThrow
- || sideEffects.hasSideEffects()
- || sideEffects.dependsOnSomething();
- }
+ bool canThrow() => _canThrow || super.canThrow();
}
class HForeignNew extends HForeign {
@@ -1748,7 +1757,7 @@ class HForeignNew extends HForeign {
HForeignNew(this.element, TypeMask type, List<HInstruction> inputs,
[this.instantiatedTypes])
- : super(null, type, inputs);
+ : super(type, inputs);
accept(HVisitor visitor) => visitor.visitForeignNew(this);
}
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/ssa_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698