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

Unified Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 10787021: Fix type checking of void type. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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_ia32.cc ('k') | runtime/vm/heap_test.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
===================================================================
--- runtime/vm/flow_graph_compiler_x64.cc (revision 9680)
+++ runtime/vm/flow_graph_compiler_x64.cc (working copy)
@@ -421,6 +421,11 @@
const AbstractType& type,
Label* is_instance_lbl,
Label* is_not_instance_lbl) {
+ if (type.IsVoidType()) {
+ // A non-null value is returned from a void function, which will result in a
+ // type error. A null value is handled prior to executing this inline code.
+ return SubtypeTestCache::null();
+ }
if (type.IsInstantiated()) {
const Class& type_class = Class::ZoneHandle(type.type_class());
// A Smi object cannot be the instance of a parameterized class.
@@ -433,26 +438,23 @@
is_instance_lbl,
is_not_instance_lbl);
// Fall through to runtime call.
- } else {
- GenerateInstantiatedTypeNoArgumentsTest(cid,
- token_pos,
- type,
- is_instance_lbl,
- is_not_instance_lbl);
- // If test non-conclusive so far, try the inlined type-test cache.
- // 'type' is known at compile time.
- return GenerateSubtype1TestCacheLookup(
- cid, token_pos, type_class,
- is_instance_lbl, is_not_instance_lbl);
}
- } else {
- return GenerateUninstantiatedTypeTest(cid,
- token_pos,
- type,
- is_instance_lbl,
- is_not_instance_lbl);
+ GenerateInstantiatedTypeNoArgumentsTest(cid,
+ token_pos,
+ type,
+ is_instance_lbl,
+ is_not_instance_lbl);
+ // If test non-conclusive so far, try the inlined type-test cache.
+ // 'type' is known at compile time.
+ return GenerateSubtype1TestCacheLookup(
+ cid, token_pos, type_class,
+ is_instance_lbl, is_not_instance_lbl);
}
- return SubtypeTestCache::null();
+ return GenerateUninstantiatedTypeTest(cid,
+ token_pos,
+ type,
+ is_instance_lbl,
+ is_not_instance_lbl);
}
@@ -561,7 +563,6 @@
// Assignable check is skipped in FlowGraphBuilder, not here.
ASSERT(dst_type.IsMalformed() ||
(!dst_type.IsDynamicType() && !dst_type.IsObjectType()));
- ASSERT(!dst_type.IsVoidType());
__ pushq(RCX); // Store instantiator.
__ pushq(RDX); // Store instantiator type arguments.
// A null object is always assignable and is returned as result.
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/heap_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698