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

Unified Diff: runtime/vm/object.h

Issue 16780009: When canonicalize instances check if all fields are canonical. If a field is a non-canonical number… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/flow_graph_optimizer.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 23933)
+++ runtime/vm/object.h (working copy)
@@ -3529,7 +3529,12 @@
class Instance : public Object {
public:
virtual bool Equals(const Instance& other) const;
- virtual RawInstance* Canonicalize() const;
+ // Returns Instance::null() if instance cannot be canonicalized.
+ // Any non-canonical number of string will be canonicalized here.
+ // An instance cannot be canonicalized if it still contains non-canonical
+ // instances in its fields.
+ // Returns error in error_str, pass NULL if an error cannot occur.
+ virtual RawInstance* CheckAndCanonicalize(const char** error_str) const;
RawObject* GetField(const Field& field) const {
return *FieldAddr(field);
@@ -3620,6 +3625,10 @@
const AbstractTypeArguments& instantiator_type_arguments,
Error* malformed_error) const;
+ virtual RawInstance* CheckAndCanonicalize(const char** error_str) const {
+ return Canonicalize();
+ }
+
// Return the canonical version of this type.
virtual RawAbstractType* Canonicalize() const;
@@ -4073,7 +4082,7 @@
virtual bool IsZero() const { return Value() == 0; }
virtual bool IsNegative() const { return Value() < 0; }
// Smi values are implicitly canonicalized.
- virtual RawInstance* Canonicalize() const {
+ virtual RawInstance* CheckAndCanonicalize(const char** error_str) const {
return reinterpret_cast<RawSmi*>(raw_value());
}
@@ -4403,7 +4412,7 @@
bool StartsWith(const String& other) const;
- virtual RawInstance* Canonicalize() const;
+ virtual RawInstance* CheckAndCanonicalize(const char** error_str) const;
bool IsSymbol() const { return raw()->IsCanonical(); }
@@ -5113,6 +5122,11 @@
virtual bool Equals(const Instance& other) const;
+ virtual RawInstance* CheckAndCanonicalize(const char** error_str) const {
+ UNREACHABLE();
+ return Instance::null();
+ }
+
static intptr_t type_arguments_offset() {
return OFFSET_OF(RawGrowableObjectArray, type_arguments_);
}
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698