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

Unified Diff: runtime/vm/object.h

Issue 1182103003: Assert typed data is external iff actually not in heap. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Assert in ExternalTypedData::SetData and External*String::SetExternalData Created 5 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/dart_api_impl.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
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 62a5b2dbe6d1a43ba477ec39e29fa1022f309e61..ec93a9bb4b0929a09895750a9ed0cf66050b61dd 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -6416,6 +6416,8 @@ class ExternalOneByteString : public AllStatic {
static void SetExternalData(const String& str,
ExternalStringData<uint8_t>* data) {
ASSERT(str.IsExternalOneByteString());
+ ASSERT(!Isolate::Current()->heap()->Contains(
+ reinterpret_cast<uword>(data->data())));
str.StoreNonPointer(&raw_ptr(str)->external_data_, data);
}
@@ -6492,6 +6494,8 @@ class ExternalTwoByteString : public AllStatic {
static void SetExternalData(const String& str,
ExternalStringData<uint16_t>* data) {
ASSERT(str.IsExternalTwoByteString());
+ ASSERT(!Isolate::Current()->heap()->Contains(
+ reinterpret_cast<uword>(data->data())));
str.StoreNonPointer(&raw_ptr(str)->external_data_, data);
}
@@ -7173,6 +7177,8 @@ class ExternalTypedData : public Instance {
}
void SetData(uint8_t* data) const {
+ ASSERT(!Isolate::Current()->heap()->Contains(
+ reinterpret_cast<uword>(data)));
StoreNonPointer(&raw_ptr()->data_, data);
}
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698