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

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
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/js_ast/lib/src/builder.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 e5a6c7004327a5aa572019a39b0eb195d61dcb3f..d7be40ce86e154d05bd3188e2e6d6c6c29920e6e 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 {
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/js_ast/lib/src/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698