mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:17:55 +00:00
Wrap method bodies in a NoGCScope when receiving raw pointer arguments.
BUG=5413582 Review URL: https://chromereviews.googleplex.com/3521023 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@80 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
12b69ca3ba
commit
9a664c355d
|
@ -31,10 +31,12 @@ class LocalScope;
|
|||
public: /* NOLINT */ \
|
||||
Raw##object* raw() const { return reinterpret_cast<Raw##object*>(raw_); } \
|
||||
void operator=(Raw##object* value) { \
|
||||
NoGCScope no_gc; \
|
||||
initializeHandle(this, value); \
|
||||
} \
|
||||
bool Is##object() const { return true; } \
|
||||
void operator^=(RawObject* value) { \
|
||||
NoGCScope no_gc; \
|
||||
initializeHandle(this, value); \
|
||||
ASSERT(IsNull() || Is##object()); \
|
||||
} \
|
||||
|
@ -42,11 +44,13 @@ class LocalScope;
|
|||
return Handle(object::null()); \
|
||||
} \
|
||||
static object& Handle(Raw##object* raw_ptr) { \
|
||||
NoGCScope no_gc; \
|
||||
object* obj = reinterpret_cast<object*>(VMHandles::AllocateHandle()); \
|
||||
initializeHandle(obj, raw_ptr); \
|
||||
return *obj; \
|
||||
} \
|
||||
static object& CheckedHandle(RawObject* raw_ptr) { \
|
||||
NoGCScope no_gc; \
|
||||
object* obj = reinterpret_cast<object*>(VMHandles::AllocateHandle()); \
|
||||
initializeHandle(obj, raw_ptr); \
|
||||
if (!obj->Is##object()) { \
|
||||
|
@ -58,11 +62,13 @@ class LocalScope;
|
|||
return ZoneHandle(object::null()); \
|
||||
} \
|
||||
static object& ZoneHandle(Raw##object* raw_ptr) { \
|
||||
NoGCScope no_gc; \
|
||||
object* obj = reinterpret_cast<object*>(VMHandles::AllocateZoneHandle()); \
|
||||
initializeHandle(obj, raw_ptr); \
|
||||
return *obj; \
|
||||
} \
|
||||
static object& CheckedZoneHandle(RawObject* raw_ptr) { \
|
||||
NoGCScope no_gc; \
|
||||
object* obj = reinterpret_cast<object*>(VMHandles::AllocateZoneHandle()); \
|
||||
initializeHandle(obj, raw_ptr); \
|
||||
if (!obj->Is##object()) { \
|
||||
|
@ -80,6 +86,7 @@ class LocalScope;
|
|||
private: /* NOLINT */ \
|
||||
/* Initialize the handle based on the raw_ptr in the presence of null. */ \
|
||||
static void initializeHandle(object* obj, RawObject* raw_ptr) { \
|
||||
NoGCScope no_gc; \
|
||||
if (raw_ptr != Object::null()) { \
|
||||
obj->SetRaw(raw_ptr); \
|
||||
} else { \
|
||||
|
@ -143,7 +150,10 @@ class Object {
|
|||
virtual ~Object() { }
|
||||
|
||||
RawObject* raw() const { return raw_; }
|
||||
void operator=(RawObject* value) { SetRaw(value); }
|
||||
void operator=(RawObject* value) {
|
||||
NoGCScope no_gc;
|
||||
SetRaw(value);
|
||||
}
|
||||
|
||||
inline RawClass* clazz() const;
|
||||
static intptr_t class_offset() { return OFFSET_OF(RawObject, class_); }
|
||||
|
@ -179,6 +189,7 @@ CLASS_LIST_NO_OBJECT(DEFINE_CLASS_TESTER);
|
|||
}
|
||||
|
||||
static Object& Handle(RawObject* raw_ptr) {
|
||||
NoGCScope no_gc;
|
||||
Object* obj = reinterpret_cast<Object*>(VMHandles::AllocateHandle());
|
||||
obj->SetRaw(raw_ptr);
|
||||
return *obj;
|
||||
|
@ -189,6 +200,7 @@ CLASS_LIST_NO_OBJECT(DEFINE_CLASS_TESTER);
|
|||
}
|
||||
|
||||
static Object& ZoneHandle(RawObject* raw_ptr) {
|
||||
NoGCScope no_gc;
|
||||
Object* obj = reinterpret_cast<Object*>(VMHandles::AllocateZoneHandle());
|
||||
obj->SetRaw(raw_ptr);
|
||||
return *obj;
|
||||
|
@ -2685,6 +2697,7 @@ RawClass* Object::clazz() const {
|
|||
|
||||
|
||||
void Object::SetRaw(RawObject* value) {
|
||||
NoGCScope no_gc;
|
||||
raw_ = value;
|
||||
uword raw_value = reinterpret_cast<uword>(value);
|
||||
if ((raw_value & kSmiTagMask) == kSmiTag) {
|
||||
|
|
Loading…
Reference in a new issue