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

Unified Diff: runtime/vm/object.h

Issue 8773026: Canonicalize TypeArguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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/code_generator.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 2130)
+++ runtime/vm/object.h (working copy)
@@ -981,6 +981,9 @@
const AbstractTypeArguments& instantiator_type_arguments,
intptr_t offset) const;
+ // Do not canonicalize InstantiatedTypeArguments or NULL objects
+ virtual RawAbstractTypeArguments* Canonicalize() const { return this->raw(); }
+
// Check if this type argument vector consists solely of DynamicType,
// considering only a prefix of length 'len'.
bool IsDynamicTypes(intptr_t len) const;
@@ -990,9 +993,7 @@
bool IsMoreSpecificThan(
const AbstractTypeArguments& other, intptr_t len) const;
- static RawAbstractTypeArguments* NewInstantiatedTypeArguments(
- const AbstractTypeArguments& uninstantiated_type_arguments,
- const AbstractTypeArguments& instantiator_type_arguments);
+ bool Equals(const AbstractTypeArguments& other) const;
// UNREACHABLEs as AbstractTypeArguments is an abstract class.
virtual intptr_t Length() const;
@@ -1001,7 +1002,6 @@
virtual bool IsResolved() const;
virtual bool IsInstantiated() const;
virtual bool IsUninstantiatedIdentity() const;
- virtual bool Equals(const AbstractTypeArguments& other) const;
protected:
HEAP_OBJECT_IMPLEMENTATION(AbstractTypeArguments, Object);
@@ -1018,7 +1018,8 @@
virtual bool IsResolved() const;
virtual bool IsInstantiated() const;
virtual bool IsUninstantiatedIdentity() const;
- virtual bool Equals(const AbstractTypeArguments& other) const;
+ // Canonicalize only if instantiated, otherwise returns 'this'.
+ virtual RawAbstractTypeArguments* Canonicalize() const;
virtual RawAbstractTypeArguments* InstantiateFrom(
const AbstractTypeArguments& instantiator_type_arguments,
@@ -1035,13 +1036,16 @@
static intptr_t InstanceSize(intptr_t len) {
// Ensure that the types_ is not adding to the object length.
- ASSERT(sizeof(RawTypeArguments) == 2 * kWordSize);
+ ASSERT(sizeof(RawTypeArguments) == 3 * kWordSize);
return RoundedAllocationSize(sizeof(RawTypeArguments) + (len * kWordSize));
}
static RawTypeArguments* New(intptr_t len);
private:
+ bool is_canonical() const;
+ void set_is_canonical(bool value) const;
+
// Make sure that the array size cannot wrap around.
static const intptr_t kMaxTypes = 512 * 1024 * 1024;
RawAbstractType** TypeAddr(intptr_t index) const;
@@ -2923,7 +2927,7 @@
return raw_ptr()->type_arguments_;
}
virtual void SetTypeArguments(const AbstractTypeArguments& value) const {
- raw_ptr()->type_arguments_ = value.raw();
+ raw_ptr()->type_arguments_ = value.Canonicalize();
}
virtual bool Equals(const Instance& other) const;
@@ -3076,7 +3080,7 @@
return raw_ptr()->type_arguments_;
}
virtual void SetTypeArguments(const AbstractTypeArguments& value) const {
- raw_ptr()->type_arguments_ = value.raw();
+ raw_ptr()->type_arguments_ = value.Canonicalize();
}
static intptr_t type_arguments_offset() {
return OFFSET_OF(RawClosure, type_arguments_);
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698