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

Unified Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 2718513002: Void is not required to be `null` anymore. (Closed)
Patch Set: Fix more places in the VM. Created 3 years, 10 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_x64.cc
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index 6c69c8062be31eaeab8bcd0b3e87eced12d3850d..db544a9f33852c2ad3612b90c2b088d99a171e44 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -511,11 +511,6 @@ RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof(
Label* is_instance_lbl,
Label* is_not_instance_lbl) {
__ Comment("InlineInstanceof");
- 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(zone(), type.type_class());
// A class equality check is only applicable with a dst type (not a
@@ -559,15 +554,15 @@ void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos,
bool negate_result,
LocationSummary* locs) {
ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded());
- ASSERT(!type.IsObjectType() && !type.IsDynamicType());
+ ASSERT(!type.IsObjectType() && !type.IsDynamicType() && !type.IsVoidType());
Label is_instance, is_not_instance;
__ pushq(RDX); // Store instantiator type arguments.
// If type is instantiated and non-parameterized, we can inline code
// checking whether the tested instance is a Smi.
if (type.IsInstantiated()) {
- // A null object is only an instance of Null, Object, and dynamic.
- // Object and dynamic have already been checked above (if the type is
+ // A null object is only an instance of Null, Object, void and dynamic.
+ // Object void and dynamic have already been checked above (if the type is
// instantiated). So we can return false here if the instance is null,
// unless the type is Null (and if the type is instantiated).
// We can only inline this null check if the type is instantiated at compile
@@ -640,7 +635,8 @@ void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos,
ASSERT(dst_type.IsFinalized());
// Assignable check is skipped in FlowGraphBuilder, not here.
ASSERT(dst_type.IsMalformedOrMalbounded() ||
- (!dst_type.IsDynamicType() && !dst_type.IsObjectType()));
+ (!dst_type.IsDynamicType() && !dst_type.IsObjectType() &&
+ !dst_type.IsVoidType()));
__ pushq(RDX); // Store instantiator type arguments.
// A null object is always assignable and is returned as result.
Label is_assignable, runtime_call;

Powered by Google App Engine
This is Rietveld 408576698