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

Unified Diff: runtime/vm/object.cc

Issue 8437028: Perform type canonicalization as part of type finalization. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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/class_finalizer.cc ('k') | runtime/vm/raw_object.h » ('j') | 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 1053)
+++ runtime/vm/object.cc (working copy)
@@ -713,9 +713,17 @@
RawType* Class::SignatureType() const {
- // Return the cached signature type if any.
- if (raw_ptr()->signature_type_ != Type::null()) {
- return raw_ptr()->signature_type_;
+ // Return the only canonical signature type if already computed.
+ const Array& signature_types = Array::Handle(canonical_types());
+ if (signature_types.Length() > 0) {
+ Type& signature_type = Type::Handle();
+ signature_type ^= signature_types.At(0);
+ if (!signature_type.IsNull()) {
+ // A signature class has a unique canonical signature type.
+ ASSERT((signature_types.Length() == 1) ||
+ signature_types.At(1) == Object::null());
+ return signature_type.raw();
+ }
}
ASSERT(IsSignatureClass());
TypeArguments& signature_type_arguments = TypeArguments::Handle();
@@ -738,9 +746,8 @@
const ParameterizedType& signature_type = ParameterizedType::Handle(
ParameterizedType::New(*this, signature_type_arguments));
- // Cache and return the still unfinalized signature type.
+ // Return the still unfinalized signature type.
ASSERT(!signature_type.IsFinalized());
- set_signature_type(signature_type);
return signature_type.raw();
}
@@ -815,11 +822,6 @@
}
-void Class::set_signature_type(const Type& value) const {
- StorePointer(&raw_ptr()->signature_type_, value.raw());
-}
-
-
void Class::set_class_state(int8_t state) const {
ASSERT(state == RawClass::kAllocated ||
state == RawClass::kPreFinalized ||
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698