Skip to content

Commit

Permalink
Revert "Split TypedSelector into Selector and TypeMask."
Browse files Browse the repository at this point in the history
This reverts commit fc42c0e.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1182053010.
  • Loading branch information
karlklose committed Jun 18, 2015
1 parent 40ed0da commit 9fb192b
Show file tree
Hide file tree
Showing 52 changed files with 741 additions and 1,198 deletions.
15 changes: 8 additions & 7 deletions pkg/compiler/lib/src/compiler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ class CodegenRegistry extends Registry {
world.registerStaticUse(element);
}

void registerDynamicInvocation(UniverseSelector selector) {
void registerDynamicInvocation(Selector selector) {
world.registerDynamicInvocation(selector);
compiler.dumpInfoTask.elementUsesSelector(currentElement, selector);
}

void registerDynamicSetter(UniverseSelector selector) {
void registerDynamicSetter(Selector selector) {
world.registerDynamicSetter(selector);
compiler.dumpInfoTask.elementUsesSelector(currentElement, selector);
}

void registerDynamicGetter(UniverseSelector selector) {
void registerDynamicGetter(Selector selector) {
world.registerDynamicGetter(selector);
compiler.dumpInfoTask.elementUsesSelector(currentElement, selector);
}
Expand Down Expand Up @@ -144,7 +144,7 @@ class CodegenRegistry extends Registry {
}

void registerSelectorUse(Selector selector) {
world.registerSelectorUse(new UniverseSelector(selector, null));
world.registerSelectorUse(selector);
}

void registerConstSymbol(String name) {
Expand Down Expand Up @@ -239,11 +239,11 @@ abstract class Registry {

bool get isForResolution;

void registerDynamicInvocation(UniverseSelector selector);
void registerDynamicInvocation(Selector selector);

void registerDynamicGetter(UniverseSelector selector);
void registerDynamicGetter(Selector selector);

void registerDynamicSetter(UniverseSelector selector);
void registerDynamicSetter(Selector selector);

void registerStaticInvocation(Element element);

Expand Down Expand Up @@ -1494,6 +1494,7 @@ abstract class Compiler implements DiagnosticListener {
// suitably maintained static reference to the current compiler.
StringToken.canonicalizedSubstrings.clear();
Selector.canonicalizedValues.clear();
world.canonicalizedValues.clear();

assert(uri != null || analyzeOnly || hasIncrementalSupport);
return new Future.sync(() {
Expand Down
40 changes: 10 additions & 30 deletions pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import '../dart2jslib.dart';
import '../elements/elements.dart';
import '../io/source_information.dart';
import '../tree/tree.dart' as ast;
import '../types/types.dart' show TypeMask;
import '../closure.dart' hide ClosureScope;
import '../universe/universe.dart' show SelectorKind;
import 'cps_ir_nodes.dart' as ir;
Expand Down Expand Up @@ -654,22 +653,20 @@ abstract class IrBuilder {

ir.Primitive _buildInvokeDynamic(ir.Primitive receiver,
Selector selector,
TypeMask mask,
List<ir.Primitive> arguments,
{SourceInformation sourceInformation}) {
assert(isOpen);
return _continueWithExpression(
(k) => new ir.InvokeMethod(receiver, selector, mask, arguments, k,
(k) => new ir.InvokeMethod(receiver, selector, arguments, k,
sourceInformation: sourceInformation));
}

ir.Primitive _buildInvokeCall(ir.Primitive target,
CallStructure callStructure,
TypeMask mask,
List<ir.Definition> arguments,
{SourceInformation sourceInformation}) {
Selector selector = callStructure.callSelector;
return _buildInvokeDynamic(target, selector, mask, arguments,
return _buildInvokeDynamic(target, selector, arguments,
sourceInformation: sourceInformation);
}

Expand Down Expand Up @@ -924,9 +921,8 @@ abstract class IrBuilder {
/// defined by [arguments].
ir.Primitive buildDynamicInvocation(ir.Primitive receiver,
Selector selector,
TypeMask mask,
List<ir.Primitive> arguments) {
return _buildInvokeDynamic(receiver, selector, mask, arguments);
return _buildInvokeDynamic(receiver, selector, arguments);
}

/// Create an if-null expression. This is equivalent to a conditional
Expand All @@ -944,33 +940,28 @@ abstract class IrBuilder {

/// Create a dynamic getter invocation on [receiver] where the getter name is
/// defined by [selector].
ir.Primitive buildDynamicGet(ir.Primitive receiver,
Selector selector,
TypeMask mask) {
ir.Primitive buildDynamicGet(ir.Primitive receiver, Selector selector) {
assert(selector.isGetter);
return _buildInvokeDynamic(
receiver, selector, mask, const <ir.Primitive>[]);
return _buildInvokeDynamic(receiver, selector, const <ir.Primitive>[]);
}

/// Create a dynamic setter invocation on [receiver] where the setter name and
/// argument are defined by [selector] and [value], respectively.
ir.Primitive buildDynamicSet(ir.Primitive receiver,
Selector selector,
TypeMask mask,
ir.Primitive value) {
assert(selector.isSetter);
_buildInvokeDynamic(receiver, selector, mask, <ir.Primitive>[value]);
_buildInvokeDynamic(receiver, selector, <ir.Primitive>[value]);
return value;
}

/// Create a dynamic index set invocation on [receiver] with the provided
/// [index] and [value].
ir.Primitive buildDynamicIndexSet(ir.Primitive receiver,
TypeMask mask,
ir.Primitive index,
ir.Primitive value) {
_buildInvokeDynamic(
receiver, new Selector.indexSet(), mask, <ir.Primitive>[index, value]);
receiver, new Selector.indexSet(), <ir.Primitive>[index, value]);
return value;
}

Expand Down Expand Up @@ -1104,13 +1095,12 @@ abstract class IrBuilder {

/// Create an invocation of the `call` method of [functionExpression], where
/// the structure of arguments are given by [callStructure].
// TODO(johnniwinther): This should take a [TypeMask].
ir.Primitive buildCallInvocation(
ir.Primitive functionExpression,
CallStructure callStructure,
List<ir.Definition> arguments,
{SourceInformation sourceInformation}) {
return _buildInvokeCall(functionExpression, callStructure, null, arguments,
return _buildInvokeCall(functionExpression, callStructure, arguments,
sourceInformation: sourceInformation);
}

Expand Down Expand Up @@ -1361,10 +1351,6 @@ abstract class IrBuilder {
SubbuildFunction buildVariableDeclaration,
Element variableElement,
Selector variableSelector,
TypeMask variableMask,
TypeMask currentMask,
TypeMask iteratorMask,
TypeMask moveNextMask,
SubbuildFunction buildBody,
JumpTarget target,
ClosureScope closureScope}) {
Expand Down Expand Up @@ -1392,7 +1378,6 @@ abstract class IrBuilder {
add(new ir.LetCont(iteratorInvoked,
new ir.InvokeMethod(expressionReceiver,
new Selector.getter("iterator", null),
iteratorMask,
emptyArguments,
iteratorInvoked)));

Expand All @@ -1409,7 +1394,6 @@ abstract class IrBuilder {
add(new ir.LetCont(moveNextInvoked,
new ir.InvokeMethod(iterator,
new Selector.call("moveNext", null, 0),
moveNextMask,
emptyArguments,
moveNextInvoked)));

Expand All @@ -1429,10 +1413,7 @@ abstract class IrBuilder {
ir.Parameter currentValue = new ir.Parameter(null);
ir.Continuation currentInvoked = new ir.Continuation([currentValue]);
bodyBuilder.add(new ir.LetCont(currentInvoked,
new ir.InvokeMethod(
iterator,
new Selector.getter("current", null),
currentMask,
new ir.InvokeMethod(iterator, new Selector.getter("current", null),
emptyArguments, currentInvoked)));
// TODO(sra): Does this cover all cases? The general setter case include
// super.
Expand All @@ -1452,8 +1433,7 @@ abstract class IrBuilder {
} else {
ir.Primitive receiver = bodyBuilder.buildThis();
assert(receiver != null);
bodyBuilder.buildDynamicSet(
receiver, variableSelector, variableMask, currentValue);
bodyBuilder.buildDynamicSet(receiver, variableSelector, currentValue);
}

// Translate the body in the hole in the delimited term above, and add
Expand Down
Loading

0 comments on commit 9fb192b

Please sign in to comment.