| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -547,7 +547,8 @@ void ThrowCryptoError(Environment* env, | |||
| 547 | 547 | ||
| 548 | 548 | class CipherPushContext { | |
| 549 | 549 | public: | |
| 550 | - inline explicit CipherPushContext(Environment* env) : env_(env) {} | ||
| 550 | + inline explicit CipherPushContext(Environment* env) | ||
| 551 | + : list_(env->isolate()), env_(env) {} | ||
| 551 | 552 | ||
| 552 | 553 | inline void push_back(const char* str) { | |
| 553 | 554 | list_.emplace_back(OneByteString(env_->isolate(), str)); | |
@@ -558,7 +559,7 @@ class CipherPushContext { | |||
| 558 | 559 | } | |
| 559 | 560 | ||
| 560 | 561 | private: | |
| 561 | - std::vector<v8::Local<v8::Value>> list_; | ||
| 562 | + v8::LocalVector<v8::Value> list_; | ||
| 562 | 563 | Environment* env_; | |
| 563 | 564 | }; | |
| 564 | 565 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -176,11 +176,7 @@ bool AsyncHooks::pop_async_context(double async_id) { | |||
| 176 | 176 | } | |
| 177 | 177 | #endif | |
| 178 | 178 | native_execution_async_resources_.resize(offset); | |
| 179 | - if (native_execution_async_resources_.size() < | ||
| 180 | - native_execution_async_resources_.capacity() / 2 && | ||
| 181 | - native_execution_async_resources_.size() > 16) { | ||
| 182 | - native_execution_async_resources_.shrink_to_fit(); | ||
| 183 | - } | ||
| 179 | + native_execution_async_resources_.shrink_to_fit(); | ||
| 184 | 180 | } | |
| 185 | 181 | ||
| 186 | 182 | if (js_execution_async_resources()->Length() > offset) [[unlikely]] { | |
@@ -1694,6 +1690,7 @@ AsyncHooks::AsyncHooks(Isolate* isolate, const SerializeInfo* info) | |||
| 1694 | 1690 | fields_(isolate, kFieldsCount, MAYBE_FIELD_PTR(info, fields)), | |
| 1695 | 1691 | async_id_fields_( | |
| 1696 | 1692 | isolate, kUidFieldsCount, MAYBE_FIELD_PTR(info, async_id_fields)), | |
| 1693 | + native_execution_async_resources_(isolate), | ||
| 1697 | 1694 | info_(info) { | |
| 1698 | 1695 | HandleScope handle_scope(isolate); | |
| 1699 | 1696 | if (info == nullptr) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -401,7 +401,16 @@ class AsyncHooks : public MemoryRetainer { | |||
| 401 | 401 | void grow_async_ids_stack(); | |
| 402 | 402 | ||
| 403 | 403 | v8::Global<v8::Array> js_execution_async_resources_; | |
| 404 | - std::vector<v8::Local<v8::Object>> native_execution_async_resources_; | ||
| 404 | + | ||
| 405 | + // TODO(@jasnell): Note that this is technically illegal use of | ||
| 406 | + // v8::Locals which should be kept on the stack. Here, the entries | ||
| 407 | + // in this object grows and shrinks with the C stack, and entries | ||
| 408 | + // will be in the right handle scopes, but v8::Locals are supposed | ||
| 409 | + // to remain on the stack and not the heap. For general purposes | ||
| 410 | + // this *should* be ok but may need to be looked at further should | ||
| 411 | + // v8 become stricter in the future about v8::Locals being held in | ||
| 412 | + // the stack. | ||
| 413 | + v8::LocalVector<v8::Object> native_execution_async_resources_; | ||
| 405 | 414 | ||
| 406 | 415 | // Non-empty during deserialization | |
| 407 | 416 | const SerializeInfo* info_ = nullptr; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments