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

Unified Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 2257803003: VM: Better code for is-checks and checked mode checks with simple types (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 | « runtime/vm/flow_graph_compiler_mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler_x64.cc
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index 9118bb12d6e5b3b0ccbd968d7ba376858e670b7c..6cd1301c37b47bd4e7151b144aa0a23e80e765fd 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -387,11 +387,8 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
} else {
__ j(ZERO, is_not_instance_lbl);
}
- // Compare if the classes are equal.
const Register kClassIdReg = R10;
__ LoadClassId(kClassIdReg, kInstanceReg);
- __ cmpl(kClassIdReg, Immediate(type_class.id()));
- __ j(EQUAL, is_instance_lbl);
// See ClassFinalizer::ResolveSuperTypeAndInterfaces for list of restricted
// interfaces.
// Bool interface can be implemented only by core class Bool.
@@ -401,11 +398,6 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
__ jmp(is_not_instance_lbl);
return false;
}
- if (type.IsDartFunctionType()) {
- // Check if instance is a closure.
- __ cmpq(kClassIdReg, Immediate(kClosureCid));
- __ j(EQUAL, is_instance_lbl);
- }
// Custom checking for numbers (Smi, Mint, Bigint and Double).
// Note that instance is not Smi (checked above).
if (type.IsSubtypeOf(
@@ -418,6 +410,17 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl);
return false;
}
+ if (type.IsDartFunctionType()) {
+ // Check if instance is a closure.
+ __ cmpq(kClassIdReg, Immediate(kClosureCid));
+ __ j(EQUAL, is_instance_lbl);
+ return true;
+ }
+ // Compare if the classes are equal.
+ if (!type_class.is_abstract()) {
+ __ cmpl(kClassIdReg, Immediate(type_class.id()));
+ __ j(EQUAL, is_instance_lbl);
+ }
// Otherwise fallthrough.
return true;
}
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698