Lines Matching refs:env

1 #include "env.h"
70 js_promise_hooks_[0].Reset(env()->isolate(), init);
71 js_promise_hooks_[1].Reset(env()->isolate(), before);
72 js_promise_hooks_[2].Reset(env()->isolate(), after);
73 js_promise_hooks_[3].Reset(env()->isolate(), resolve);
160 HandleScope handle_scope(env()->isolate());
162 env()->context(),
163 env()->length_string(),
164 Integer::NewFromUnsigned(env()->isolate(), offset)));
171 if (!js_execution_async_resources_.IsEmpty() && env()->can_call_into_js()) {
172 Isolate* isolate = env()->isolate();
175 ->Set(env()->context(),
176 env()->length_string(),
227 Environment* env, double default_trigger_async_id)
228 : async_hooks_(env->async_hooks()) {
229 if (env->async_hooks()->fields()[AsyncHooks::kCheck] > 0) {
246 : DefaultTriggerAsyncIdScope(async_wrap->env(),
684 isolate_data->worker_context()->env()->builtin_loader());
894 Environment* env = ContainerOf(
896 HandleScope handle_scope(env->isolate());
897 Context::Scope context_scope(env->context());
898 env->RunAndClearNativeImmediates();
927 SetImmediateThreadsafe([](Environment* env) {
928 env->set_can_call_into_js(false);
929 uv_stop(env->event_loop());
934 HandleCleanupCb close_and_finish = [](Environment* env, uv_handle_t* handle,
936 handle->data = env;
938 env->CloseHandle(handle, [](uv_handle_t* handle) {
986 Environment* env = ContainerOf(&Environment::idle_prepare_handle_, handle);
987 env->isolate()->SetIdle(true);
990 Environment* env = ContainerOf(&Environment::idle_check_handle_, handle);
991 env->isolate()->SetIdle(false);
1160 Environment* env = *env_ptr;
1161 if (env == nullptr) {
1167 env->interrupt_data_.store(nullptr);
1168 env->RunAndClearInterrupts();
1188 Environment* env = Environment::from_timer_handle(handle);
1191 if (!env->can_call_into_js())
1194 HandleScope handle_scope(env->isolate());
1195 Context::Scope context_scope(env->context());
1197 Local<Object> process = env->process_object();
1198 InternalCallbackScope scope(env, process, {0, 0});
1200 Local<Function> cb = env->timers_callback_function();
1202 Local<Value> arg = env->GetNow();
1207 TryCatchScope try_catch(env);
1209 ret = cb->Call(env->context(), process, 1, &arg);
1210 } while (ret.IsEmpty() && env->can_call_into_js());
1228 ret.ToLocalChecked()->IntegerValue(env->context()).FromJust();
1234 llabs(expiry_ms) - (uv_now(env->event_loop()) - env->timer_base());
1236 env->ScheduleTimer(duration_ms > 0 ? duration_ms : 1);
1249 Environment* env = Environment::from_immediate_check_handle(handle);
1252 HandleScope scope(env->isolate());
1253 Context::Scope context_scope(env->context());
1255 env->RunAndClearNativeImmediates();
1257 if (env->immediate_info()->count() == 0 || !env->can_call_into_js())
1261 MakeCallback(env->isolate(),
1262 env->process_object(),
1263 env->immediate_callback_function(),
1267 } while (env->immediate_info()->has_outstanding() && env->can_call_into_js());
1269 if (env->immediate_info()->ref_count() == 0)
1270 env->ToggleImmediateRef(false);
1296 void CollectExceptionInfo(Environment* env,
1304 obj->Set(env->context(),
1305 env->errno_string(),
1306 Integer::New(env->isolate(), errorno)).Check();
1308 obj->Set(env->context(), env->code_string(),
1309 OneByteString(env->isolate(), err_string)).Check();
1312 obj->Set(env->context(), env->message_string(),
1313 OneByteString(env->isolate(), message)).Check();
1319 Buffer::Copy(env->isolate(), path, strlen(path)).ToLocalChecked();
1320 obj->Set(env->context(), env->path_string(), path_buffer).Check();
1326 Buffer::Copy(env->isolate(), dest, strlen(dest)).ToLocalChecked();
1327 obj->Set(env->context(), env->dest_string(), dest_buffer).Check();
1331 obj->Set(env->context(), env->syscall_string(),
1332 OneByteString(env->isolate(), syscall)).Check();
1520 env()->async_hooks_binding()->Set(
1521 env()->context(),
1522 env()->async_ids_stack_string(),
1534 if (!env()->abort_on_uncaught_exception())
1576 return worker_context()->env();
1694 Environment* env = static_cast<Environment*>(data);
1696 tracker.Track(env);
1702 Environment* env = static_cast<Environment*>(data);
1704 Debug(env,
1709 env->is_in_heapsnapshot_heap_limit_callback_,
1713 size_t max_young_gen_size = env->isolate_data()->max_young_gen_size;
1718 size_t num_heap_spaces = env->isolate()->NumberOfHeapSpaces();
1720 env->isolate()->GetHeapSpaceStatistics(&stats, i);
1729 Debug(env,
1744 Debug(env,
1762 if (env->is_in_heapsnapshot_heap_limit_callback_) {
1763 Debug(env,
1775 Debug(env,
1778 env->RemoveHeapSnapshotNearHeapLimitCallback(0);
1785 env->is_in_heapsnapshot_heap_limit_callback_ = true;
1787 std::string dir = env->options()->diagnostic_dir;
1789 dir = env->GetCwd();
1791 DiagnosticFilename name(env, "Heap", "heapsnapshot");
1794 Debug(env, DebugCategory::DIAGNOSTICS, "Start generating %s...\n", *name);
1796 heap::WriteSnapshot(env, filename.c_str());
1797 env->heap_limit_snapshot_taken_ += 1;
1799 Debug(env,
1802 env->heap_limit_snapshot_taken_,
1803 env->heap_snapshot_near_heap_limit_);
1806 if (env->heap_limit_snapshot_taken_ == env->heap_snapshot_near_heap_limit_) {
1807 Debug(env,
1810 env->RemoveHeapSnapshotNearHeapLimitCallback(0);
1816 env->isolate()->AutomaticallyRestoreInitialHeapLimit(0.95);
1818 env->is_in_heapsnapshot_heap_limit_callback_ = false;