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

Unified Diff: runtime/vm/flow_graph_compiler_dbc.cc

Issue 2404163004: DBC: Add Smi fastpath to AssertAssignable (Closed)
Patch Set: Remove spurious comment Created 4 years, 2 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/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler_dbc.cc
diff --git a/runtime/vm/flow_graph_compiler_dbc.cc b/runtime/vm/flow_graph_compiler_dbc.cc
index fad3bd807b5d51a30c724215ff89f10fefd468d8..749d20a82c1104d20c11ea7bec02749f87bd0900 100644
--- a/runtime/vm/flow_graph_compiler_dbc.cc
+++ b/runtime/vm/flow_graph_compiler_dbc.cc
@@ -234,7 +234,20 @@ void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos,
if (dst_type.IsMalformedOrMalbounded()) {
__ BadTypeError();
} else {
- __ AssertAssignable(__ AddConstant(test_cache));
+ bool may_be_smi = false;
+ if (!dst_type.IsVoidType() && dst_type.IsInstantiated()) {
+ const Class& type_class = Class::Handle(zone(), dst_type.type_class());
+ if (type_class.NumTypeArguments() == 0) {
+ const Class& smi_class = Class::Handle(zone(), Smi::Class());
+ may_be_smi = smi_class.IsSubtypeOf(TypeArguments::Handle(zone()),
+ type_class,
+ TypeArguments::Handle(zone()),
+ NULL,
+ NULL,
+ Heap::kOld);
+ }
+ }
+ __ AssertAssignable(may_be_smi ? 1 : 0, __ AddConstant(test_cache));
}
if (is_optimizing()) {
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698