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

Unified Diff: runtime/vm/object.cc

Issue 186673003: Fix dartbug.com/17261 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 33253)
+++ runtime/vm/object.cc (working copy)
@@ -2018,14 +2018,16 @@
}
-intptr_t Class::NumTypeParameters() const {
+intptr_t Class::NumTypeParameters(Isolate* isolate) const {
if (IsMixinApplication() && !is_mixin_type_applied()) {
ClassFinalizer::ApplyMixinType(*this);
}
if (type_parameters() == TypeArguments::null()) {
return 0;
}
- const TypeArguments& type_params = TypeArguments::Handle(type_parameters());
+ ReusableHandleScope reused_handles(isolate);
+ TypeArguments& type_params = reused_handles.TypeArgumentsHandle();
+ type_params = type_parameters();
return type_params.Length();
}
@@ -12833,8 +12835,9 @@
if (arguments() == other_type.arguments()) {
return true;
}
- const Class& cls = Class::Handle(type_class());
- const intptr_t num_type_params = cls.NumTypeParameters();
+ Isolate* isolate = Isolate::Current();
srdjan 2014/03/04 17:57:07 Why not move this up and use it for all handles?
siva 2014/03/04 18:02:10 I would not move it up as there seem to be number
Ivan Posva 2014/03/04 18:08:59 As Siva says, but added it to the handle allocatio
+ const Class& cls = Class::Handle(isolate, type_class());
+ const intptr_t num_type_params = cls.NumTypeParameters(isolate);
regis 2014/03/04 17:41:41 Passing the isolate looks really strange to me. Wh
Ivan Posva 2014/03/04 18:08:59 Yes.
if (num_type_params == 0) {
// Shortcut unnecessary handle allocation below.
return true;
@@ -16313,12 +16316,18 @@
RawArray* Array::MakeArray(const GrowableObjectArray& growable_array) {
ASSERT(!growable_array.IsNull());
intptr_t used_len = growable_array.Length();
- if (used_len == 0) {
+ // Get the type arguments and prepare to copy them.
+ const TypeArguments& type_arguments =
+ TypeArguments::Handle(growable_array.GetTypeArguments());
+ if ((used_len == 0) && (type_arguments.IsNull())) {
+ // This is a raw List (as in no type arguments), so we can return the
+ // simple empty array.
return Object::empty_array().raw();
}
intptr_t capacity_len = growable_array.Capacity();
Isolate* isolate = Isolate::Current();
const Array& array = Array::Handle(isolate, growable_array.data());
+ array.SetTypeArguments(type_arguments);
intptr_t capacity_size = Array::InstanceSize(capacity_len);
intptr_t used_size = Array::InstanceSize(used_len);
NoGCScope no_gc;
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698