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

Unified Diff: runtime/vm/flow_graph_compiler_ia32.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_arm64.cc ('k') | runtime/vm/flow_graph_compiler_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler_ia32.cc
diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc
index fbfe34cbbe755e127a7cfb3bd583ea14aa56dbb4..5be0f085fad1ee22c11a1c9b213fb583b7504362 100644
--- a/runtime/vm/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/flow_graph_compiler_ia32.cc
@@ -390,11 +390,8 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
} else {
__ j(ZERO, is_not_instance_lbl);
}
- // Compare if the classes are equal.
const Register kClassIdReg = ECX;
__ 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.
@@ -404,11 +401,6 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
__ jmp(is_not_instance_lbl);
return false;
}
- if (type.IsDartFunctionType()) {
- // Check if instance is a closure.
- __ cmpl(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(
@@ -421,6 +413,17 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl);
return false;
}
+ if (type.IsDartFunctionType()) {
+ // Check if instance is a closure.
+ __ cmpl(kClassIdReg, Immediate(kClosureCid));
+ __ j(EQUAL, is_instance_lbl);
+ return true; // Fall through
+ }
+ // 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_arm64.cc ('k') | runtime/vm/flow_graph_compiler_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698