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

Unified Diff: lib/compiler/implementation/ssa/nodes.dart

Issue 10911181: Collect getters in a FunctionSet while resolving. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/nodes.dart
===================================================================
--- lib/compiler/implementation/ssa/nodes.dart (revision 12169)
+++ lib/compiler/implementation/ssa/nodes.dart (working copy)
@@ -797,6 +797,7 @@
static const int TYPE_CONVERSION_TYPECODE = 28;
static const int BAILOUT_TARGET_TYPECODE = 29;
static const int INVOKE_STATIC_TYPECODE = 30;
+ static const int INVOKE_DYNAMIC_GETTER_TYPECODE = 31;
HInstruction(this.inputs)
: id = idCounter++,
@@ -1304,10 +1305,26 @@
}
class HInvokeDynamicGetter extends HInvokeDynamicField {
- HInvokeDynamicGetter(selector, element, receiver)
+ final bool isSideEffectFree;
+ HInvokeDynamicGetter(
+ selector, element, receiver, this.isSideEffectFree)
: super(selector, element,[receiver]);
toString() => 'invoke dynamic getter: $selector';
accept(HVisitor visitor) => visitor.visitInvokeDynamicGetter(this);
+
+ void prepareGvn(HTypeMap types) {
+ if (isSideEffectFree) {
+ setUseGvn();
+ clearAllSideEffects();
+ setDependsOnSomething();
+ } else {
+ setAllSideEffects();
+ }
+ }
+
+ int typeCode() => HInstruction.INVOKE_DYNAMIC_GETTER_TYPECODE;
+ bool typeEquals(other) => other is HInvokeDynamicGetter;
+ bool dataEquals(HInvokeDynamicGetter other) => selector == other.selector;
}
class HInvokeDynamicSetter extends HInvokeDynamicField {
@@ -1356,11 +1373,12 @@
class HInvokeInterceptor extends HInvokeStatic {
final Selector selector;
+ final bool isSideEffectFree;
HInvokeInterceptor(this.selector,
List<HInstruction> inputs,
- [HType knownType = HType.UNKNOWN])
- : super(inputs, knownType);
+ [bool this.isSideEffectFree = false])
+ : super(inputs);
toString() => 'invoke interceptor: ${element.name}';
accept(HVisitor visitor) => visitor.visitInvokeInterceptor(this);
@@ -1416,6 +1434,10 @@
// we don't express that type yet: a mutable array might be
// extendable.
if (!inputs[1].isString(types)) setDependsOnSomething();
+ } else if (isSideEffectFree) {
+ setUseGvn();
+ clearAllSideEffects();
+ setDependsOnSomething();
} else {
setAllSideEffects();
}
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698