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

Unified Diff: runtime/vm/object.h

Issue 22314017: Do not use guarded cid on externalizable cid-s (one and two byte strings). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/dart_api_impl_test.cc ('k') | no next file » | 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 25830)
+++ runtime/vm/object.h (working copy)
@@ -1961,7 +1961,14 @@
// Return class id that any non-null value read from this field is guaranteed
// to have or kDynamicCid if such class id is not known.
// Stores to this field must update this information hence the name.
- intptr_t guarded_cid() const { return raw_ptr()->guarded_cid_; }
+ intptr_t guarded_cid() const {
Vyacheslav Egorov (Google) 2013/08/07 17:56:09 Please add assertion in the place where we infer C
srdjan 2013/08/07 18:27:48 Done.
+ const intptr_t cid = raw_ptr()->guarded_cid_;
+ if (IsExternalizableCid(cid)) {
+ return kDynamicCid;
+ } else {
+ return cid;
+ }
+ }
void set_guarded_cid(intptr_t cid) const {
raw_ptr()->guarded_cid_ = cid;
}
@@ -1969,6 +1976,10 @@
return OFFSET_OF(RawField, guarded_cid_);
}
+ static bool IsExternalizableCid(intptr_t cid) {
+ return (cid == kOneByteStringCid) || (cid == kTwoByteStringCid);
+ }
+
// Returns false if any value read from this field is guaranteed to be
// not null.
// Internally we is_nullable_ field contains either kNullCid (nullable) or
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698