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

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

Issue 1074043003: Compute default throws behavior from JavaScript. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/nodes.dart
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index fd28580862f04815a45bea90249c54b104f3696d..51c137db18f705bd38f35ec9eedd9e2adb2fbb81 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -1713,37 +1713,44 @@ abstract class HForeign extends HInstruction {
class HForeignCode extends HForeign {
final js.Template codeTemplate;
final bool isStatement;
- final bool _canThrow;
final native.NativeBehavior nativeBehavior;
+ native.NativeThrowBehavior throwBehavior;
HForeignCode(this.codeTemplate,
- TypeMask type,
- List<HInstruction> inputs,
- {this.isStatement: false,
- SideEffects effects,
- native.NativeBehavior nativeBehavior,
- canThrow: false})
+ TypeMask type,
+ List<HInstruction> inputs,
+ {this.isStatement: false,
+ SideEffects effects,
+ native.NativeBehavior nativeBehavior,
+ native.NativeThrowBehavior throwBehavior})
: this.nativeBehavior = nativeBehavior,
- this._canThrow = canThrow,
+ this.throwBehavior = throwBehavior,
super(type, inputs) {
- if(codeTemplate == null) throw this;
+ assert(codeTemplate != null);
if (effects == null && nativeBehavior != null) {
effects = nativeBehavior.sideEffects;
}
+ if (this.throwBehavior == null) {
+ this.throwBehavior = (nativeBehavior == null)
+ ? native.NativeThrowBehavior.MAY
+ : nativeBehavior.throwBehavior;
+ }
+ assert(this.throwBehavior != null);
+
if (effects != null) sideEffects.add(effects);
}
- HForeignCode.statement(codeTemplate, List<HInstruction> inputs,
- SideEffects effects,
- native.NativeBehavior nativeBehavior,
- TypeMask type)
+ HForeignCode.statement(js.Template 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.visitForeignCode(this);
bool isJsStatement() => isStatement;
- bool canThrow() => _canThrow || super.canThrow();
+ bool canThrow() => throwBehavior.canThrow;
}
class HForeignNew extends HForeign {

Powered by Google App Engine
This is Rietveld 408576698