@@ -78,19 +78,36 @@ class Symbols;
7878 using RawObjectType = Raw##object; \
7979 Raw##object* raw () const { return reinterpret_cast <Raw##object*>(raw_); } \
8080 bool Is##object() const { return true ; } \
81- static object& Handle (Zone* zone, Raw##object* raw_ptr) { \
82- object* obj = reinterpret_cast <object*>(VMHandles::AllocateHandle (zone)); \
83- initializeHandle (obj, raw_ptr); \
84- return *obj; \
81+ DART_NOINLINE static object& Handle () { \
82+ return HandleImpl (Thread::Current ()->zone (), object::null ()); \
83+ } \
84+ DART_NOINLINE static object& Handle (Zone* zone) { \
85+ return HandleImpl (zone, object::null ()); \
86+ } \
87+ DART_NOINLINE static object& Handle (Raw##object* raw_ptr) { \
88+ return HandleImpl (Thread::Current ()->zone (), raw_ptr); \
8589 } \
86- static object& Handle () { \
87- return Handle ( Thread::Current ()-> zone (), object::null ()); \
90+ DART_NOINLINE static object& Handle (Zone* zone, Raw##object* raw_ptr) { \
91+ return HandleImpl ( zone, raw_ptr); \
8892 } \
89- static object& Handle (Zone* zone) { return Handle (zone, object::null ()); } \
90- static object& Handle (Raw##object* raw_ptr) { \
91- return Handle (Thread::Current ()->zone (), raw_ptr); \
93+ DART_NOINLINE static object& ZoneHandle () { \
94+ return ZoneHandleImpl (Thread::Current ()->zone (), object::null ()); \
9295 } \
93- static object& CheckedHandle (Zone* zone, RawObject* raw_ptr) { \
96+ DART_NOINLINE static object& ZoneHandle (Zone* zone) { \
97+ return ZoneHandleImpl (zone, object::null ()); \
98+ } \
99+ DART_NOINLINE static object& ZoneHandle (Raw##object* raw_ptr) { \
100+ return ZoneHandleImpl (Thread::Current ()->zone (), raw_ptr); \
101+ } \
102+ DART_NOINLINE static object& ZoneHandle (Zone* zone, Raw##object* raw_ptr) { \
103+ return ZoneHandleImpl (zone, raw_ptr); \
104+ } \
105+ DART_NOINLINE static object* ReadOnlyHandle () { \
106+ object* obj = reinterpret_cast <object*>(Dart::AllocateReadOnlyHandle ()); \
107+ initializeHandle (obj, object::null ()); \
108+ return obj; \
109+ } \
110+ DART_NOINLINE static object& CheckedHandle (Zone* zone, RawObject* raw_ptr) { \
94111 object* obj = reinterpret_cast <object*>(VMHandles::AllocateHandle (zone)); \
95112 initializeHandle (obj, raw_ptr); \
96113 if (!obj->Is ##object ()) { \
@@ -99,27 +116,8 @@ class Symbols;
99116 } \
100117 return *obj; \
101118 } \
102- static object& ZoneHandle (Zone* zone, Raw##object* raw_ptr) { \
103- object* obj = \
104- reinterpret_cast <object*>(VMHandles::AllocateZoneHandle (zone)); \
105- initializeHandle (obj, raw_ptr); \
106- return *obj; \
107- } \
108- static object* ReadOnlyHandle () { \
109- object* obj = reinterpret_cast <object*>(Dart::AllocateReadOnlyHandle ()); \
110- initializeHandle (obj, object::null ()); \
111- return obj; \
112- } \
113- static object& ZoneHandle (Zone* zone) { \
114- return ZoneHandle (zone, object::null ()); \
115- } \
116- static object& ZoneHandle () { \
117- return ZoneHandle (Thread::Current ()->zone (), object::null ()); \
118- } \
119- static object& ZoneHandle (Raw##object* raw_ptr) { \
120- return ZoneHandle (Thread::Current ()->zone (), raw_ptr); \
121- } \
122- static object& CheckedZoneHandle (Zone* zone, RawObject* raw_ptr) { \
119+ DART_NOINLINE static object& CheckedZoneHandle (Zone* zone, \
120+ RawObject* raw_ptr) { \
123121 object* obj = \
124122 reinterpret_cast <object*>(VMHandles::AllocateZoneHandle (zone)); \
125123 initializeHandle (obj, raw_ptr); \
@@ -129,7 +127,7 @@ class Symbols;
129127 } \
130128 return *obj; \
131129 } \
132- static object& CheckedZoneHandle (RawObject* raw_ptr) { \
130+ DART_NOINLINE static object& CheckedZoneHandle (RawObject* raw_ptr) { \
133131 return CheckedZoneHandle (Thread::Current ()->zone (), raw_ptr); \
134132 } \
135133 /* T::Cast cannot be applied to a null Object, because the object vtable */ \
@@ -150,6 +148,17 @@ class Symbols;
150148 static const ClassId kClassId = k##object##Cid; \
151149 \
152150 private: /* NOLINT */ \
151+ static object& HandleImpl (Zone* zone, Raw##object* raw_ptr) { \
152+ object* obj = reinterpret_cast <object*>(VMHandles::AllocateHandle (zone)); \
153+ initializeHandle (obj, raw_ptr); \
154+ return *obj; \
155+ } \
156+ static object& ZoneHandleImpl (Zone* zone, Raw##object* raw_ptr) { \
157+ object* obj = \
158+ reinterpret_cast <object*>(VMHandles::AllocateZoneHandle (zone)); \
159+ initializeHandle (obj, raw_ptr); \
160+ return *obj; \
161+ } \
153162 /* Initialize the handle based on the raw_ptr in the presence of null. */ \
154163 static void initializeHandle (object* obj, RawObject* raw_ptr) { \
155164 if (raw_ptr != Object::null ()) { \
0 commit comments