mirror of
https://github.com/dart-lang/sdk
synced 2024-10-05 10:19:45 +00:00
Make isInterceptedCall a field
Change-Id: I88a16189d8a6a30fa52be61bc3d015a703368baa Reviewed-on: https://dart-review.googlesource.com/45583 Commit-Queue: Stephen Adams <sra@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
c956cc152f
commit
b93c74092a
|
@ -4159,11 +4159,11 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
TypeMask type = TypeMaskFactory.inferredTypeForSelector(
|
||||
selector, mask, globalInferenceResults);
|
||||
if (selector.isGetter) {
|
||||
push(new HInvokeDynamicGetter(
|
||||
selector, mask, null, inputs, type, sourceInformation));
|
||||
push(new HInvokeDynamicGetter(selector, mask, null, inputs, isIntercepted,
|
||||
type, sourceInformation));
|
||||
} else if (selector.isSetter) {
|
||||
push(new HInvokeDynamicSetter(
|
||||
selector, mask, null, inputs, type, sourceInformation));
|
||||
push(new HInvokeDynamicSetter(selector, mask, null, inputs, isIntercepted,
|
||||
type, sourceInformation));
|
||||
} else {
|
||||
push(new HInvokeDynamicMethod(
|
||||
selector, mask, inputs, type, const <DartType>[], sourceInformation,
|
||||
|
@ -4319,10 +4319,11 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
// TODO(5346): Try to avoid the need for calling [declaration] before
|
||||
// creating an [HStatic].
|
||||
List<HInstruction> inputs = <HInstruction>[];
|
||||
if (interceptorData.isInterceptedSelector(selector) &&
|
||||
// Fields don't need an interceptor; consider generating HFieldGet/Set
|
||||
// instead.
|
||||
element.kind != ElementKind.FIELD) {
|
||||
// Fields don't need an interceptor; consider generating HFieldGet/Set instead.
|
||||
|
||||
bool isIntercepted = interceptorData.isInterceptedSelector(selector) &&
|
||||
element.kind != ElementKind.FIELD;
|
||||
if (isIntercepted) {
|
||||
inputs.add(invokeInterceptor(receiver));
|
||||
}
|
||||
inputs.add(receiver);
|
||||
|
@ -4338,8 +4339,15 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
} else {
|
||||
type = closedWorld.commonMasks.dynamicType;
|
||||
}
|
||||
HInstruction instruction = new HInvokeSuper(element, currentNonClosureClass,
|
||||
selector, inputs, type, const <DartType>[], sourceInformation,
|
||||
HInstruction instruction = new HInvokeSuper(
|
||||
element,
|
||||
currentNonClosureClass,
|
||||
selector,
|
||||
inputs,
|
||||
isIntercepted,
|
||||
type,
|
||||
const <DartType>[],
|
||||
sourceInformation,
|
||||
isSetter: selector.isSetter || selector.isIndexSet);
|
||||
instruction.sideEffects =
|
||||
closedWorld.getSideEffectsOfSelector(selector, null);
|
||||
|
|
|
@ -3837,11 +3837,11 @@ class KernelSsaGraphBuilder extends ir.Visitor
|
|||
|
||||
TypeMask type = _typeInferenceMap.selectorTypeOf(selector, mask);
|
||||
if (selector.isGetter) {
|
||||
push(new HInvokeDynamicGetter(
|
||||
selector, mask, null, inputs, type, sourceInformation));
|
||||
push(new HInvokeDynamicGetter(selector, mask, null, inputs, isIntercepted,
|
||||
type, sourceInformation));
|
||||
} else if (selector.isSetter) {
|
||||
push(new HInvokeDynamicSetter(
|
||||
selector, mask, null, inputs, type, sourceInformation));
|
||||
push(new HInvokeDynamicSetter(selector, mask, null, inputs, isIntercepted,
|
||||
type, sourceInformation));
|
||||
} else {
|
||||
push(new HInvokeDynamicMethod(
|
||||
selector, mask, inputs, type, typeArguments, sourceInformation,
|
||||
|
@ -4127,7 +4127,9 @@ class KernelSsaGraphBuilder extends ir.Visitor
|
|||
localsHandler.readThis(sourceInformation: sourceInformation);
|
||||
|
||||
List<HInstruction> inputs = <HInstruction>[];
|
||||
if (closedWorld.interceptorData.isInterceptedSelector(selector)) {
|
||||
bool isIntercepted =
|
||||
closedWorld.interceptorData.isInterceptedSelector(selector);
|
||||
if (isIntercepted) {
|
||||
inputs.add(_interceptorFor(receiver, sourceInformation));
|
||||
}
|
||||
inputs.add(receiver);
|
||||
|
@ -4139,8 +4141,15 @@ class KernelSsaGraphBuilder extends ir.Visitor
|
|||
} else {
|
||||
typeMask = closedWorld.commonMasks.dynamicType;
|
||||
}
|
||||
HInstruction instruction = new HInvokeSuper(target, containingClass,
|
||||
selector, inputs, typeMask, typeArguments, sourceInformation,
|
||||
HInstruction instruction = new HInvokeSuper(
|
||||
target,
|
||||
containingClass,
|
||||
selector,
|
||||
inputs,
|
||||
isIntercepted,
|
||||
typeMask,
|
||||
typeArguments,
|
||||
sourceInformation,
|
||||
isSetter: selector.isSetter || selector.isIndexSet);
|
||||
instruction.sideEffects =
|
||||
closedWorld.getSideEffectsOfSelector(selector, null);
|
||||
|
|
|
@ -411,6 +411,7 @@ class SsaSimplifyInterceptors extends HBaseVisitor
|
|||
mask,
|
||||
node.element,
|
||||
<HInstruction>[constant, node.inputs[1]],
|
||||
true,
|
||||
node.instructionType,
|
||||
node.sourceInformation);
|
||||
} else if (selector.isSetter) {
|
||||
|
@ -419,6 +420,7 @@ class SsaSimplifyInterceptors extends HBaseVisitor
|
|||
mask,
|
||||
node.element,
|
||||
<HInstruction>[constant, node.inputs[1], node.inputs[2]],
|
||||
true,
|
||||
node.instructionType,
|
||||
node.sourceInformation);
|
||||
} else {
|
||||
|
|
|
@ -1662,22 +1662,17 @@ class HCreateBox extends HInstruction {
|
|||
|
||||
abstract class HInvoke extends HInstruction {
|
||||
bool isAllocation = false;
|
||||
|
||||
/// [isInterceptedCall] is true if this invocation uses the interceptor
|
||||
/// calling convention where the first input is the methods and the second
|
||||
/// input is the Dart receiver.
|
||||
bool isInterceptedCall = false;
|
||||
HInvoke(List<HInstruction> inputs, type) : super(inputs, type) {
|
||||
sideEffects.setAllSideEffects();
|
||||
sideEffects.setDependsOnSomething();
|
||||
}
|
||||
static const int ARGUMENTS_OFFSET = 1;
|
||||
bool canThrow() => true;
|
||||
|
||||
/**
|
||||
* Returns whether this call is on an intercepted method.
|
||||
*/
|
||||
bool get isInterceptedCall {
|
||||
// We know it's a selector call if it follows the interceptor
|
||||
// calling convention, which adds the actual receiver as a
|
||||
// parameter to the call.
|
||||
return (selector != null) && (inputs.length - 2 == selector.argumentCount);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class HInvokeDynamic extends HInvoke {
|
||||
|
@ -1687,13 +1682,15 @@ abstract class HInvokeDynamic extends HInvoke {
|
|||
MemberEntity element;
|
||||
|
||||
HInvokeDynamic(Selector selector, this.mask, this.element,
|
||||
List<HInstruction> inputs, TypeMask type,
|
||||
[bool isIntercepted = false])
|
||||
List<HInstruction> inputs, bool isIntercepted, TypeMask type)
|
||||
: this.selector = selector,
|
||||
specializer = isIntercepted
|
||||
? InvokeDynamicSpecializer.lookupSpecializer(selector)
|
||||
: const InvokeDynamicSpecializer(),
|
||||
super(inputs, type);
|
||||
super(inputs, type) {
|
||||
assert(isIntercepted != null);
|
||||
isInterceptedCall = isIntercepted;
|
||||
}
|
||||
toString() => 'invoke dynamic: selector=$selector, mask=$mask';
|
||||
HInstruction get receiver => inputs[0];
|
||||
HInstruction getDartReceiver(ClosedWorld closedWorld) {
|
||||
|
@ -1726,9 +1723,10 @@ class HInvokeClosure extends HInvokeDynamic {
|
|||
|
||||
HInvokeClosure(Selector selector, List<HInstruction> inputs, TypeMask type,
|
||||
this.typeArguments)
|
||||
: super(selector, null, null, inputs, type) {
|
||||
: super(selector, null, null, inputs, false, type) {
|
||||
assert(selector.isClosureCall);
|
||||
assert(selector.callStructure.typeArgumentCount == typeArguments.length);
|
||||
assert(!isInterceptedCall);
|
||||
}
|
||||
accept(HVisitor visitor) => visitor.visitInvokeClosure(this);
|
||||
}
|
||||
|
@ -1744,7 +1742,7 @@ class HInvokeDynamicMethod extends HInvokeDynamic {
|
|||
this.typeArguments,
|
||||
SourceInformation sourceInformation,
|
||||
{bool isIntercepted: false})
|
||||
: super(selector, mask, null, inputs, type, isIntercepted) {
|
||||
: super(selector, mask, null, inputs, isIntercepted, type) {
|
||||
this.sourceInformation = sourceInformation;
|
||||
assert(selector.callStructure.typeArgumentCount == typeArguments.length);
|
||||
}
|
||||
|
@ -1755,8 +1753,8 @@ class HInvokeDynamicMethod extends HInvokeDynamic {
|
|||
|
||||
abstract class HInvokeDynamicField extends HInvokeDynamic {
|
||||
HInvokeDynamicField(Selector selector, TypeMask mask, MemberEntity element,
|
||||
List<HInstruction> inputs, TypeMask type)
|
||||
: super(selector, mask, element, inputs, type);
|
||||
List<HInstruction> inputs, bool isIntercepted, TypeMask type)
|
||||
: super(selector, mask, element, inputs, isIntercepted, type);
|
||||
|
||||
String toString() => 'invoke dynamic field: selector=$selector, mask=$mask';
|
||||
}
|
||||
|
@ -1767,9 +1765,10 @@ class HInvokeDynamicGetter extends HInvokeDynamicField {
|
|||
TypeMask mask,
|
||||
MemberEntity element,
|
||||
List<HInstruction> inputs,
|
||||
bool isIntercepted,
|
||||
TypeMask type,
|
||||
SourceInformation sourceInformation)
|
||||
: super(selector, mask, element, inputs, type) {
|
||||
: super(selector, mask, element, inputs, isIntercepted, type) {
|
||||
this.sourceInformation = sourceInformation;
|
||||
}
|
||||
|
||||
|
@ -1791,9 +1790,10 @@ class HInvokeDynamicSetter extends HInvokeDynamicField {
|
|||
TypeMask mask,
|
||||
MemberEntity element,
|
||||
List<HInstruction> inputs,
|
||||
bool isIntercepted,
|
||||
TypeMask type,
|
||||
SourceInformation sourceInformation)
|
||||
: super(selector, mask, element, inputs, type) {
|
||||
: super(selector, mask, element, inputs, isIntercepted, type) {
|
||||
this.sourceInformation = sourceInformation;
|
||||
}
|
||||
|
||||
|
@ -1822,8 +1822,10 @@ class HInvokeStatic extends HInvoke {
|
|||
|
||||
/** The first input must be the target. */
|
||||
HInvokeStatic(this.element, inputs, TypeMask type, this.typeArguments,
|
||||
{this.targetCanThrow: true})
|
||||
: super(inputs, type);
|
||||
{this.targetCanThrow: true, bool isIntercepted: false})
|
||||
: super(inputs, type) {
|
||||
isInterceptedCall = isIntercepted;
|
||||
}
|
||||
|
||||
accept(HVisitor visitor) => visitor.visitInvokeStatic(this);
|
||||
|
||||
|
@ -1843,11 +1845,13 @@ class HInvokeSuper extends HInvokeStatic {
|
|||
this.caller,
|
||||
this.selector,
|
||||
List<HInstruction> inputs,
|
||||
bool isIntercepted,
|
||||
TypeMask type,
|
||||
List<DartType> typeArguments,
|
||||
SourceInformation sourceInformation,
|
||||
{this.isSetter})
|
||||
: super(element, inputs, type, typeArguments) {
|
||||
: super(element, inputs, type, typeArguments,
|
||||
isIntercepted: isIntercepted) {
|
||||
this.sourceInformation = sourceInformation;
|
||||
}
|
||||
|
||||
|
@ -2840,7 +2844,7 @@ class HOneShotInterceptor extends HInvokeDynamic {
|
|||
TypeMask type,
|
||||
this.typeArguments,
|
||||
this.interceptedClasses)
|
||||
: super(selector, mask, null, inputs, type, true) {
|
||||
: super(selector, mask, null, inputs, true, type) {
|
||||
assert(inputs[0] is HConstant);
|
||||
assert(inputs[0].isNull());
|
||||
assert(selector.callStructure.typeArgumentCount == typeArguments.length);
|
||||
|
|
|
@ -447,10 +447,11 @@ class SsaInstructionSimplifier extends HBaseVisitor
|
|||
HInvokeDynamicMethod result = new HInvokeDynamicMethod(
|
||||
node.selector,
|
||||
node.mask,
|
||||
node.inputs.sublist(1),
|
||||
node.inputs.sublist(1), // Drop interceptor.
|
||||
node.instructionType,
|
||||
node.typeArguments,
|
||||
node.sourceInformation);
|
||||
node.sourceInformation,
|
||||
isIntercepted: false);
|
||||
result.element = target;
|
||||
return result;
|
||||
}
|
||||
|
@ -481,10 +482,11 @@ class SsaInstructionSimplifier extends HBaseVisitor
|
|||
HInvokeDynamicMethod splitInstruction = new HInvokeDynamicMethod(
|
||||
node.selector,
|
||||
node.mask,
|
||||
node.inputs.sublist(1),
|
||||
node.inputs.sublist(1), // Drop interceptor.
|
||||
resultMask,
|
||||
const <DartType>[],
|
||||
node.sourceInformation)
|
||||
node.sourceInformation,
|
||||
isIntercepted: false)
|
||||
..element = commonElements.jsStringSplit
|
||||
..isAllocation = true;
|
||||
|
||||
|
@ -1310,7 +1312,8 @@ class SsaInstructionSimplifier extends HBaseVisitor
|
|||
inputs,
|
||||
toStringType,
|
||||
const <DartType>[],
|
||||
node.sourceInformation);
|
||||
node.sourceInformation,
|
||||
isIntercepted: true);
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -219,7 +219,6 @@ integer_to_radix_string_test/01: RuntimeError
|
|||
integer_to_radix_string_test/02: RuntimeError
|
||||
integer_to_radix_string_test/none: RuntimeError
|
||||
integer_to_string_test/01: RuntimeError
|
||||
iterable_empty_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart': Failed assertion: line 391 pos 16: 'receiver.nonCheck() == user.inputs[1].nonCheck()': is not true.
|
||||
iterable_fold_test: Crash # NoSuchMethodError: The getter 'isDynamic' was called on null.
|
||||
iterable_followed_by_test: RuntimeError
|
||||
iterable_reduce_test: Crash # NoSuchMethodError: The getter 'isDynamic' was called on null.
|
||||
|
@ -232,7 +231,6 @@ list_test/01: RuntimeError
|
|||
list_test/none: RuntimeError
|
||||
list_unmodifiable_test: RuntimeError
|
||||
nan_infinity_test/01: RuntimeError
|
||||
queue_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart': Failed assertion: line 391 pos 16: 'receiver.nonCheck() == user.inputs[1].nonCheck()': is not true.
|
||||
reg_exp_all_matches_test: RuntimeError
|
||||
reg_exp_start_end_test: RuntimeError
|
||||
regexp/capture_test: RuntimeError
|
||||
|
@ -286,7 +284,6 @@ list_test/none: RuntimeError
|
|||
list_unmodifiable_test: RuntimeError
|
||||
nan_infinity_test/01: RuntimeError
|
||||
nsm_invocation_test: RuntimeError # Symbols don't match due to minifiaction.
|
||||
queue_test: RuntimeError
|
||||
reg_exp_all_matches_test: RuntimeError
|
||||
reg_exp_start_end_test: RuntimeError
|
||||
regexp/capture_test: RuntimeError
|
||||
|
|
Loading…
Reference in a new issue