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

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
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 2094)
+++ 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.
+ 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();
regis 2011/12/05 23:16:35 I would make it more obvious that setting the Type
srdjan 2011/12/06 17:24:15 Discussed the inline assembly (went through code t
}
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') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698