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

Unified Diff: runtime/vm/flow_graph_compiler_mips.cc

Issue 1584223006: Remove signature classes from the VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
Index: runtime/vm/flow_graph_compiler_mips.cc
diff --git a/runtime/vm/flow_graph_compiler_mips.cc b/runtime/vm/flow_graph_compiler_mips.cc
index f98bb67b6aa76f8e010a96e3eafae1002e413de5..56ca3d079864bdf6c15a6d1b43d4255e18ff5a65 100644
--- a/runtime/vm/flow_graph_compiler_mips.cc
+++ b/runtime/vm/flow_graph_compiler_mips.cc
@@ -265,7 +265,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 = A0;
Error& bound_error = Error::Handle(zone());
const Type& int_type = Type::Handle(zone(), Type::IntType());
@@ -278,15 +278,15 @@ FlowGraphCompiler::GenerateInstantiatedTypeWithArgumentsTest(
} else {
__ beq(CMPRES1, ZR, 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 = T0;
// dynamic type argument, check only classes.
@@ -353,6 +353,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);
@@ -382,11 +386,9 @@ bool FlowGraphCompiler::GenerateInstantiatedTypeNoArgumentsTest(
__ b(is_not_instance_lbl);
return false;
}
- if (type.IsFunctionType()) {
+ if (type.IsDartFunctionType()) {
// Check if instance is a closure.
- __ LoadClassById(T1, kClassIdReg);
- __ lw(T1, FieldAddress(T1, Class::signature_function_offset()));
- __ BranchNotEqual(T1, Object::null_object(), is_instance_lbl);
+ __ BranchEqual(kClassIdReg, Immediate(kClosureCid), is_instance_lbl);
}
// Custom checking for numbers (Smi, Mint, Bigint and Double).
// Note that instance is not Smi (checked above).
@@ -535,10 +537,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,

Powered by Google App Engine
This is Rietveld 408576698