diff options
Diffstat (limited to 'deps/v8/src/heap/setup-heap-internal.cc')
-rw-r--r-- | deps/v8/src/heap/setup-heap-internal.cc | 172 |
1 files changed, 154 insertions, 18 deletions
diff --git a/deps/v8/src/heap/setup-heap-internal.cc b/deps/v8/src/heap/setup-heap-internal.cc index 8c9d8cd4568..b62dd5c7fd1 100644 --- a/deps/v8/src/heap/setup-heap-internal.cc +++ b/deps/v8/src/heap/setup-heap-internal.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "src/init/setup-isolate.h" - #include "src/builtins/accessors.h" #include "src/codegen/compilation-cache.h" #include "src/execution/isolate.h" @@ -12,6 +10,7 @@ #include "src/heap/heap-inl.h" #include "src/ic/handler-configuration.h" #include "src/init/heap-symbols.h" +#include "src/init/setup-isolate.h" #include "src/interpreter/interpreter.h" #include "src/objects/arguments.h" #include "src/objects/cell-inl.h" @@ -46,11 +45,27 @@ #include "src/regexp/regexp.h" #include "src/wasm/wasm-objects.h" #include "torque-generated/class-definitions-tq.h" +#include "torque-generated/exported-class-definitions-tq-inl.h" #include "torque-generated/internal-class-definitions-tq-inl.h" namespace v8 { namespace internal { +namespace { + +Handle<SharedFunctionInfo> CreateSharedFunctionInfo( + Isolate* isolate, Builtins::Name builtin_id, int len, + FunctionKind kind = FunctionKind::kNormalFunction) { + Handle<SharedFunctionInfo> shared = + isolate->factory()->NewSharedFunctionInfoForBuiltin( + isolate->factory()->empty_string(), builtin_id, kind); + shared->set_internal_formal_parameter_count(len); + shared->set_length(len); + return shared; +} + +} // namespace + bool SetupIsolateDelegate::SetupHeapInternal(Heap* heap) { return heap->CreateHeapObjects(); } @@ -348,7 +363,7 @@ bool Heap::CreateInitialMaps() { } #define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \ - ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) + ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) #define ALLOCATE_PRIMITIVE_MAP(instance_type, size, field_name, \ constructor_function_index) \ @@ -403,17 +418,15 @@ bool Heap::CreateInitialMaps() { ALLOCATE_VARSIZE_MAP(SMALL_ORDERED_NAME_DICTIONARY_TYPE, small_ordered_name_dictionary) -#define TORQUE_INTERNAL_CLASS_LIST_MAP_ALLOCATOR(V, NAME, Name, name) \ +#define TORQUE_ALLOCATE_MAP(NAME, Name, name) \ ALLOCATE_MAP(NAME, Name::kSize, name) - TORQUE_INTERNAL_FIXED_CLASS_LIST_GENERATOR( - TORQUE_INTERNAL_CLASS_LIST_MAP_ALLOCATOR, _); -#undef TORQUE_INTERNAL_CLASS_LIST_MAP_ALLOCATOR + TORQUE_INTERNAL_FIXED_INSTANCE_TYPE_LIST(TORQUE_ALLOCATE_MAP); +#undef TORQUE_ALLOCATE_MAP -#define TORQUE_INTERNAL_CLASS_LIST_MAP_ALLOCATOR(V, NAME, Name, name) \ +#define TORQUE_ALLOCATE_VARSIZE_MAP(NAME, Name, name) \ ALLOCATE_VARSIZE_MAP(NAME, name) - TORQUE_INTERNAL_VARSIZE_CLASS_LIST_GENERATOR( - TORQUE_INTERNAL_CLASS_LIST_MAP_ALLOCATOR, _); -#undef TORQUE_INTERNAL_CLASS_LIST_MAP_ALLOCATOR + TORQUE_INTERNAL_VARSIZE_INSTANCE_TYPE_LIST(TORQUE_ALLOCATE_VARSIZE_MAP); +#undef TORQUE_ALLOCATE_VARSIZE_MAP ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements) @@ -436,14 +449,14 @@ bool Heap::CreateInitialMaps() { // The "no closures" and "one closure" FeedbackCell maps need // to be marked unstable because their objects can change maps. - ALLOCATE_MAP( - FEEDBACK_CELL_TYPE, FeedbackCell::kAlignedSize, no_closures_cell) + ALLOCATE_MAP(FEEDBACK_CELL_TYPE, FeedbackCell::kAlignedSize, + no_closures_cell) roots.no_closures_cell_map().mark_unstable(); - ALLOCATE_MAP( - FEEDBACK_CELL_TYPE, FeedbackCell::kAlignedSize, one_closure_cell) + ALLOCATE_MAP(FEEDBACK_CELL_TYPE, FeedbackCell::kAlignedSize, + one_closure_cell) roots.one_closure_cell_map().mark_unstable(); - ALLOCATE_MAP( - FEEDBACK_CELL_TYPE, FeedbackCell::kAlignedSize, many_closures_cell) + ALLOCATE_MAP(FEEDBACK_CELL_TYPE, FeedbackCell::kAlignedSize, + many_closures_cell) ALLOCATE_VARSIZE_MAP(TRANSITION_ARRAY_TYPE, transition_array) @@ -776,7 +789,6 @@ void Heap::CreateInitialObjects() { } set_detached_contexts(roots.empty_weak_array_list()); - set_retained_maps(roots.empty_weak_array_list()); set_retaining_path_targets(roots.empty_weak_array_list()); set_feedback_vectors_for_profiling_tools(roots.undefined_value()); @@ -918,6 +930,13 @@ void Heap::CreateInitialObjects() { Handle<PropertyCell> cell = factory->NewPropertyCell(factory->empty_string()); cell->set_value(Smi::FromInt(Protectors::kProtectorValid)); + set_regexp_species_protector(*cell); + } + + { + Handle<PropertyCell> cell = + factory->NewPropertyCell(factory->empty_string()); + cell->set_value(Smi::FromInt(Protectors::kProtectorValid)); set_string_iterator_protector(*cell); } @@ -984,6 +1003,123 @@ void Heap::CreateInitialObjects() { // Initialize compilation cache. isolate_->compilation_cache()->Clear(); + + // Create internal SharedFunctionInfos. + + // Async functions: + { + Handle<SharedFunctionInfo> info = CreateSharedFunctionInfo( + isolate(), Builtins::kAsyncFunctionAwaitRejectClosure, 1); + set_async_function_await_reject_shared_fun(*info); + + info = CreateSharedFunctionInfo( + isolate(), Builtins::kAsyncFunctionAwaitResolveClosure, 1); + set_async_function_await_resolve_shared_fun(*info); + } + + // Async generators: + { + Handle<SharedFunctionInfo> info = CreateSharedFunctionInfo( + isolate(), Builtins::kAsyncGeneratorAwaitResolveClosure, 1); + set_async_generator_await_resolve_shared_fun(*info); + + info = CreateSharedFunctionInfo( + isolate(), Builtins::kAsyncGeneratorAwaitRejectClosure, 1); + set_async_generator_await_reject_shared_fun(*info); + + info = CreateSharedFunctionInfo( + isolate(), Builtins::kAsyncGeneratorYieldResolveClosure, 1); + set_async_generator_yield_resolve_shared_fun(*info); + + info = CreateSharedFunctionInfo( + isolate(), Builtins::kAsyncGeneratorReturnResolveClosure, 1); + set_async_generator_return_resolve_shared_fun(*info); + + info = CreateSharedFunctionInfo( + isolate(), Builtins::kAsyncGeneratorReturnClosedResolveClosure, 1); + set_async_generator_return_closed_resolve_shared_fun(*info); + + info = CreateSharedFunctionInfo( + isolate(), Builtins::kAsyncGeneratorReturnClosedRejectClosure, 1); + set_async_generator_return_closed_reject_shared_fun(*info); + } + + // AsyncIterator: + { + Handle<SharedFunctionInfo> info = CreateSharedFunctionInfo( + isolate_, Builtins::kAsyncIteratorValueUnwrap, 1); + set_async_iterator_value_unwrap_shared_fun(*info); + } + + // Promises: + { + Handle<SharedFunctionInfo> info = CreateSharedFunctionInfo( + isolate_, Builtins::kPromiseCapabilityDefaultResolve, 1, + FunctionKind::kConciseMethod); + info->set_native(true); + info->set_function_map_index( + Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX); + set_promise_capability_default_resolve_shared_fun(*info); + + info = CreateSharedFunctionInfo(isolate_, + Builtins::kPromiseCapabilityDefaultReject, + 1, FunctionKind::kConciseMethod); + info->set_native(true); + info->set_function_map_index( + Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX); + set_promise_capability_default_reject_shared_fun(*info); + + info = CreateSharedFunctionInfo( + isolate_, Builtins::kPromiseGetCapabilitiesExecutor, 2); + set_promise_get_capabilities_executor_shared_fun(*info); + } + + // Promises / finally: + { + Handle<SharedFunctionInfo> info = + CreateSharedFunctionInfo(isolate(), Builtins::kPromiseThenFinally, 1); + info->set_native(true); + set_promise_then_finally_shared_fun(*info); + + info = + CreateSharedFunctionInfo(isolate(), Builtins::kPromiseCatchFinally, 1); + info->set_native(true); + set_promise_catch_finally_shared_fun(*info); + + info = CreateSharedFunctionInfo(isolate(), + Builtins::kPromiseValueThunkFinally, 0); + set_promise_value_thunk_finally_shared_fun(*info); + + info = CreateSharedFunctionInfo(isolate(), Builtins::kPromiseThrowerFinally, + 0); + set_promise_thrower_finally_shared_fun(*info); + } + + // Promise combinators: + { + Handle<SharedFunctionInfo> info = CreateSharedFunctionInfo( + isolate_, Builtins::kPromiseAllResolveElementClosure, 1); + set_promise_all_resolve_element_shared_fun(*info); + + info = CreateSharedFunctionInfo( + isolate_, Builtins::kPromiseAllSettledResolveElementClosure, 1); + set_promise_all_settled_resolve_element_shared_fun(*info); + + info = CreateSharedFunctionInfo( + isolate_, Builtins::kPromiseAllSettledRejectElementClosure, 1); + set_promise_all_settled_reject_element_shared_fun(*info); + + info = CreateSharedFunctionInfo( + isolate_, Builtins::kPromiseAnyRejectElementClosure, 1); + set_promise_any_reject_element_shared_fun(*info); + } + + // ProxyRevoke: + { + Handle<SharedFunctionInfo> info = + CreateSharedFunctionInfo(isolate_, Builtins::kProxyRevoke, 0); + set_proxy_revoke_shared_fun(*info); + } } void Heap::CreateInternalAccessorInfoObjects() { |