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

Unified Diff: runtime/lib/object.cc

Issue 2799373002: Pass a second type argument vector to all type instantiation calls in the VM. (Closed)
Patch Set: addressed comments Created 3 years, 8 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/lib/mirrors.cc ('k') | runtime/lib/object_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/object.cc
diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc
index bdfc43dbedda78dc6ccf4ea2bac121854d317f1d..603f40c0acf24a19cd09e5908179e2a810453b10 100644
--- a/runtime/lib/object.cc
+++ b/runtime/lib/object.cc
@@ -169,19 +169,21 @@ DEFINE_NATIVE_ENTRY(Object_haveSameRuntimeType, 2) {
}
-DEFINE_NATIVE_ENTRY(Object_instanceOf, 3) {
+DEFINE_NATIVE_ENTRY(Object_instanceOf, 4) {
const Instance& instance =
Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
const TypeArguments& instantiator_type_arguments =
TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1));
+ const TypeArguments& function_type_arguments =
+ TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(2));
const AbstractType& type =
- AbstractType::CheckedHandle(zone, arguments->NativeArgAt(2));
+ AbstractType::CheckedHandle(zone, arguments->NativeArgAt(3));
ASSERT(type.IsFinalized());
ASSERT(!type.IsMalformed());
ASSERT(!type.IsMalbounded());
Error& bound_error = Error::Handle(zone, Error::null());
- const bool is_instance_of =
- instance.IsInstanceOf(type, instantiator_type_arguments, &bound_error);
+ const bool is_instance_of = instance.IsInstanceOf(
+ type, instantiator_type_arguments, function_type_arguments, &bound_error);
if (FLAG_trace_type_checks) {
const char* result_str = is_instance_of ? "true" : "false";
OS::Print("Native Object.instanceOf: result %s\n", result_str);
@@ -218,14 +220,14 @@ DEFINE_NATIVE_ENTRY(Object_simpleInstanceOf, 2) {
Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
const AbstractType& type =
AbstractType::CheckedHandle(zone, arguments->NativeArgAt(1));
- const TypeArguments& instantiator_type_arguments =
- TypeArguments::Handle(TypeArguments::null());
ASSERT(type.IsFinalized());
ASSERT(!type.IsMalformed());
ASSERT(!type.IsMalbounded());
+ ASSERT(type.IsInstantiated());
Error& bound_error = Error::Handle(zone, Error::null());
const bool is_instance_of =
- instance.IsInstanceOf(type, instantiator_type_arguments, &bound_error);
+ instance.IsInstanceOf(type, Object::null_type_arguments(),
+ Object::null_type_arguments(), &bound_error);
if (!is_instance_of && !bound_error.IsNull()) {
// Throw a dynamic type error only if the instanceof test fails.
DartFrameIterator iterator;
@@ -243,20 +245,23 @@ DEFINE_NATIVE_ENTRY(Object_simpleInstanceOf, 2) {
}
-DEFINE_NATIVE_ENTRY(Object_as, 3) {
+DEFINE_NATIVE_ENTRY(Object_as, 4) {
const Instance& instance =
Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
const TypeArguments& instantiator_type_arguments =
TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1));
+ const TypeArguments& function_type_arguments =
+ TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(2));
AbstractType& type =
- AbstractType::CheckedHandle(zone, arguments->NativeArgAt(2));
+ AbstractType::CheckedHandle(zone, arguments->NativeArgAt(3));
ASSERT(type.IsFinalized());
ASSERT(!type.IsMalformed());
ASSERT(!type.IsMalbounded());
Error& bound_error = Error::Handle(zone);
const bool is_instance_of =
instance.IsNull() ||
- instance.IsInstanceOf(type, instantiator_type_arguments, &bound_error);
+ instance.IsInstanceOf(type, instantiator_type_arguments,
+ function_type_arguments, &bound_error);
if (FLAG_trace_type_checks) {
const char* result_str = is_instance_of ? "true" : "false";
OS::Print("Object.as: result %s\n", result_str);
@@ -279,7 +284,8 @@ DEFINE_NATIVE_ENTRY(Object_as, 3) {
AbstractType::Handle(zone, instance.GetType(Heap::kNew));
if (!type.IsInstantiated()) {
// Instantiate type before reporting the error.
- type = type.InstantiateFrom(instantiator_type_arguments, NULL, NULL, NULL,
+ type = type.InstantiateFrom(instantiator_type_arguments,
+ function_type_arguments, NULL, NULL, NULL,
Heap::kNew);
// Note that the instantiated type may be malformed.
}
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/lib/object_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698