Skip to content

Commit cc8df6b

Browse files
committed
src: cache context lookup in vectored io loops
1 parent 8365edc commit cc8df6b

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

src/env-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ v8::Local<v8::Context> Environment::context() const {
897897
return principal_realm()->context();
898898
}
899899

900-
Realm* Environment::principal_realm() const {
900+
PrincipalRealm* Environment::principal_realm() const {
901901
return principal_realm_.get();
902902
}
903903

src/env.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ class Environment final : public MemoryRetainer {
886886
// Get the context with an explicit realm instead when possible.
887887
// Deprecate soon.
888888
inline v8::Local<v8::Context> context() const;
889-
inline Realm* principal_realm() const;
889+
inline PrincipalRealm* principal_realm() const;
890890

891891
#if HAVE_INSPECTOR
892892
inline inspector::Agent* inspector_agent() const {

src/node_realm-inl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "node_context_data.h"
77
#include "node_realm.h"
8+
#include "util-inl.h"
89

910
namespace node {
1011

@@ -46,6 +47,10 @@ inline v8::Isolate* Realm::isolate() const {
4647
return isolate_;
4748
}
4849

50+
inline v8::Local<v8::Context> Realm::context() const {
51+
return PersistentToLocal::Strong(context_);
52+
}
53+
4954
inline Realm::Kind Realm::kind() const {
5055
return kind_;
5156
}

src/node_realm.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,6 @@ void Realm::VerifyNoStrongBaseObjects() {
295295
});
296296
}
297297

298-
v8::Local<v8::Context> Realm::context() const {
299-
return PersistentToLocal::Strong(context_);
300-
}
301-
302298
// Per-realm strong value accessors. The per-realm values should avoid being
303299
// accessed across realms.
304300
#define V(PropertyName, TypeName) \

src/node_realm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class Realm : public MemoryRetainer {
121121
inline Environment* env() const;
122122
inline v8::Isolate* isolate() const;
123123
inline Kind kind() const;
124-
virtual v8::Local<v8::Context> context() const;
124+
inline virtual v8::Local<v8::Context> context() const;
125125
inline bool has_run_bootstrapping_code() const;
126126

127127
// Methods created using SetMethod(), SetPrototypeMethod(), etc. inside

0 commit comments

Comments
 (0)