mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Enable GVN on HForeignNew
R=sigmund@google.com Review URL: https://codereview.chromium.org/2422003002 .
This commit is contained in:
parent
997581ccec
commit
790b9d9cb1
|
@ -873,6 +873,8 @@ abstract class HInstruction implements Spannable {
|
|||
static const int TYPE_INFO_READ_VARIABLE_TYPECODE = 39;
|
||||
static const int TYPE_INFO_EXPRESSION_TYPECODE = 40;
|
||||
|
||||
static const int FOREIGN_CODE_TYPECODE = 41;
|
||||
|
||||
HInstruction(this.inputs, this.instructionType)
|
||||
: id = idCounter++,
|
||||
usedBy = <HInstruction>[] {
|
||||
|
@ -1901,6 +1903,9 @@ class HForeignCode extends HForeign {
|
|||
assert(this.throwBehavior != null);
|
||||
|
||||
if (effects != null) sideEffects.add(effects);
|
||||
if (nativeBehavior != null && nativeBehavior.useGvn) {
|
||||
setUseGvn();
|
||||
}
|
||||
}
|
||||
|
||||
HForeignCode.statement(js.Template codeTemplate, List<HInstruction> inputs,
|
||||
|
@ -1927,7 +1932,13 @@ class HForeignCode extends HForeign {
|
|||
bool get isAllocation =>
|
||||
nativeBehavior != null && nativeBehavior.isAllocation && !canBeNull();
|
||||
|
||||
String toString() => 'HForeignCode("${codeTemplate.source}",$inputs)';
|
||||
int typeCode() => HInstruction.FOREIGN_CODE_TYPECODE;
|
||||
bool typeEquals(other) => other is HForeignCode;
|
||||
bool dataEquals(HForeignCode other) {
|
||||
return codeTemplate.source == other.codeTemplate.source;
|
||||
}
|
||||
|
||||
String toString() => 'HForeignCode("${codeTemplate.source}", $inputs)';
|
||||
}
|
||||
|
||||
abstract class HInvokeBinary extends HInstruction {
|
||||
|
|
|
@ -56,7 +56,7 @@ class JSNumber extends Interceptor implements num {
|
|||
return JS('num', r'# % #', this, b);
|
||||
}
|
||||
|
||||
num abs() => JS('returns:num;effects:none;depends:none;throws:never',
|
||||
num abs() => JS('returns:num;effects:none;depends:none;throws:never;gvn:true',
|
||||
r'Math.abs(#)', this);
|
||||
|
||||
num get sign => this > 0 ? 1 : this < 0 ? -1 : this;
|
||||
|
|
Loading…
Reference in a new issue