|
1 | | -diff --git forkSrcPrefix/deps/v8/src/api/api.cc forkDstPrefix/deps/v8/src/api/api.cc |
2 | | -index 2dd476dda34f1cfe3a75b7895009af24963372f2..6476204733a8aa87c4681dbeb5fee12db54e529d 100644 |
3 | | ---- forkSrcPrefix/deps/v8/src/api/api.cc |
4 | | -+++ forkDstPrefix/deps/v8/src/api/api.cc |
5 | | -@@ -883,7 +883,21 @@ void InternalFieldOutOfBounds(int index) { |
| 1 | +diff --git forkSrcPrefix/src/node.h forkDstPrefix/src/node.h |
| 2 | +index 60598f54114b2424f10706e57d8aa50c4634bcb0..9213adb06dd45f521867591ff9a4af70096802de 100644 |
| 3 | +--- forkSrcPrefix/src/node.h |
| 4 | ++++ forkDstPrefix/src/node.h |
| 5 | +@@ -228,6 +228,67 @@ namespace node { |
6 | 6 |
|
7 | | - // --- H a n d l e s --- |
8 | | - |
9 | | --HandleScope::HandleScope(Isolate* v8_isolate) { Initialize(v8_isolate); } |
10 | | -+static std::function<void(Isolate*)> g_enterScopeCB; |
11 | | -+static std::function<void(Isolate*)> g_leaveScopeCB; |
12 | | -+ |
13 | | -+V8_EXPORT void SetScopeHandler(const std::function<void(Isolate*)>& enter, |
14 | | -+ const std::function<void(Isolate*)>& exit) { |
15 | | -+ g_enterScopeCB = enter; |
16 | | -+ g_leaveScopeCB = exit; |
17 | | -+} |
| 7 | + class IsolateData; |
| 8 | + class Environment; |
18 | 9 | + |
19 | | -+HandleScope::HandleScope(Isolate* v8_isolate) { |
20 | | -+ if(g_enterScopeCB) { |
21 | | -+ g_enterScopeCB(v8_isolate); |
| 10 | ++class ScopeCB |
| 11 | ++{ |
| 12 | ++ v8::Isolate* m_isolate; |
| 13 | ++public: |
| 14 | ++ inline ScopeCB(v8::Isolate* isolate) : m_isolate(isolate) { |
| 15 | ++ if(g_enterScopeCB) { |
| 16 | ++ g_enterScopeCB(isolate); |
| 17 | ++ } |
22 | 18 | + } |
23 | | -+ Initialize(v8_isolate); |
24 | | -+} |
| 19 | ++ |
| 20 | ++ inline ~ScopeCB() { |
| 21 | ++ if(g_leaveScopeCB) { |
| 22 | ++ g_leaveScopeCB(m_isolate); |
| 23 | ++ } |
| 24 | ++ } |
| 25 | ++ |
| 26 | ++ inline static std::function<void(v8::Isolate*)> g_enterScopeCB; |
| 27 | ++ inline static std::function<void(v8::Isolate*)> g_leaveScopeCB; |
| 28 | ++}; |
| 29 | ++ |
| 30 | ++NODE_EXTERN void SetScopeHandler(const std::function<void(v8::Isolate*)>& enter, |
| 31 | ++ const std::function<void(v8::Isolate*)>& exit); |
| 32 | ++ |
| 33 | ++class NodeHandleScope |
| 34 | ++{ |
| 35 | ++ ScopeCB m_scopeCB; |
| 36 | ++ v8::HandleScope m_handleScope; |
| 37 | ++public: |
| 38 | ++ inline NodeHandleScope(v8::Isolate* isolate) : m_scopeCB(isolate), m_handleScope(isolate) {} |
| 39 | ++ inline ~NodeHandleScope() = default; |
| 40 | ++}; |
| 41 | ++ |
| 42 | ++class NodeEscapableHandleScope |
| 43 | ++{ |
| 44 | ++ ScopeCB m_scopeCB; |
| 45 | ++ v8::EscapableHandleScope m_handleScope; |
| 46 | ++public: |
| 47 | ++ inline NodeEscapableHandleScope(v8::Isolate* isolate) : m_scopeCB(isolate), m_handleScope(isolate) {} |
| 48 | ++ inline ~NodeEscapableHandleScope() = default; |
| 49 | ++ |
| 50 | ++ template <class T> |
| 51 | ++ inline v8::Local<T> Escape(v8::Local<T> value) { |
| 52 | ++ return m_handleScope.Escape(value); |
| 53 | ++ } |
| 54 | ++ |
| 55 | ++ template <class T> |
| 56 | ++ inline v8::MaybeLocal<T> EscapeMaybe(v8::MaybeLocal<T> value) { |
| 57 | ++ return m_handleScope.EscapeMaybe(value); |
| 58 | ++ } |
| 59 | ++}; |
| 60 | ++ |
| 61 | ++class NodeSealHandleScope |
| 62 | ++{ |
| 63 | ++ ScopeCB m_scopeCB; |
| 64 | ++ v8::SealHandleScope m_handleScope; |
| 65 | ++public: |
| 66 | ++ inline NodeSealHandleScope(v8::Isolate* isolate) : m_scopeCB(isolate), m_handleScope(isolate) {} |
| 67 | ++ inline ~NodeSealHandleScope() = default; |
| 68 | ++}; |
| 69 | ++ |
| 70 | + class MultiIsolatePlatform; |
| 71 | + class InitializationResultImpl; |
| 72 | + |
| 73 | +diff --git forkSrcPrefix/src/node.cc forkDstPrefix/src/node.cc |
| 74 | +index 1a2a43bdd37441400323a800c147fcb89f0d549a..81f15f01e2a59f3752254a768f6a58d4286a23fc 100644 |
| 75 | +--- forkSrcPrefix/src/node.cc |
| 76 | ++++ forkDstPrefix/src/node.cc |
| 77 | +@@ -290,7 +290,7 @@ void Environment::InitializeDiagnostics() { |
| 78 | + |
| 79 | + static |
| 80 | + MaybeLocal<Value> StartExecution(Environment* env, const char* main_script_id) { |
| 81 | +- EscapableHandleScope scope(env->isolate()); |
| 82 | ++ NodeEscapableHandleScope scope(env->isolate()); |
| 83 | + CHECK_NOT_NULL(main_script_id); |
| 84 | + Realm* realm = env->principal_realm(); |
25 | 85 |
|
26 | | - void HandleScope::Initialize(Isolate* v8_isolate) { |
27 | | - i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
28 | | -@@ -908,6 +922,9 @@ void HandleScope::Initialize(Isolate* v8_isolate) { |
| 86 | +@@ -338,7 +338,7 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) { |
| 87 | + // Only snapshot builder or embedder applications set the |
| 88 | + // callback. |
| 89 | + if (cb != nullptr) { |
| 90 | +- EscapableHandleScope scope(env->isolate()); |
| 91 | ++ NodeEscapableHandleScope scope(env->isolate()); |
| 92 | + |
| 93 | + Local<Value> result; |
| 94 | + if (env->isolate_data()->is_building_snapshot()) { |
| 95 | +@@ -1548,6 +1548,12 @@ int Stop(Environment* env, StopFlags::Flags flags) { |
| 96 | + return 0; |
29 | 97 | } |
30 | 98 |
|
31 | | - HandleScope::~HandleScope() { |
32 | | -+ if(g_leaveScopeCB) { |
33 | | -+ g_leaveScopeCB(reinterpret_cast<Isolate*>(i_isolate_)); |
34 | | -+ } |
35 | | - #ifdef V8_ENABLE_CHECKS |
36 | | - CHECK_EQ(scope_level_, i_isolate_->handle_scope_data()->level); |
37 | | - #endif |
38 | | -@@ -938,6 +955,9 @@ i::Address* HandleScope::CreateHandleForCurrentIsolate(i::Address value) { |
39 | | - #endif // V8_ENABLE_DIRECT_LOCAL |
| 99 | ++void SetScopeHandler(const std::function<void(v8::Isolate*)>& enter, |
| 100 | ++ const std::function<void(v8::Isolate*)>& exit) { |
| 101 | ++ ScopeCB::g_enterScopeCB = enter; |
| 102 | ++ ScopeCB::g_leaveScopeCB = exit; |
| 103 | ++} |
| 104 | ++ |
| 105 | + } // namespace node |
40 | 106 |
|
41 | | - EscapableHandleScopeBase::EscapableHandleScopeBase(Isolate* v8_isolate) { |
42 | | -+ if(g_enterScopeCB) { |
43 | | -+ g_enterScopeCB(v8_isolate); |
44 | | -+ } |
45 | | - i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
46 | | - escape_slot_ = CreateHandle( |
47 | | - i_isolate, i::ReadOnlyRoots(i_isolate).the_hole_value().ptr()); |
| 107 | + #if !HAVE_INSPECTOR |
0 commit comments