diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-11-08 15:39:11 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-11-08 15:46:25 +0100 |
commit | 6ca81ad72a3c6fdf16c683335be748f22aaa9a0d (patch) | |
tree | 33c8ee75f729aed76c2c0b89c63f9bf1b4dd66aa /deps/v8/src/init | |
parent | 1eee0b8bf8bba39b600fb16a9223e545e3bac2bc (diff) | |
download | android-node-v8-6ca81ad72a3c6fdf16c683335be748f22aaa9a0d.tar.gz android-node-v8-6ca81ad72a3c6fdf16c683335be748f22aaa9a0d.tar.bz2 android-node-v8-6ca81ad72a3c6fdf16c683335be748f22aaa9a0d.zip |
deps: update V8 to 7.9.317.20
PR-URL: https://github.com/nodejs/node/pull/30020
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'deps/v8/src/init')
-rw-r--r-- | deps/v8/src/init/bootstrapper.cc | 317 | ||||
-rw-r--r-- | deps/v8/src/init/heap-symbols.h | 67 | ||||
-rw-r--r-- | deps/v8/src/init/icu_util.cc | 15 | ||||
-rw-r--r-- | deps/v8/src/init/isolate-allocator.cc | 77 | ||||
-rw-r--r-- | deps/v8/src/init/isolate-allocator.h | 4 | ||||
-rw-r--r-- | deps/v8/src/init/setup-isolate-deserialize.cc | 1 | ||||
-rw-r--r-- | deps/v8/src/init/startup-data-util.cc | 25 | ||||
-rw-r--r-- | deps/v8/src/init/startup-data-util.h | 1 | ||||
-rw-r--r-- | deps/v8/src/init/v8.cc | 6 |
9 files changed, 318 insertions, 195 deletions
diff --git a/deps/v8/src/init/bootstrapper.cc b/deps/v8/src/init/bootstrapper.cc index f7e25ca0bb..148c60d89d 100644 --- a/deps/v8/src/init/bootstrapper.cc +++ b/deps/v8/src/init/bootstrapper.cc @@ -12,6 +12,7 @@ #include "src/debug/debug.h" #include "src/execution/isolate-inl.h" #include "src/execution/microtask-queue.h" +#include "src/execution/protectors.h" #include "src/extensions/cputracemark-extension.h" #include "src/extensions/externalize-string-extension.h" #include "src/extensions/free-buffer-extension.h" @@ -130,15 +131,15 @@ static bool isValidCpuTraceMarkFunctionName() { } void Bootstrapper::InitializeOncePerProcess() { - v8::RegisterExtension(v8::base::make_unique<FreeBufferExtension>()); - v8::RegisterExtension(v8::base::make_unique<GCExtension>(GCFunctionName())); - v8::RegisterExtension(v8::base::make_unique<ExternalizeStringExtension>()); - v8::RegisterExtension(v8::base::make_unique<StatisticsExtension>()); - v8::RegisterExtension(v8::base::make_unique<TriggerFailureExtension>()); - v8::RegisterExtension(v8::base::make_unique<IgnitionStatisticsExtension>()); + v8::RegisterExtension(std::make_unique<FreeBufferExtension>()); + v8::RegisterExtension(std::make_unique<GCExtension>(GCFunctionName())); + v8::RegisterExtension(std::make_unique<ExternalizeStringExtension>()); + v8::RegisterExtension(std::make_unique<StatisticsExtension>()); + v8::RegisterExtension(std::make_unique<TriggerFailureExtension>()); + v8::RegisterExtension(std::make_unique<IgnitionStatisticsExtension>()); if (isValidCpuTraceMarkFunctionName()) { - v8::RegisterExtension(v8::base::make_unique<CpuTraceMarkExtension>( - FLAG_expose_cputracemark_as)); + v8::RegisterExtension( + std::make_unique<CpuTraceMarkExtension>(FLAG_expose_cputracemark_as)); } } @@ -284,6 +285,9 @@ class Genesis { void TransferNamedProperties(Handle<JSObject> from, Handle<JSObject> to); void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to); + Handle<Map> CreateInitialMapForArraySubclass(int size, + int inobject_properties); + static bool CompileExtension(Isolate* isolate, v8::Extension* extension); Isolate* isolate_; @@ -867,6 +871,29 @@ void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) { generator_next_internal->shared().set_native(false); native_context()->set_generator_next_internal(*generator_next_internal); + // Internal version of async module functions, flagged as non-native such + // that they don't show up in Error traces. + { + Handle<JSFunction> async_module_evaluate_internal = + SimpleCreateFunction(isolate(), factory()->next_string(), + Builtins::kAsyncModuleEvaluate, 1, false); + async_module_evaluate_internal->shared().set_native(false); + native_context()->set_async_module_evaluate_internal( + *async_module_evaluate_internal); + + Handle<JSFunction> call_async_module_fulfilled = + SimpleCreateFunction(isolate(), factory()->empty_string(), + Builtins::kCallAsyncModuleFulfilled, 1, false); + native_context()->set_call_async_module_fulfilled( + *call_async_module_fulfilled); + + Handle<JSFunction> call_async_module_rejected = + SimpleCreateFunction(isolate(), factory()->empty_string(), + Builtins::kCallAsyncModuleRejected, 1, false); + native_context()->set_call_async_module_rejected( + *call_async_module_rejected); + } + // Create maps for generator functions and their prototypes. Store those // maps in the native context. The "prototype" property descriptor is // writable, non-enumerable, and non-configurable (as per ES6 draft @@ -1098,9 +1125,9 @@ void ReplaceAccessors(Isolate* isolate, Handle<Map> map, Handle<String> name, PropertyAttributes attributes, Handle<AccessorPair> accessor_pair) { DescriptorArray descriptors = map->instance_descriptors(); - int idx = descriptors.SearchWithCache(isolate, *name, *map); + InternalIndex entry = descriptors.SearchWithCache(isolate, *name, *map); Descriptor d = Descriptor::AccessorConstant(name, accessor_pair, attributes); - descriptors.Replace(idx, &d); + descriptors.Replace(entry, &d); } } // namespace @@ -1274,8 +1301,8 @@ Handle<JSGlobalObject> Genesis::CreateNewGlobals( DCHECK(native_context() ->get(Context::GLOBAL_PROXY_INDEX) .IsUndefined(isolate()) || - native_context()->global_proxy() == *global_proxy); - native_context()->set_global_proxy(*global_proxy); + native_context()->global_proxy_object() == *global_proxy); + native_context()->set_global_proxy_object(*global_proxy); return global_object; } @@ -2432,7 +2459,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, { // -- R e g E x p // Builtin functions for RegExp.prototype. Handle<JSFunction> regexp_fun = InstallFunction( - isolate_, global, "RegExp", JS_REGEXP_TYPE, + isolate_, global, "RegExp", JS_REG_EXP_TYPE, JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kTaggedSize, JSRegExp::kInObjectFieldCount, factory->the_hole_value(), Builtins::kRegExpConstructor); @@ -2455,7 +2482,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, Builtins::kRegExpPrototypeExec, 1, true); native_context()->set_regexp_exec_function(*fun); DCHECK_EQ(JSRegExp::kExecFunctionDescriptorIndex, - prototype->map().LastAdded()); + prototype->map().LastAdded().as_int()); } SimpleInstallGetter(isolate_, prototype, factory->dotAll_string(), @@ -2488,7 +2515,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, Builtins::kRegExpPrototypeMatch, 1, true); native_context()->set_regexp_match_function(*fun); DCHECK_EQ(JSRegExp::kSymbolMatchFunctionDescriptorIndex, - prototype->map().LastAdded()); + prototype->map().LastAdded().as_int()); } { @@ -2497,7 +2524,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, "[Symbol.matchAll]", Builtins::kRegExpPrototypeMatchAll, 1, true); native_context()->set_regexp_match_all_function(*fun); DCHECK_EQ(JSRegExp::kSymbolMatchAllFunctionDescriptorIndex, - prototype->map().LastAdded()); + prototype->map().LastAdded().as_int()); } { @@ -2506,7 +2533,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, Builtins::kRegExpPrototypeReplace, 2, false); native_context()->set_regexp_replace_function(*fun); DCHECK_EQ(JSRegExp::kSymbolReplaceFunctionDescriptorIndex, - prototype->map().LastAdded()); + prototype->map().LastAdded().as_int()); } { @@ -2515,7 +2542,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, Builtins::kRegExpPrototypeSearch, 1, true); native_context()->set_regexp_search_function(*fun); DCHECK_EQ(JSRegExp::kSymbolSearchFunctionDescriptorIndex, - prototype->map().LastAdded()); + prototype->map().LastAdded().as_int()); } { @@ -2524,7 +2551,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, Builtins::kRegExpPrototypeSplit, 2, false); native_context()->set_regexp_split_function(*fun); DCHECK_EQ(JSRegExp::kSymbolSplitFunctionDescriptorIndex, - prototype->map().LastAdded()); + prototype->map().LastAdded().as_int()); } Handle<Map> prototype_map(prototype->map(), isolate()); @@ -2616,7 +2643,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, { Handle<PropertyCell> cell = factory->NewPropertyCell(factory->empty_string()); - cell->set_value(Smi::FromInt(Isolate::kProtectorValid)); + cell->set_value(Smi::FromInt(Protectors::kProtectorValid)); native_context()->set_regexp_species_protector(*cell); } @@ -2647,7 +2674,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, true); Handle<JSFunction> regexp_string_iterator_function = CreateFunction( - isolate(), "RegExpStringIterator", JS_REGEXP_STRING_ITERATOR_TYPE, + isolate(), "RegExpStringIterator", JS_REG_EXP_STRING_ITERATOR_TYPE, JSRegExpStringIterator::kSize, 0, regexp_string_iterator_prototype, Builtins::kIllegal); regexp_string_iterator_function->shared().set_native(false); @@ -2886,7 +2913,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, { // -- D a t e T i m e F o r m a t Handle<JSFunction> date_time_format_constructor = InstallFunction( - isolate_, intl, "DateTimeFormat", JS_INTL_DATE_TIME_FORMAT_TYPE, + isolate_, intl, "DateTimeFormat", JS_DATE_TIME_FORMAT_TYPE, JSDateTimeFormat::kSize, 0, factory->the_hole_value(), Builtins::kDateTimeFormatConstructor); date_time_format_constructor->shared().set_length(0); @@ -2914,13 +2941,20 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, SimpleInstallGetter(isolate_, prototype, factory->format_string(), Builtins::kDateTimeFormatPrototypeFormat, false); + + SimpleInstallFunction(isolate_, prototype, "formatRange", + Builtins::kDateTimeFormatPrototypeFormatRange, 2, + false); + SimpleInstallFunction( + isolate_, prototype, "formatRangeToParts", + Builtins::kDateTimeFormatPrototypeFormatRangeToParts, 2, false); } { // -- N u m b e r F o r m a t - Handle<JSFunction> number_format_constructor = InstallFunction( - isolate_, intl, "NumberFormat", JS_INTL_NUMBER_FORMAT_TYPE, - JSNumberFormat::kSize, 0, factory->the_hole_value(), - Builtins::kNumberFormatConstructor); + Handle<JSFunction> number_format_constructor = + InstallFunction(isolate_, intl, "NumberFormat", JS_NUMBER_FORMAT_TYPE, + JSNumberFormat::kSize, 0, factory->the_hole_value(), + Builtins::kNumberFormatConstructor); number_format_constructor->shared().set_length(0); number_format_constructor->shared().DontAdaptArguments(); InstallWithIntrinsicDefaultProto( @@ -2949,8 +2983,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, { // -- C o l l a t o r Handle<JSFunction> collator_constructor = InstallFunction( - isolate_, intl, "Collator", JS_INTL_COLLATOR_TYPE, JSCollator::kSize, - 0, factory->the_hole_value(), Builtins::kCollatorConstructor); + isolate_, intl, "Collator", JS_COLLATOR_TYPE, JSCollator::kSize, 0, + factory->the_hole_value(), Builtins::kCollatorConstructor); collator_constructor->shared().DontAdaptArguments(); InstallWithIntrinsicDefaultProto(isolate_, collator_constructor, Context::INTL_COLLATOR_FUNCTION_INDEX); @@ -2974,7 +3008,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, { // -- V 8 B r e a k I t e r a t o r Handle<JSFunction> v8_break_iterator_constructor = InstallFunction( - isolate_, intl, "v8BreakIterator", JS_INTL_V8_BREAK_ITERATOR_TYPE, + isolate_, intl, "v8BreakIterator", JS_V8_BREAK_ITERATOR_TYPE, JSV8BreakIterator::kSize, 0, factory->the_hole_value(), Builtins::kV8BreakIteratorConstructor); v8_break_iterator_constructor->shared().DontAdaptArguments(); @@ -3009,11 +3043,14 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, } { // -- P l u r a l R u l e s - Handle<JSFunction> plural_rules_constructor = InstallFunction( - isolate_, intl, "PluralRules", JS_INTL_PLURAL_RULES_TYPE, - JSPluralRules::kSize, 0, factory->the_hole_value(), - Builtins::kPluralRulesConstructor); + Handle<JSFunction> plural_rules_constructor = + InstallFunction(isolate_, intl, "PluralRules", JS_PLURAL_RULES_TYPE, + JSPluralRules::kSize, 0, factory->the_hole_value(), + Builtins::kPluralRulesConstructor); plural_rules_constructor->shared().DontAdaptArguments(); + InstallWithIntrinsicDefaultProto( + isolate_, plural_rules_constructor, + Context::INTL_PLURAL_RULES_FUNCTION_INDEX); SimpleInstallFunction(isolate(), plural_rules_constructor, "supportedLocalesOf", @@ -3032,13 +3069,16 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, Builtins::kPluralRulesPrototypeSelect, 1, false); } - { // -- R e l a t i v e T i m e F o r m a t e + { // -- R e l a t i v e T i m e F o r m a t Handle<JSFunction> relative_time_format_fun = InstallFunction( - isolate(), intl, "RelativeTimeFormat", - JS_INTL_RELATIVE_TIME_FORMAT_TYPE, JSRelativeTimeFormat::kSize, 0, - factory->the_hole_value(), Builtins::kRelativeTimeFormatConstructor); + isolate(), intl, "RelativeTimeFormat", JS_RELATIVE_TIME_FORMAT_TYPE, + JSRelativeTimeFormat::kSize, 0, factory->the_hole_value(), + Builtins::kRelativeTimeFormatConstructor); relative_time_format_fun->shared().set_length(0); relative_time_format_fun->shared().DontAdaptArguments(); + InstallWithIntrinsicDefaultProto( + isolate_, relative_time_format_fun, + Context::INTL_RELATIVE_TIME_FORMAT_FUNCTION_INDEX); SimpleInstallFunction( isolate(), relative_time_format_fun, "supportedLocalesOf", @@ -3063,12 +3103,14 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, } { // -- L i s t F o r m a t - Handle<JSFunction> list_format_fun = InstallFunction( - isolate(), intl, "ListFormat", JS_INTL_LIST_FORMAT_TYPE, - JSListFormat::kSize, 0, factory->the_hole_value(), - Builtins::kListFormatConstructor); + Handle<JSFunction> list_format_fun = + InstallFunction(isolate(), intl, "ListFormat", JS_LIST_FORMAT_TYPE, + JSListFormat::kSize, 0, factory->the_hole_value(), + Builtins::kListFormatConstructor); list_format_fun->shared().set_length(0); list_format_fun->shared().DontAdaptArguments(); + InstallWithIntrinsicDefaultProto( + isolate_, list_format_fun, Context::INTL_LIST_FORMAT_FUNCTION_INDEX); SimpleInstallFunction(isolate(), list_format_fun, "supportedLocalesOf", Builtins::kListFormatSupportedLocalesOf, 1, false); @@ -3091,7 +3133,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, { // -- L o c a l e Handle<JSFunction> locale_fun = InstallFunction( - isolate(), intl, "Locale", JS_INTL_LOCALE_TYPE, JSLocale::kSize, 0, + isolate(), intl, "Locale", JS_LOCALE_TYPE, JSLocale::kSize, 0, factory->the_hole_value(), Builtins::kLocaleConstructor); InstallWithIntrinsicDefaultProto(isolate(), locale_fun, Context::INTL_LOCALE_FUNCTION_INDEX); @@ -3394,7 +3436,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, isolate_, prototype, "set", Builtins::kMapPrototypeSet, 2, true); // Check that index of "set" function in JSCollection is correct. DCHECK_EQ(JSCollection::kAddFunctionDescriptorIndex, - prototype->map().LastAdded()); + prototype->map().LastAdded().as_int()); native_context()->set_map_set(*map_set); Handle<JSFunction> map_has = SimpleInstallFunction( @@ -3490,7 +3532,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, isolate_, prototype, "add", Builtins::kSetPrototypeAdd, 1, true); // Check that index of "add" function in JSCollection is correct. DCHECK_EQ(JSCollection::kAddFunctionDescriptorIndex, - prototype->map().LastAdded()); + prototype->map().LastAdded().as_int()); native_context()->set_set_add(*set_add); Handle<JSFunction> set_delete = SimpleInstallFunction( @@ -3523,6 +3565,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, Handle<Map> map = factory->NewMap( JS_MODULE_NAMESPACE_TYPE, JSModuleNamespace::kSize, TERMINAL_FAST_ELEMENTS_KIND, JSModuleNamespace::kInObjectFieldCount); + map->SetConstructor(native_context()->object_function()); Map::SetPrototype(isolate(), map, isolate_->factory()->null_value()); Map::EnsureDescriptorSlack(isolate_, map, 1); native_context()->set_js_module_namespace_map(*map); @@ -3593,7 +3636,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, isolate_, prototype, "set", Builtins::kWeakMapPrototypeSet, 2, true); // Check that index of "set" function in JSWeakCollection is correct. DCHECK_EQ(JSWeakCollection::kAddFunctionDescriptorIndex, - prototype->map().LastAdded()); + prototype->map().LastAdded().as_int()); native_context()->set_weakmap_set(*weakmap_set); SimpleInstallFunction(isolate_, prototype, "has", @@ -3628,7 +3671,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, isolate_, prototype, "add", Builtins::kWeakSetPrototypeAdd, 1, true); // Check that index of "add" function in JSWeakCollection is correct. DCHECK_EQ(JSWeakCollection::kAddFunctionDescriptorIndex, - prototype->map().LastAdded()); + prototype->map().LastAdded().as_int()); native_context()->set_weakset_add(*weakset_add); @@ -3748,7 +3791,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, Handle<String> arguments_string = factory->Arguments_string(); NewFunctionArgs args = NewFunctionArgs::ForBuiltinWithPrototype( arguments_string, isolate_->initial_object_prototype(), - JS_ARGUMENTS_TYPE, JSSloppyArgumentsObject::kSize, 2, + JS_ARGUMENTS_OBJECT_TYPE, JSSloppyArgumentsObject::kSize, 2, Builtins::kIllegal, MUTABLE); Handle<JSFunction> function = factory->NewFunction(args); Handle<Map> map(function->initial_map(), isolate()); @@ -3805,8 +3848,9 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, callee->set_setter(*poison); // Create the map. Allocate one in-object field for length. - Handle<Map> map = factory->NewMap( - JS_ARGUMENTS_TYPE, JSStrictArgumentsObject::kSize, PACKED_ELEMENTS, 1); + Handle<Map> map = + factory->NewMap(JS_ARGUMENTS_OBJECT_TYPE, + JSStrictArgumentsObject::kSize, PACKED_ELEMENTS, 1); // Create the descriptor array for the arguments object. Map::EnsureDescriptorSlack(isolate_, map, 2); @@ -4265,16 +4309,14 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_import_meta) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_sequence) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_optional_chaining) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_nullish) +EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_top_level_await) #ifdef V8_INTL_SUPPORT EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_add_calendar_numbering_system) -EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_bigint) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_dateformat_day_period) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE( harmony_intl_dateformat_fractional_second_digits) -EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_dateformat_quarter) -EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_datetime_style) -EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_numberformat_unified) +EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_other_calendars) #endif // V8_INTL_SUPPORT #undef EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE @@ -4419,34 +4461,20 @@ void Genesis::InitializeGlobal_harmony_promise_all_settled() { } } -#ifdef V8_INTL_SUPPORT - -void Genesis::InitializeGlobal_harmony_intl_date_format_range() { - if (!FLAG_harmony_intl_date_format_range) return; - - Handle<JSObject> intl = Handle<JSObject>::cast( - JSReceiver::GetProperty( - isolate(), - Handle<JSReceiver>(native_context()->global_object(), isolate()), - factory()->InternalizeUtf8String("Intl")) - .ToHandleChecked()); - - Handle<JSFunction> date_time_format_constructor = Handle<JSFunction>::cast( - JSReceiver::GetProperty( - isolate(), intl, factory()->InternalizeUtf8String("DateTimeFormat")) - .ToHandleChecked()); +void Genesis::InitializeGlobal_harmony_regexp_match_indices() { + if (!FLAG_harmony_regexp_match_indices) return; - Handle<JSObject> prototype( - JSObject::cast(date_time_format_constructor->prototype()), isolate_); - - SimpleInstallFunction(isolate_, prototype, "formatRange", - Builtins::kDateTimeFormatPrototypeFormatRange, 2, - false); - SimpleInstallFunction(isolate_, prototype, "formatRangeToParts", - Builtins::kDateTimeFormatPrototypeFormatRangeToParts, 2, - false); + // Add indices accessor to JSRegExpResult's initial map. + Handle<Map> initial_map(native_context()->regexp_result_map(), isolate()); + Descriptor d = Descriptor::AccessorConstant( + factory()->indices_string(), factory()->regexp_result_indices_accessor(), + NONE); + Map::EnsureDescriptorSlack(isolate(), initial_map, 1); + initial_map->AppendDescriptor(isolate(), &d); } +#ifdef V8_INTL_SUPPORT + void Genesis::InitializeGlobal_harmony_intl_segmenter() { if (!FLAG_harmony_intl_segmenter) return; Handle<JSObject> intl = Handle<JSObject>::cast( @@ -4457,10 +4485,12 @@ void Genesis::InitializeGlobal_harmony_intl_segmenter() { .ToHandleChecked()); Handle<JSFunction> segmenter_fun = InstallFunction( - isolate(), intl, "Segmenter", JS_INTL_SEGMENTER_TYPE, JSSegmenter::kSize, - 0, factory()->the_hole_value(), Builtins::kSegmenterConstructor); + isolate(), intl, "Segmenter", JS_SEGMENTER_TYPE, JSSegmenter::kSize, 0, + factory()->the_hole_value(), Builtins::kSegmenterConstructor); segmenter_fun->shared().set_length(0); segmenter_fun->shared().DontAdaptArguments(); + InstallWithIntrinsicDefaultProto(isolate_, segmenter_fun, + Context::INTL_SEGMENTER_FUNCTION_INDEX); SimpleInstallFunction(isolate(), segmenter_fun, "supportedLocalesOf", Builtins::kSegmenterSupportedLocalesOf, 1, false); @@ -4515,7 +4545,7 @@ void Genesis::InitializeGlobal_harmony_intl_segmenter() { isolate()->factory()->SegmentIterator_string()) .ToHandleChecked(); Handle<JSFunction> segment_iterator_fun = CreateFunction( - isolate(), name_string, JS_INTL_SEGMENT_ITERATOR_TYPE, + isolate(), name_string, JS_SEGMENT_ITERATOR_TYPE, JSSegmentIterator::kSize, 0, prototype, Builtins::kIllegal); segment_iterator_fun->shared().set_native(false); @@ -4900,42 +4930,10 @@ bool Genesis::InstallNatives() { // predefines the properties index, input, and groups). { // JSRegExpResult initial map. - - // Find global.Array.prototype to inherit from. - Handle<JSFunction> array_constructor(native_context()->array_function(), - isolate()); - Handle<JSObject> array_prototype( - JSObject::cast(array_constructor->instance_prototype()), isolate()); - - // Add initial map. - Handle<Map> initial_map = factory()->NewMap( - JS_ARRAY_TYPE, JSRegExpResult::kSize, TERMINAL_FAST_ELEMENTS_KIND, - JSRegExpResult::kInObjectPropertyCount); - initial_map->SetConstructor(*array_constructor); - - // Set prototype on map. - initial_map->set_has_non_instance_prototype(false); - Map::SetPrototype(isolate(), initial_map, array_prototype); - - // Update map with length accessor from Array and add "index", "input" and - // "groups". - Map::EnsureDescriptorSlack(isolate(), initial_map, - JSRegExpResult::kInObjectPropertyCount + 1); - - // length descriptor. - { - JSFunction array_function = native_context()->array_function(); - Handle<DescriptorArray> array_descriptors( - array_function.initial_map().instance_descriptors(), isolate()); - Handle<String> length = factory()->length_string(); - int old = array_descriptors->SearchWithCache( - isolate(), *length, array_function.initial_map()); - DCHECK_NE(old, DescriptorArray::kNotFound); - Descriptor d = Descriptor::AccessorConstant( - length, handle(array_descriptors->GetStrongValue(old), isolate()), - array_descriptors->GetDetails(old).attributes()); - initial_map->AppendDescriptor(isolate(), &d); - } + // Add additional slack to the initial map in case regexp_match_indices + // are enabled to account for the additional descriptor. + Handle<Map> initial_map = CreateInitialMapForArraySubclass( + JSRegExpResult::kSize, JSRegExpResult::kInObjectPropertyCount); // index descriptor. { @@ -4961,9 +4959,53 @@ bool Genesis::InstallNatives() { initial_map->AppendDescriptor(isolate(), &d); } + // Private internal only fields. All of the remaining fields have special + // symbols to prevent their use in Javascript. + // cached_indices_or_match_info descriptor. + { + PropertyAttributes attribs = DONT_ENUM; + { + Descriptor d = Descriptor::DataField( + isolate(), + factory()->regexp_result_cached_indices_or_match_info_symbol(), + JSRegExpResult::kCachedIndicesOrMatchInfoIndex, attribs, + Representation::Tagged()); + initial_map->AppendDescriptor(isolate(), &d); + } + + // names descriptor. + { + Descriptor d = Descriptor::DataField( + isolate(), factory()->regexp_result_names_symbol(), + JSRegExpResult::kNamesIndex, attribs, Representation::Tagged()); + initial_map->AppendDescriptor(isolate(), &d); + } + } + native_context()->set_regexp_result_map(*initial_map); } + // Create a constructor for JSRegExpResultIndices (a variant of Array that + // predefines the groups property). + { + // JSRegExpResultIndices initial map. + Handle<Map> initial_map = CreateInitialMapForArraySubclass( + JSRegExpResultIndices::kSize, + JSRegExpResultIndices::kInObjectPropertyCount); + + // groups descriptor. + { + Descriptor d = Descriptor::DataField( + isolate(), factory()->groups_string(), + JSRegExpResultIndices::kGroupsIndex, NONE, Representation::Tagged()); + initial_map->AppendDescriptor(isolate(), &d); + DCHECK_EQ(initial_map->LastAdded().as_int(), + JSRegExpResultIndices::kGroupsDescriptorIndex); + } + + native_context()->set_regexp_result_indices_map(*initial_map); + } + // Add @@iterator method to the arguments object maps. { PropertyAttributes attribs = DONT_ENUM; @@ -5263,7 +5305,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from, if (from->HasFastProperties()) { Handle<DescriptorArray> descs = Handle<DescriptorArray>(from->map().instance_descriptors(), isolate()); - for (int i = 0; i < from->map().NumberOfOwnDescriptors(); i++) { + for (InternalIndex i : from->map().IterateOwnDescriptors()) { PropertyDetails details = descs->GetDetails(i); if (details.location() == kField) { if (details.kind() == kData) { @@ -5365,6 +5407,45 @@ void Genesis::TransferObject(Handle<JSObject> from, Handle<JSObject> to) { JSObject::ForceSetPrototype(to, proto); } +Handle<Map> Genesis::CreateInitialMapForArraySubclass(int size, + int inobject_properties) { + // Find global.Array.prototype to inherit from. + Handle<JSFunction> array_constructor(native_context()->array_function(), + isolate()); + Handle<JSObject> array_prototype(native_context()->initial_array_prototype(), + isolate()); + + // Add initial map. + Handle<Map> initial_map = factory()->NewMap( + JS_ARRAY_TYPE, size, TERMINAL_FAST_ELEMENTS_KIND, inobject_properties); + initial_map->SetConstructor(*array_constructor); + + // Set prototype on map. + initial_map->set_has_non_instance_prototype(false); + Map::SetPrototype(isolate(), initial_map, array_prototype); + + // Update map with length accessor from Array. + static constexpr int kTheLengthAccessor = 1; + Map::EnsureDescriptorSlack(isolate(), initial_map, + inobject_properties + kTheLengthAccessor); + + // length descriptor. + { + JSFunction array_function = native_context()->array_function(); + Handle<DescriptorArray> array_descriptors( + array_function.initial_map().instance_descriptors(), isolate()); + Handle<String> length = factory()->length_string(); + InternalIndex old = array_descriptors->SearchWithCache( + isolate(), *length, array_function.initial_map()); + DCHECK(old.is_found()); + Descriptor d = Descriptor::AccessorConstant( + length, handle(array_descriptors->GetStrongValue(old), isolate()), + array_descriptors->GetDetails(old).attributes()); + initial_map->AppendDescriptor(isolate(), &d); + } + return initial_map; +} + Genesis::Genesis( Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy, v8::Local<v8::ObjectTemplate> global_proxy_template, diff --git a/deps/v8/src/init/heap-symbols.h b/deps/v8/src/init/heap-symbols.h index ce5a4f1a8b..9d630f547b 100644 --- a/deps/v8/src/init/heap-symbols.h +++ b/deps/v8/src/init/heap-symbols.h @@ -82,6 +82,7 @@ V(_, plusSign_string, "plusSign") \ V(_, quarter_string, "quarter") \ V(_, region_string, "region") \ + V(_, relatedYear_string, "relatedYear") \ V(_, scientific_string, "scientific") \ V(_, second_string, "second") \ V(_, segment_string, "segment") \ @@ -107,7 +108,8 @@ V(_, unit_string, "unit") \ V(_, unitDisplay_string, "unitDisplay") \ V(_, weekday_string, "weekday") \ - V(_, year_string, "year") + V(_, year_string, "year") \ + V(_, yearName_string, "yearName") #else // V8_INTL_SUPPORT #define INTERNALIZED_STRING_LIST_GENERATOR_INTL(V, _) #endif // V8_INTL_SUPPORT @@ -202,6 +204,7 @@ V(_, illegal_access_string, "illegal access") \ V(_, illegal_argument_string, "illegal argument") \ V(_, index_string, "index") \ + V(_, indices_string, "indices") \ V(_, Infinity_string, "Infinity") \ V(_, infinity_string, "infinity") \ V(_, input_string, "input") \ @@ -209,6 +212,8 @@ V(_, Int32Array_string, "Int32Array") \ V(_, Int8Array_string, "Int8Array") \ V(_, isExtensible_string, "isExtensible") \ + V(_, jsMemoryEstimate_string, "jsMemoryEstimate") \ + V(_, jsMemoryRange_string, "jsMemoryRange") \ V(_, keys_string, "keys") \ V(_, lastIndex_string, "lastIndex") \ V(_, length_string, "length") \ @@ -299,6 +304,7 @@ V(_, toJSON_string, "toJSON") \ V(_, toString_string, "toString") \ V(_, true_string, "true") \ + V(_, total_string, "total") \ V(_, TypeError_string, "TypeError") \ V(_, Uint16Array_string, "Uint16Array") \ V(_, Uint32Array_string, "Uint32Array") \ @@ -318,35 +324,36 @@ V(_, writable_string, "writable") \ V(_, zero_string, "0") -#define PRIVATE_SYMBOL_LIST_GENERATOR(V, _) \ - V(_, call_site_frame_array_symbol) \ - V(_, call_site_frame_index_symbol) \ - V(_, console_context_id_symbol) \ - V(_, console_context_name_symbol) \ - V(_, class_fields_symbol) \ - V(_, class_positions_symbol) \ - V(_, detailed_stack_trace_symbol) \ - V(_, elements_transition_symbol) \ - V(_, error_end_pos_symbol) \ - V(_, error_script_symbol) \ - V(_, error_start_pos_symbol) \ - V(_, frozen_symbol) \ - V(_, generic_symbol) \ - V(_, home_object_symbol) \ - V(_, interpreter_trampoline_symbol) \ - V(_, megamorphic_symbol) \ - V(_, native_context_index_symbol) \ - V(_, nonextensible_symbol) \ - V(_, not_mapped_symbol) \ - V(_, premonomorphic_symbol) \ - V(_, promise_debug_marker_symbol) \ - V(_, promise_forwarding_handler_symbol) \ - V(_, promise_handled_by_symbol) \ - V(_, sealed_symbol) \ - V(_, stack_trace_symbol) \ - V(_, strict_function_transition_symbol) \ - V(_, wasm_exception_tag_symbol) \ - V(_, wasm_exception_values_symbol) \ +#define PRIVATE_SYMBOL_LIST_GENERATOR(V, _) \ + V(_, call_site_frame_array_symbol) \ + V(_, call_site_frame_index_symbol) \ + V(_, console_context_id_symbol) \ + V(_, console_context_name_symbol) \ + V(_, class_fields_symbol) \ + V(_, class_positions_symbol) \ + V(_, detailed_stack_trace_symbol) \ + V(_, elements_transition_symbol) \ + V(_, error_end_pos_symbol) \ + V(_, error_script_symbol) \ + V(_, error_start_pos_symbol) \ + V(_, frozen_symbol) \ + V(_, generic_symbol) \ + V(_, home_object_symbol) \ + V(_, interpreter_trampoline_symbol) \ + V(_, megamorphic_symbol) \ + V(_, native_context_index_symbol) \ + V(_, nonextensible_symbol) \ + V(_, not_mapped_symbol) \ + V(_, promise_debug_marker_symbol) \ + V(_, promise_forwarding_handler_symbol) \ + V(_, promise_handled_by_symbol) \ + V(_, regexp_result_cached_indices_or_match_info_symbol) \ + V(_, regexp_result_names_symbol) \ + V(_, sealed_symbol) \ + V(_, stack_trace_symbol) \ + V(_, strict_function_transition_symbol) \ + V(_, wasm_exception_tag_symbol) \ + V(_, wasm_exception_values_symbol) \ V(_, uninitialized_symbol) #define PUBLIC_SYMBOL_LIST_GENERATOR(V, _) \ diff --git a/deps/v8/src/init/icu_util.cc b/deps/v8/src/init/icu_util.cc index 81c66e6a20..22ea3837cd 100644 --- a/deps/v8/src/init/icu_util.cc +++ b/deps/v8/src/init/icu_util.cc @@ -40,26 +40,23 @@ bool InitializeICUDefaultLocation(const char* exec_path, const char* icu_data_file) { #if !defined(V8_INTL_SUPPORT) return true; -#else -#if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE +#elif ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE if (icu_data_file) { return InitializeICU(icu_data_file); } - char* icu_data_file_default; #if defined(V8_TARGET_LITTLE_ENDIAN) - base::RelativePath(&icu_data_file_default, exec_path, "icudtl.dat"); + std::unique_ptr<char[]> icu_data_file_default = + base::RelativePath(exec_path, "icudtl.dat"); #elif defined(V8_TARGET_BIG_ENDIAN) - base::RelativePath(&icu_data_file_default, exec_path, "icudtb.dat"); + std::unique_ptr<char[]> icu_data_file_default = + base::RelativePath(exec_path, "icudtb.dat"); #else #error Unknown byte ordering #endif - bool result = InitializeICU(icu_data_file_default); - free(icu_data_file_default); - return result; + return InitializeICU(icu_data_file_default.get()); #else return InitializeICU(nullptr); #endif -#endif } bool InitializeICU(const char* icu_data_file) { diff --git a/deps/v8/src/init/isolate-allocator.cc b/deps/v8/src/init/isolate-allocator.cc index 6a9b4c33cd..b9ec6c3f43 100644 --- a/deps/v8/src/init/isolate-allocator.cc +++ b/deps/v8/src/init/isolate-allocator.cc @@ -6,6 +6,7 @@ #include "src/base/bounded-page-allocator.h" #include "src/common/ptr-compr.h" #include "src/execution/isolate.h" +#include "src/utils/memcopy.h" #include "src/utils/utils.h" namespace v8 { @@ -38,21 +39,39 @@ IsolateAllocator::~IsolateAllocator() { } #if V8_TARGET_ARCH_64_BIT + +namespace { + +// "IsolateRootBiasPage" is an optional region before the 4Gb aligned +// reservation. This "IsolateRootBiasPage" page is supposed to be used for +// storing part of the Isolate object when Isolate::isolate_root_bias() is +// not zero. +inline size_t GetIsolateRootBiasPageSize( + v8::PageAllocator* platform_page_allocator) { + return RoundUp(Isolate::isolate_root_bias(), + platform_page_allocator->AllocatePageSize()); +} + +} // namespace + Address IsolateAllocator::InitReservation() { v8::PageAllocator* platform_page_allocator = GetPlatformPageAllocator(); - // Reserve a 4Gb region so that the middle is 4Gb aligned. - // The VirtualMemory API does not support such an constraint so we have to - // implement it manually here. - size_t reservation_size = kPtrComprHeapReservationSize; - size_t base_alignment = kPtrComprIsolateRootAlignment; + const size_t kIsolateRootBiasPageSize = + GetIsolateRootBiasPageSize(platform_page_allocator); + + // Reserve a |4Gb + kIsolateRootBiasPageSize| region such as that the + // resevation address plus |kIsolateRootBiasPageSize| is 4Gb aligned. + const size_t reservation_size = + kPtrComprHeapReservationSize + kIsolateRootBiasPageSize; + const size_t base_alignment = kPtrComprIsolateRootAlignment; const int kMaxAttempts = 4; for (int attempt = 0; attempt < kMaxAttempts; ++attempt) { Address hint = RoundDown(reinterpret_cast<Address>( platform_page_allocator->GetRandomMmapAddr()), - base_alignment) + - kPtrComprIsolateRootBias; + base_alignment) - + kIsolateRootBiasPageSize; // Within this reservation there will be a sub-region with proper alignment. VirtualMemory padded_reservation(platform_page_allocator, @@ -60,12 +79,11 @@ Address IsolateAllocator::InitReservation() { reinterpret_cast<void*>(hint)); if (!padded_reservation.IsReserved()) break; - // Find such a sub-region inside the reservation that it's middle is - // |base_alignment|-aligned. + // Find properly aligned sub-region inside the reservation. Address address = - RoundUp(padded_reservation.address() + kPtrComprIsolateRootBias, + RoundUp(padded_reservation.address() + kIsolateRootBiasPageSize, base_alignment) - - kPtrComprIsolateRootBias; + kIsolateRootBiasPageSize; CHECK(padded_reservation.InVM(address, reservation_size)); #if defined(V8_OS_FUCHSIA) @@ -98,16 +116,16 @@ Address IsolateAllocator::InitReservation() { if (!reservation.IsReserved()) break; // The reservation could still be somewhere else but we can accept it - // if the reservation has the required alignment. - Address aligned_address = - RoundUp(reservation.address() + kPtrComprIsolateRootBias, + // if it has the required alignment. + Address address = + RoundUp(reservation.address() + kIsolateRootBiasPageSize, base_alignment) - - kPtrComprIsolateRootBias; + kIsolateRootBiasPageSize; - if (reservation.address() == aligned_address) { + if (reservation.address() == address) { reservation_ = std::move(reservation); CHECK_EQ(reservation_.size(), reservation_size); - return aligned_address; + return address; } } } @@ -116,21 +134,26 @@ Address IsolateAllocator::InitReservation() { return kNullAddress; } -void IsolateAllocator::CommitPagesForIsolate(Address heap_address) { - CHECK(reservation_.InVM(heap_address, kPtrComprHeapReservationSize)); +void IsolateAllocator::CommitPagesForIsolate(Address heap_reservation_address) { + v8::PageAllocator* platform_page_allocator = GetPlatformPageAllocator(); + + const size_t kIsolateRootBiasPageSize = + GetIsolateRootBiasPageSize(platform_page_allocator); - Address isolate_root = heap_address + kPtrComprIsolateRootBias; + Address isolate_root = heap_reservation_address + kIsolateRootBiasPageSize; CHECK(IsAligned(isolate_root, kPtrComprIsolateRootAlignment)); - v8::PageAllocator* platform_page_allocator = GetPlatformPageAllocator(); + CHECK(reservation_.InVM( + heap_reservation_address, + kPtrComprHeapReservationSize + kIsolateRootBiasPageSize)); // Simplify BoundedPageAllocator's life by configuring it to use same page // size as the Heap will use (MemoryChunk::kPageSize). size_t page_size = RoundUp(size_t{1} << kPageSizeBits, platform_page_allocator->AllocatePageSize()); - page_allocator_instance_ = base::make_unique<base::BoundedPageAllocator>( - platform_page_allocator, heap_address, kPtrComprHeapReservationSize, + page_allocator_instance_ = std::make_unique<base::BoundedPageAllocator>( + platform_page_allocator, isolate_root, kPtrComprHeapReservationSize, page_size); page_allocator_ = page_allocator_instance_.get(); @@ -139,7 +162,7 @@ void IsolateAllocator::CommitPagesForIsolate(Address heap_address) { // Inform the bounded page allocator about reserved pages. { - Address reserved_region_address = RoundDown(isolate_address, page_size); + Address reserved_region_address = isolate_root; size_t reserved_region_size = RoundUp(isolate_end, page_size) - reserved_region_address; @@ -163,10 +186,8 @@ void IsolateAllocator::CommitPagesForIsolate(Address heap_address) { PageAllocator::kReadWrite)); if (Heap::ShouldZapGarbage()) { - for (Address address = committed_region_address; - address < committed_region_size; address += kSystemPointerSize) { - base::Memory<Address>(address) = static_cast<Address>(kZapValue); - } + MemsetPointer(reinterpret_cast<Address*>(committed_region_address), + kZapValue, committed_region_size / kSystemPointerSize); } } isolate_memory_ = reinterpret_cast<void*>(isolate_address); diff --git a/deps/v8/src/init/isolate-allocator.h b/deps/v8/src/init/isolate-allocator.h index cd0e102d40..5f8b48ef3a 100644 --- a/deps/v8/src/init/isolate-allocator.h +++ b/deps/v8/src/init/isolate-allocator.h @@ -5,6 +5,8 @@ #ifndef V8_INIT_ISOLATE_ALLOCATOR_H_ #define V8_INIT_ISOLATE_ALLOCATOR_H_ +#include <memory> + #include "src/base/bounded-page-allocator.h" #include "src/base/page-allocator.h" #include "src/common/globals.h" @@ -46,7 +48,7 @@ class V8_EXPORT_PRIVATE IsolateAllocator final { private: Address InitReservation(); - void CommitPagesForIsolate(Address heap_address); + void CommitPagesForIsolate(Address heap_reservation_address); // The allocated memory for Isolate instance. void* isolate_memory_ = nullptr; diff --git a/deps/v8/src/init/setup-isolate-deserialize.cc b/deps/v8/src/init/setup-isolate-deserialize.cc index 8a73ff0c8a..ff0268d3c8 100644 --- a/deps/v8/src/init/setup-isolate-deserialize.cc +++ b/deps/v8/src/init/setup-isolate-deserialize.cc @@ -7,7 +7,6 @@ #include "src/base/logging.h" #include "src/execution/isolate.h" #include "src/interpreter/interpreter.h" -#include "src/objects/objects-inl.h" #include "src/utils/ostreams.h" namespace v8 { diff --git a/deps/v8/src/init/startup-data-util.cc b/deps/v8/src/init/startup-data-util.cc index 54d697c591..d234c152f8 100644 --- a/deps/v8/src/init/startup-data-util.cc +++ b/deps/v8/src/init/startup-data-util.cc @@ -38,6 +38,10 @@ void FreeStartupData() { DeleteStartupData(&g_snapshot); } +// TODO(jgruber): Rename to FreeStartupData once natives support has been +// removed (https://crbug.com/v8/7624). +void FreeStartupDataSnapshotOnly() { DeleteStartupData(&g_snapshot); } + void Load(const char* blob_file, v8::StartupData* startup_data, void (*setter_fn)(v8::StartupData*)) { ClearStartupData(startup_data); @@ -67,7 +71,7 @@ void Load(const char* blob_file, v8::StartupData* startup_data, } void LoadFromFiles(const char* natives_blob, const char* snapshot_blob) { - Load(natives_blob, &g_natives, v8::V8::SetNativesDataBlob); + Load(natives_blob, &g_natives, i::V8::SetNativesBlob); Load(snapshot_blob, &g_snapshot, v8::V8::SetSnapshotDataBlob); atexit(&FreeStartupData); @@ -78,19 +82,17 @@ void LoadFromFiles(const char* natives_blob, const char* snapshot_blob) { void InitializeExternalStartupData(const char* directory_path) { #ifdef V8_USE_EXTERNAL_STARTUP_DATA - char* natives; - char* snapshot; const char* snapshot_name = "snapshot_blob.bin"; #ifdef V8_MULTI_SNAPSHOTS if (!FLAG_untrusted_code_mitigations) { snapshot_name = "snapshot_blob_trusted.bin"; } #endif - LoadFromFiles( - base::RelativePath(&natives, directory_path, "natives_blob.bin"), - base::RelativePath(&snapshot, directory_path, snapshot_name)); - free(natives); - free(snapshot); + std::unique_ptr<char[]> natives = + base::RelativePath(directory_path, "natives_blob.bin"); + std::unique_ptr<char[]> snapshot = + base::RelativePath(directory_path, snapshot_name); + LoadFromFiles(natives.get(), snapshot.get()); #endif // V8_USE_EXTERNAL_STARTUP_DATA } @@ -101,5 +103,12 @@ void InitializeExternalStartupData(const char* natives_blob, #endif // V8_USE_EXTERNAL_STARTUP_DATA } +void InitializeExternalStartupDataFromFile(const char* snapshot_blob) { +#ifdef V8_USE_EXTERNAL_STARTUP_DATA + Load(snapshot_blob, &g_snapshot, v8::V8::SetSnapshotDataBlob); + atexit(&FreeStartupDataSnapshotOnly); +#endif // V8_USE_EXTERNAL_STARTUP_DATA +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/src/init/startup-data-util.h b/deps/v8/src/init/startup-data-util.h index dfa26510ab..e4d1e540f7 100644 --- a/deps/v8/src/init/startup-data-util.h +++ b/deps/v8/src/init/startup-data-util.h @@ -21,6 +21,7 @@ void InitializeExternalStartupData(const char* directory_path); void InitializeExternalStartupData(const char* natives_blob, const char* snapshot_blob); +void InitializeExternalStartupDataFromFile(const char* snapshot_blob); } // namespace internal } // namespace v8 diff --git a/deps/v8/src/init/v8.cc b/deps/v8/src/init/v8.cc index 15eb929332..fd26c60848 100644 --- a/deps/v8/src/init/v8.cc +++ b/deps/v8/src/init/v8.cc @@ -90,6 +90,12 @@ void V8::InitializeOncePerProcessImpl() { FLAG_expose_wasm = false; } + if (FLAG_regexp_interpret_all && FLAG_regexp_tier_up) { + // Turning off the tier-up strategy, because the --regexp-interpret-all and + // --regexp-tier-up flags are incompatible. + FLAG_regexp_tier_up = false; + } + // The --jitless and --interpreted-frames-native-stack flags are incompatible // since the latter requires code generation while the former prohibits code // generation. |