Skip to content

Commit c54d44f

Browse files
committed
HandleScope callback improvements
1 parent 014598b commit c54d44f

File tree

2 files changed

+10
-62
lines changed

2 files changed

+10
-62
lines changed

HandleScope.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

patches/handle_scope.patch

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ diff --git forkSrcPrefix/deps/v8/src/api/api.cc forkDstPrefix/deps/v8/src/api/ap
22
index f9ce798dc29e1d48c6cb4de84cbcea9ddae0106b..ef607b02a7feaeca918abedbef86d16497ca8809 100644
33
--- forkSrcPrefix/deps/v8/src/api/api.cc
44
+++ forkDstPrefix/deps/v8/src/api/api.cc
5-
@@ -883,7 +883,21 @@ void InternalFieldOutOfBounds(int index) {
5+
@@ -883,7 +883,24 @@ void InternalFieldOutOfBounds(int index) {
66

77
// --- H a n d l e s ---
88

@@ -18,30 +18,33 @@ index f9ce798dc29e1d48c6cb4de84cbcea9ddae0106b..ef607b02a7feaeca918abedbef86d164
1818
+
1919
+HandleScope::HandleScope(Isolate* v8_isolate) {
2020
+ if(g_enterScopeCB) {
21-
+ g_enterScopeCB(v8_isolate);
21+
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
22+
+ if(i_isolate->handle_scope_data()->level == 0) {
23+
+ g_enterScopeCB(v8_isolate);
24+
+ }
2225
+ }
2326
+ Initialize(v8_isolate);
2427
+}
2528

2629
void HandleScope::Initialize(Isolate* v8_isolate) {
2730
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
28-
@@ -912,6 +926,9 @@ HandleScope::~HandleScope() {
31+
@@ -912,6 +929,9 @@ HandleScope::~HandleScope() {
2932
CHECK_EQ(scope_level_, i_isolate_->handle_scope_data()->level);
3033
#endif
3134
i::HandleScope::CloseScope(i_isolate_, prev_next_, prev_limit_);
32-
+ if(g_leaveScopeCB) {
35+
+ if(g_leaveScopeCB && i_isolate_->handle_scope_data()->level == 0) {
3336
+ g_leaveScopeCB(reinterpret_cast<Isolate*>(i_isolate_));
3437
+ }
3538
}
3639

3740
void* HandleScope::operator new(size_t) { base::OS::Abort(); }
38-
@@ -938,6 +955,9 @@ i::Address* HandleScope::CreateHandleForCurrentIsolate(i::Address value) {
41+
@@ -938,6 +958,9 @@ i::Address* HandleScope::CreateHandleForCurrentIsolate(i::Address value) {
3942
#endif // V8_ENABLE_DIRECT_LOCAL
4043

4144
EscapableHandleScopeBase::EscapableHandleScopeBase(Isolate* v8_isolate) {
42-
+ if(g_enterScopeCB) {
45+
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
46+
+ if(g_enterScopeCB && i_isolate->handle_scope_data()->level == 0) {
4347
+ g_enterScopeCB(v8_isolate);
4448
+ }
45-
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
4649
escape_slot_ = CreateHandle(
4750
i_isolate, i::ReadOnlyRoots(i_isolate).the_hole_value().ptr());

0 commit comments

Comments
 (0)