Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2bcf535

Browse filesBrowse files
addaleaxMylesBorins
authored andcommitted
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 2fe351f commit 2bcf535
Copy full SHA for 2bcf535

File tree

Expand file treeCollapse file tree

3 files changed

+6
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+6
-7
lines changed
Open diff view settings
Collapse file

‎src/env-inl.h‎

Copy file name to clipboardExpand all lines: src/env-inl.h
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,9 +1243,8 @@ int64_t Environment::base_object_count() const {
12431243
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
12441244
#define V(TypeName, PropertyName) \
12451245
inline \
1246-
v8::Local<TypeName> IsolateData::PropertyName(v8::Isolate* isolate) const { \
1247-
/* Strings are immutable so casting away const-ness here is okay. */ \
1248-
return const_cast<IsolateData*>(this)->PropertyName ## _.Get(isolate); \
1246+
v8::Local<TypeName> IsolateData::PropertyName() const { \
1247+
return PropertyName ## _ .Get(isolate_); \
12491248
}
12501249
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
12511250
PER_ISOLATE_SYMBOL_PROPERTIES(VY)
@@ -1260,7 +1259,7 @@ int64_t Environment::base_object_count() const {
12601259
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
12611260
#define V(TypeName, PropertyName) \
12621261
inline v8::Local<TypeName> Environment::PropertyName() const { \
1263-
return isolate_data()->PropertyName(isolate()); \
1262+
return isolate_data()->PropertyName(); \
12641263
}
12651264
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
12661265
PER_ISOLATE_SYMBOL_PROPERTIES(VY)
Collapse file

‎src/env.cc‎

Copy file name to clipboardExpand all lines: src/env.cc
+2-2Lines changed: 2 additions & 2 deletions
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

Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ class IsolateData : public MemoryRetainer {
500500
#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
501501
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
502502
#define V(TypeName, PropertyName) \
503-
inline v8::Local<TypeName> PropertyName(v8::Isolate* isolate) const;
503+
inline v8::Local<TypeName> PropertyName() const;
504504
PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
505505
PER_ISOLATE_SYMBOL_PROPERTIES(VY)
506506
PER_ISOLATE_STRING_PROPERTIES(VS)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.