Skip to content

Commit 46e68bb

Browse files
addaleaxtargos
authored andcommittedApr 22, 2020
src: simplify IsolateData shortcut accesses
PR-URL: #32407 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
1 parent 7aa2ee2 commit 46e68bb

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed
 

‎src/env-inl.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -1227,9 +1227,8 @@ int64_t Environment::base_object_count() const {
12271227
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
12281228
#define V(TypeName, PropertyName) \
12291229
inline \
1230-
v8::Local<TypeName> IsolateData::PropertyName(v8::Isolate* isolate) const { \
1231-
/* Strings are immutable so casting away const-ness here is okay. */ \
1232-
return const_cast<IsolateData*>(this)->PropertyName ## _.Get(isolate); \
1230+
v8::Local<TypeName> IsolateData::PropertyName() const { \
1231+
return PropertyName ## _ .Get(isolate_); \
12331232
}
12341233
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
12351234
PER_ISOLATE_SYMBOL_PROPERTIES(VY)
@@ -1244,7 +1243,7 @@ int64_t Environment::base_object_count() const {
12441243
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
12451244
#define V(TypeName, PropertyName) \
12461245
inline v8::Local<TypeName> Environment::PropertyName() const { \
1247-
return isolate_data()->PropertyName(isolate()); \
1246+
return isolate_data()->PropertyName(); \
12481247
}
12491248
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
12501249
PER_ISOLATE_SYMBOL_PROPERTIES(VY)

‎src/env.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ IsolateData::IsolateData(Isolate* isolate,
181181

182182
void IsolateData::MemoryInfo(MemoryTracker* tracker) const {
183183
#define V(PropertyName, StringValue) \
184-
tracker->TrackField(#PropertyName, PropertyName(isolate()));
184+
tracker->TrackField(#PropertyName, PropertyName());
185185
PER_ISOLATE_SYMBOL_PROPERTIES(V)
186186
#undef V
187187

188188
#define V(PropertyName, StringValue) \
189-
tracker->TrackField(#PropertyName, PropertyName(isolate()));
189+
tracker->TrackField(#PropertyName, PropertyName());
190190
PER_ISOLATE_STRING_PROPERTIES(V)
191191
#undef V
192192

‎src/env.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ class IsolateData : public MemoryRetainer {
502502
#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
503503
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
504504
#define V(TypeName, PropertyName) \
505-
inline v8::Local<TypeName> PropertyName(v8::Isolate* isolate) const;
505+
inline v8::Local<TypeName> PropertyName() const;
506506
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
507507
PER_ISOLATE_SYMBOL_PROPERTIES(VY)
508508
PER_ISOLATE_STRING_PROPERTIES(VS)

0 commit comments

Comments
 (0)
Please sign in to comment.