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

Unified Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 1584223006: Remove signature classes from the VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 11 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') | runtime/vm/flow_graph_inliner.cc » ('j') | 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 30382e6e81dd26cbca8c9ba3aab6572bbee1f2fa..5e176e5df1936242a55d5dc8ed85611f5a27c45c 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -274,7 +274,7 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
__ Comment("InstantiatedTypeWithArgumentsTest");
ASSERT(type.IsInstantiated());
const Class& type_class = Class::ZoneHandle(zone(), type.type_class());
- ASSERT((type_class.NumTypeArguments() > 0) || type_class.IsSignatureClass());
+ ASSERT(type.IsFunctionType() || (type_class.NumTypeArguments() > 0));
const Register kInstanceReg = RAX;
Error& bound_error = Error::Handle(zone());
const Type& int_type = Type::Handle(zone(), Type::IntType());
@@ -287,15 +287,15 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
} else {
__ j(ZERO, is_not_instance_lbl);
}
- const intptr_t num_type_args = type_class.NumTypeArguments();
- const intptr_t num_type_params = type_class.NumTypeParameters();
- const intptr_t from_index = num_type_args - num_type_params;
- const TypeArguments& type_arguments =
- TypeArguments::ZoneHandle(zone(), type.arguments());
- const bool is_raw_type = type_arguments.IsNull() ||
- type_arguments.IsRaw(from_index, num_type_params);
- // Signature class is an instantiated parameterized type.
- if (!type_class.IsSignatureClass()) {
+ // A function type test requires checking the function signature.
+ if (!type.IsFunctionType()) {
+ const intptr_t num_type_args = type_class.NumTypeArguments();
+ const intptr_t num_type_params = type_class.NumTypeParameters();
+ const intptr_t from_index = num_type_args - num_type_params;
+ const TypeArguments& type_arguments =
+ TypeArguments::ZoneHandle(zone(), type.arguments());
+ const bool is_raw_type = type_arguments.IsNull() ||
+ type_arguments.IsRaw(from_index, num_type_params);
if (is_raw_type) {
const Register kClassIdReg = R10;
// dynamic type argument, check only classes.
@@ -362,6 +362,10 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
Label* is_not_instance_lbl) {
__ Comment("InstantiatedTypeNoArgumentsTest");
ASSERT(type.IsInstantiated());
+ if (type.IsFunctionType()) {
+ // Fallthrough.
+ return true;
+ }
const Class& type_class = Class::Handle(zone(), type.type_class());
ASSERT(type_class.NumTypeArguments() == 0);
@@ -392,12 +396,10 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
__ jmp(is_not_instance_lbl);
return false;
}
- if (type.IsFunctionType()) {
+ if (type.IsDartFunctionType()) {
// Check if instance is a closure.
- __ LoadClassById(R13, kClassIdReg);
- __ movq(R13, FieldAddress(R13, Class::signature_function_offset()));
- __ CompareObject(R13, Object::null_object());
- __ j(NOT_EQUAL, is_instance_lbl);
+ __ 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).
@@ -549,10 +551,10 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
}
if (type.IsInstantiated()) {
const Class& type_class = Class::ZoneHandle(zone(), type.type_class());
- // A class equality check is only applicable with a dst type of a
- // non-parameterized class, non-signature class, or with a raw dst type of
+ // A class equality check is only applicable with a dst type (not a
+ // function type) of a non-parameterized class or with a raw dst type of
// a parameterized class.
- if (type_class.IsSignatureClass() || (type_class.NumTypeArguments() > 0)) {
+ if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) {
return GenerateInstantiatedTypeWithArgumentsTest(token_pos,
type,
is_instance_lbl,
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698