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

Unified Diff: runtime/vm/object.h

Issue 50243004: Fix bug with guarded fields and deserialization. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 29540)
+++ runtime/vm/object.h (working copy)
@@ -863,6 +863,10 @@
RawArray* fields() const { return raw_ptr()->fields_; }
void SetFields(const Array& value) const;
+ // Returns an array of all fields of this class and its superclasses indexed
+ // by offset in words.
+ RawArray* OffsetToFieldMap() const;
+
// Returns true if non-static fields are defined.
bool HasInstanceFields() const;
@@ -2124,13 +2128,9 @@
return OFFSET_OF(RawField, is_nullable_);
}
- // Update guarded class id and nullability of the field to reflect assignment
- // of the value with the given class id to this field. May trigger
- // deoptimization of dependent code.
- void UpdateCid(intptr_t cid) const;
- // Update guarded class length of the field to reflect assignment of the
- // value with the given length. May trigger deoptimization of dependent code.
- void UpdateLength(intptr_t length) const;
+ // Update guarded cid and guarded length for this field. May trigger
+ // deoptimization of dependent optimized code.
+ bool UpdateGuardedCidAndLength(const Object& value) const;
// Return the list of optimized code objects that were optimized under
// assumptions about guarded class id and nullability of this field.
@@ -2169,6 +2169,16 @@
class FinalBit : public BitField<bool, kFinalBit, 1> {};
class HasInitializerBit : public BitField<bool, kHasInitializerBit, 1> {};
+ // Update guarded class id and nullability of the field to reflect assignment
+ // of the value with the given class id to this field. Returns true, if
+ // deoptimization of dependent code is required.
+ bool UpdateCid(intptr_t cid) const;
+
+ // Update guarded class length of the field to reflect assignment of the
+ // value with the given length. Returns true if deoptimization of dependent
+ // code is required.
+ bool UpdateLength(intptr_t length) const;
+
void set_name(const String& value) const;
void set_is_static(bool is_static) const {
set_kind_bits(StaticBit::update(is_static, raw_ptr()->kind_bits_));
@@ -3828,6 +3838,7 @@
}
void SetField(const Field& field, const Object& value) const {
+ field.UpdateGuardedCidAndLength(value);
StorePointer(FieldAddr(field), value.raw());
}
« 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