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

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
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 23823)
+++ runtime/vm/object.h (working copy)
@@ -3517,7 +3517,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);
@@ -3608,6 +3613,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;
@@ -4061,7 +4070,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());
}
@@ -4391,7 +4400,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(); }
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698