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

Unified Diff: runtime/vm/flow_graph_compiler_arm.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_builder.cc ('k') | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler_arm.cc
diff --git a/runtime/vm/flow_graph_compiler_arm.cc b/runtime/vm/flow_graph_compiler_arm.cc
index 90d7e0e002cfe5fc6ece231186978b38e0530c64..2b501e93f67a0ccdf5d2658499aa2bede8439181 100644
--- a/runtime/vm/flow_graph_compiler_arm.cc
+++ b/runtime/vm/flow_graph_compiler_arm.cc
@@ -273,7 +273,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 = R0;
Error& bound_error = Error::Handle(zone());
const Type& int_type = Type::Handle(zone(), Type::IntType());
@@ -286,15 +286,15 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
} else {
__ b(is_not_instance_lbl, EQ);
}
- 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 = R2;
// 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(
__ b(is_not_instance_lbl);
return false;
}
- if (type.IsFunctionType()) {
+ if (type.IsDartFunctionType()) {
// Check if instance is a closure.
- __ LoadClassById(R3, kClassIdReg);
- __ ldr(R3, FieldAddress(R3, Class::signature_function_offset()));
- __ CompareObject(R3, Object::null_object());
- __ b(is_instance_lbl, NE);
+ __ CompareImmediate(kClassIdReg, kClosureCid);
+ __ b(is_instance_lbl, EQ);
}
// Custom checking for numbers (Smi, Mint, Bigint and Double).
// Note that instance is not Smi (checked above).
@@ -547,10 +549,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_builder.cc ('k') | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698