mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
[VM] Make Object::RawCast() allow "null" objects - similar to Object::^=
Change-Id: I9a05f0c6d36ed3a59d2742c0c84398dd6acba31a Reviewed-on: https://dart-review.googlesource.com/32280 Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
parent
534dcf6874
commit
5b56dfb77a
2 changed files with 21 additions and 14 deletions
|
@ -424,11 +424,12 @@ Instruction* AssertSubtypeInstr::Canonicalize(FlowGraph* flow_graph) {
|
|||
constant_function_type_args->value().IsTypeArguments());
|
||||
|
||||
Zone* Z = Thread::Current()->zone();
|
||||
TypeArguments& instantiator_type_args = TypeArguments::Handle(Z);
|
||||
instantiator_type_args ^= constant_instantiator_type_args->value().raw();
|
||||
const TypeArguments& instantiator_type_args = TypeArguments::Handle(
|
||||
Z,
|
||||
TypeArguments::RawCast(constant_instantiator_type_args->value().raw()));
|
||||
|
||||
TypeArguments& function_type_args = TypeArguments::Handle(Z);
|
||||
function_type_args ^= constant_function_type_args->value().raw();
|
||||
const TypeArguments& function_type_args = TypeArguments::Handle(
|
||||
Z, TypeArguments::RawCast(constant_function_type_args->value().raw()));
|
||||
|
||||
Error& error_bound = Error::Handle(Z);
|
||||
|
||||
|
@ -2145,15 +2146,21 @@ Definition* AssertAssignableInstr::Canonicalize(FlowGraph* flow_graph) {
|
|||
constant_instantiator_type_args->value().IsTypeArguments());
|
||||
ASSERT(constant_function_type_args->value().IsNull() ||
|
||||
constant_function_type_args->value().IsTypeArguments());
|
||||
TypeArguments& instantiator_type_args = TypeArguments::Handle();
|
||||
instantiator_type_args ^= constant_instantiator_type_args->value().raw();
|
||||
TypeArguments& function_type_args = TypeArguments::Handle();
|
||||
function_type_args ^= constant_function_type_args->value().raw();
|
||||
Error& bound_error = Error::Handle();
|
||||
AbstractType& new_dst_type =
|
||||
AbstractType::Handle(dst_type().InstantiateFrom(
|
||||
instantiator_type_args, function_type_args, kAllFree, &bound_error,
|
||||
NULL, NULL, Heap::kOld));
|
||||
|
||||
Zone* Z = Thread::Current()->zone();
|
||||
const TypeArguments& instantiator_type_args = TypeArguments::Handle(
|
||||
Z,
|
||||
TypeArguments::RawCast(constant_instantiator_type_args->value().raw()));
|
||||
|
||||
const TypeArguments& function_type_args = TypeArguments::Handle(
|
||||
Z, TypeArguments::RawCast(constant_function_type_args->value().raw()));
|
||||
|
||||
Error& bound_error = Error::Handle(Z);
|
||||
|
||||
AbstractType& new_dst_type = AbstractType::Handle(
|
||||
Z, dst_type().InstantiateFrom(instantiator_type_args,
|
||||
function_type_args, kAllFree,
|
||||
&bound_error, NULL, NULL, Heap::kOld));
|
||||
if (new_dst_type.IsMalformedOrMalbounded() || !bound_error.IsNull()) {
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ class Symbols;
|
|||
return reinterpret_cast<const object&>(obj); \
|
||||
} \
|
||||
static Raw##object* RawCast(RawObject* raw) { \
|
||||
ASSERT(Object::Handle(raw).Is##object()); \
|
||||
ASSERT(Object::Handle(raw).IsNull() || Object::Handle(raw).Is##object()); \
|
||||
return reinterpret_cast<Raw##object*>(raw); \
|
||||
} \
|
||||
static Raw##object* null() { \
|
||||
|
|
Loading…
Reference in a new issue