Lines Matching +full:- +full:- +full:bootstrap
2 #include "debug_utils-inl.h"
3 #include "env-inl.h"
6 #include "node_threadsafe_cow-inl.h"
8 #include "util-inl.h"
41 "internal/deps/cjs-module-lexer/lexer", in BuiltinLoader()
47 "internal/deps/cjs-module-lexer/dist/lexer", in BuiltinLoader()
59 return source->find(id) != source->end(); in Exists()
63 auto result = source_.write()->emplace(id, source); in Add()
68 Isolate* isolate = context->GetIsolate(); in GetSourceObject()
73 out->Set(context, key, x.second.ToStringChecked(isolate)).FromJust(); in GetSourceObject()
85 ids.reserve(source->size()); in GetBuiltinIds()
101 "internal/bootstrap/", in GetBuiltinCategories()
108 "internal/deps/cjs-module-lexer/lexer"); in GetBuiltinCategories()
121 "_tls_wrap", "internal/tls/secure-pair", in GetBuiltinCategories()
122 "internal/tls/parse-cert-string", "internal/tls/secure-context", in GetBuiltinCategories()
159 RwLock::ScopedReadLock lock(code_cache_->mutex); in GetCodeCache()
160 const auto it = code_cache_->map.find(id); in GetCodeCache()
161 if (it == code_cache_->map.end()) { in GetCodeCache()
165 return it->second.get(); in GetCodeCache()
191 const auto source_it = source->find(id); in LoadBuiltinSource()
192 if (UNLIKELY(source_it == source->end())) { in LoadBuiltinSource()
196 return source_it->second.ToStringChecked(isolate); in LoadBuiltinSource()
209 isolate->ThrowException(v8::Exception::Error(message)); in LoadBuiltinSource()
229 source = it->second; in AddExternalizedBuiltin()
253 reinterpret_cast<char16_t*>(out->data())); in Add()
254 out->resize(u16_length); in Add()
263 Isolate* isolate = context->GetIsolate(); in LookupAndCompileInternal()
280 // there is a syntax error during bootstrap (because the fatal exception in LookupAndCompileInternal()
281 // handler is invoked, which may load built-in modules). in LookupAndCompileInternal()
282 RwLock::ScopedLock lock(code_cache_->mutex); in LookupAndCompileInternal()
283 auto cache_it = code_cache_->map.find(id); in LookupAndCompileInternal()
284 if (cache_it != code_cache_->map.end()) { in LookupAndCompileInternal()
286 cached_data = cache_it->second.release(); in LookupAndCompileInternal()
287 code_cache_->map.erase(cache_it); in LookupAndCompileInternal()
305 parameters->size(), in LookupAndCompileInternal()
306 parameters->data(), in LookupAndCompileInternal()
311 // This could fail when there are early errors in the built-in modules, in LookupAndCompileInternal()
316 // decorating the stack for us - note that we use CompileFunction in LookupAndCompileInternal()
326 *result = (has_cache && !script_source.GetCachedData()->rejected) in LookupAndCompileInternal()
334 script_source.GetCachedData()->buffer_policy == in LookupAndCompileInternal()
338 script_source.GetCachedData()->rejected ? "is rejected" in LookupAndCompileInternal()
348 RwLock::ScopedLock lock(code_cache_->mutex); in LookupAndCompileInternal()
349 code_cache_->map[id] = std::move(new_cached_data); in LookupAndCompileInternal()
363 Isolate* isolate = context->GetIsolate(); in LookupAndCompile()
365 // internal/bootstrap/realm: process, getLinkedBinding, in LookupAndCompile()
367 if (strcmp(id, "internal/bootstrap/realm") == 0) { in LookupAndCompile()
384 "internal/bootstrap/", in LookupAndCompile()
385 strlen("internal/bootstrap/")) == 0) { in LookupAndCompile()
386 // internal/main/*, internal/bootstrap/*: process, require, in LookupAndCompile()
415 DCHECK_EQ(this, optional_realm->env()->builtin_loader()); in LookupAndCompile()
424 Isolate* isolate = context->GetIsolate(); in CompileAndCall()
429 // internal/bootstrap/realm: process, getLinkedBinding, in CompileAndCall()
431 if (strcmp(id, "internal/bootstrap/realm") == 0) { in CompileAndCall()
435 ->GetFunction(context) in CompileAndCall()
438 ->GetFunction(context) in CompileAndCall()
442 arguments = {realm->process_object(), in CompileAndCall()
445 realm->primordials()}; in CompileAndCall()
448 "internal/bootstrap/", in CompileAndCall()
449 strlen("internal/bootstrap/")) == 0) { in CompileAndCall()
450 // internal/main/*, internal/bootstrap/*: process, require, in CompileAndCall()
452 arguments = {realm->process_object(), in CompileAndCall()
453 realm->builtin_module_require(), in CompileAndCall()
454 realm->internal_binding_loader(), in CompileAndCall()
455 realm->primordials()}; in CompileAndCall()
459 realm->process_object(), in CompileAndCall()
460 realm->builtin_module_require(), in CompileAndCall()
468 // all the other cases: the arguments are generated in the JS-land loader. in CompileAndCall()
486 Local<Value> undefined = Undefined(context->GetIsolate()); in CompileAndCall()
487 return fn->Call(context, undefined, argc, argv); in CompileAndCall()
498 v8::TryCatch bootstrapCatch(context->GetIsolate()); in CompileAllBuiltins()
505 PrintCaughtException(context->GetIsolate(), context, bootstrapCatch); in CompileAllBuiltins()
512 RwLock::ScopedReadLock lock(code_cache_->mutex); in CopyCodeCache()
513 for (auto const& item : code_cache_->map) { in CopyCodeCache()
514 out->push_back( in CopyCodeCache()
516 {item.second->data, item.second->data + item.second->length}}); in CopyCodeCache()
521 RwLock::ScopedLock lock(code_cache_->mutex); in RefreshCodeCache()
528 code_cache_->map[item.id] = std::move(new_cache); in RefreshCodeCache()
530 code_cache_->has_code_cache = true; in RefreshCodeCache()
536 Isolate* isolate = env->isolate(); in GetBuiltinCategories()
537 Local<Context> context = env->context(); in GetBuiltinCategories()
541 env->builtin_loader()->GetBuiltinCategories(); in GetBuiltinCategories()
543 if (!env->owns_process_state()) { in GetBuiltinCategories()
555 ->Set(context, in GetBuiltinCategories()
564 ->Set(context, in GetBuiltinCategories()
575 Isolate* isolate = realm->isolate(); in GetCacheUsage()
576 Local<Context> context = realm->context(); in GetCacheUsage()
582 if (!ToV8Value(context, realm->builtins_with_cache) in GetCacheUsage()
587 ->Set(context, in GetCacheUsage()
594 if (!ToV8Value(context, realm->builtins_without_cache) in GetCacheUsage()
599 ->Set(context, in GetCacheUsage()
606 if (!ToV8Value(context, realm->builtins_in_snapshot) in GetCacheUsage()
611 ->Set(context, in GetCacheUsage()
624 Isolate* isolate = env->isolate(); in BuiltinIdsGetter()
626 std::vector<std::string> ids = env->builtin_loader()->GetBuiltinIds(); in BuiltinIdsGetter()
628 ToV8Value(isolate->GetCurrentContext(), ids).ToLocalChecked()); in BuiltinIdsGetter()
635 env->builtin_loader()->GetConfigString(info.GetIsolate())); in ConfigStringGetter()
642 realm->builtins_with_cache.insert(id); in RecordResult()
644 realm->builtins_without_cache.insert(id); in RecordResult()
650 CHECK(args[0]->IsString()); in CompileFunction()
651 node::Utf8Value id_v(realm->isolate(), args[0].As<String>()); in CompileFunction()
653 MaybeLocal<Function> maybe = realm->env()->builtin_loader()->LookupAndCompile( in CompileFunction()
654 realm->context(), id, realm); in CompileFunction()
662 auto instance = Environment::GetCurrent(args)->builtin_loader(); in HasCachedBuiltins()
663 RwLock::ScopedReadLock lock(instance->code_cache_->mutex); in HasCachedBuiltins()
665 args.GetIsolate(), instance->code_cache_->has_code_cache)); in HasCachedBuiltins()
670 CHECK(args[0]->IsFunction()); in SetInternalLoaders()
671 CHECK(args[1]->IsFunction()); in SetInternalLoaders()
672 DCHECK(realm->internal_binding_loader().IsEmpty()); in SetInternalLoaders()
673 DCHECK(realm->builtin_module_require().IsEmpty()); in SetInternalLoaders()
674 realm->set_internal_binding_loader(args[0].As<Function>()); in SetInternalLoaders()
675 realm->set_builtin_module_require(args[1].As<Function>()); in SetInternalLoaders()
680 code_cache_ = other->code_cache_; in CopySourceAndCodeCacheReferenceFrom()
681 source_ = other->source_; in CopySourceAndCodeCacheReferenceFrom()
686 Isolate* isolate = isolate_data->isolate(); in CreatePerIsolateProperties()
687 Local<ObjectTemplate> proto = target->PrototypeTemplate(); in CreatePerIsolateProperties()
689 proto->SetAccessor(isolate_data->config_string(), in CreatePerIsolateProperties()
697 proto->SetAccessor(FIXED_ONE_BYTE_STRING(isolate, "builtinIds"), in CreatePerIsolateProperties()
705 proto->SetAccessor(FIXED_ONE_BYTE_STRING(isolate, "builtinCategories"), in CreatePerIsolateProperties()
724 target->SetIntegrityLevel(context, IntegrityLevel::kFrozen).FromJust(); in CreatePerContextProperties()
729 registry->Register(ConfigStringGetter); in RegisterExternalReferences()
730 registry->Register(BuiltinIdsGetter); in RegisterExternalReferences()
731 registry->Register(GetBuiltinCategories); in RegisterExternalReferences()
732 registry->Register(GetCacheUsage); in RegisterExternalReferences()
733 registry->Register(CompileFunction); in RegisterExternalReferences()
734 registry->Register(HasCachedBuiltins); in RegisterExternalReferences()
735 registry->Register(SetInternalLoaders); in RegisterExternalReferences()