Skip to content

Commit

Permalink
[VM runtime] Store Smi instance type in type test cache when using th…
Browse files Browse the repository at this point in the history
…e interpreter.

Instances of type Smi are handled in generated code and not looked up in
type test cache. The interpreter does not implement this special handling and
relies on the cache for Smi instances as well.

Change-Id: I3a8501efcbadfcbe848871ad0f6ada444414be43
Reviewed-on: https://dart-review.googlesource.com/76305
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
  • Loading branch information
crelier authored and commit-bot@chromium.org committed Sep 25, 2018
1 parent a6b1a99 commit 4cf2d39
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions runtime/vm/runtime_entry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -637,18 +637,24 @@ static void UpdateTypeTestCache(
}
return;
}
Class& instance_class = Class::Handle(zone);
if (instance.IsSmi()) {
if (FLAG_trace_type_checks) {
OS::PrintErr("UpdateTypeTestCache: instance is Smi\n");
if (FLAG_enable_interpreter) {
instance_class = Smi::Class();
} else {
if (FLAG_trace_type_checks) {
OS::PrintErr("UpdateTypeTestCache: instance is Smi, not updating\n");
}
return;
}
return;
} else {
instance_class = instance.clazz();
}
// If the type is uninstantiated and refers to parent function type
// parameters, the function_type_arguments have been canonicalized
// when concatenated.
ASSERT(function_type_arguments.IsNull() ||
function_type_arguments.IsCanonical());
const Class& instance_class = Class::Handle(zone, instance.clazz());
auto& instance_class_id_or_function = Object::Handle(zone);
auto& instance_type_arguments = TypeArguments::Handle(zone);
auto& instance_parent_function_type_arguments = TypeArguments::Handle(zone);
Expand Down

0 comments on commit 4cf2d39

Please sign in to comment.