diff options
Diffstat (limited to 'deps/v8/src/init')
-rw-r--r-- | deps/v8/src/init/bootstrapper.cc | 202 | ||||
-rw-r--r-- | deps/v8/src/init/heap-symbols.h | 49 | ||||
-rw-r--r-- | deps/v8/src/init/v8.cc | 76 |
3 files changed, 236 insertions, 91 deletions
diff --git a/deps/v8/src/init/bootstrapper.cc b/deps/v8/src/init/bootstrapper.cc index a9afa3f413..fc7b17d582 100644 --- a/deps/v8/src/init/bootstrapper.cc +++ b/deps/v8/src/init/bootstrapper.cc @@ -47,6 +47,7 @@ #include "src/objects/js-collator.h" #include "src/objects/js-date-time-format.h" #include "src/objects/js-display-names.h" +#include "src/objects/js-duration-format.h" #include "src/objects/js-list-format.h" #include "src/objects/js-locale.h" #include "src/objects/js-number-format.h" @@ -62,12 +63,14 @@ #include "src/objects/js-segments.h" #endif // V8_INTL_SUPPORT #include "src/codegen/script-details.h" +#include "src/objects/js-raw-json.h" #include "src/objects/js-shared-array.h" #include "src/objects/js-struct.h" #include "src/objects/js-temporal-objects-inl.h" #include "src/objects/js-weak-refs.h" #include "src/objects/ordered-hash-table.h" #include "src/objects/property-cell.h" +#include "src/objects/property-descriptor.h" #include "src/objects/slots-inl.h" #include "src/objects/swiss-name-dictionary-inl.h" #include "src/objects/templates.h" @@ -134,13 +137,13 @@ void Bootstrapper::Initialize(bool create_heap_objects) { static const char* GCFunctionName() { bool flag_given = - FLAG_expose_gc_as != nullptr && strlen(FLAG_expose_gc_as) != 0; - return flag_given ? FLAG_expose_gc_as : "gc"; + v8_flags.expose_gc_as != nullptr && strlen(v8_flags.expose_gc_as) != 0; + return flag_given ? v8_flags.expose_gc_as : "gc"; } static bool isValidCpuTraceMarkFunctionName() { - return FLAG_expose_cputracemark_as != nullptr && - strlen(FLAG_expose_cputracemark_as) != 0; + return v8_flags.expose_cputracemark_as != nullptr && + strlen(v8_flags.expose_cputracemark_as) != 0; } void Bootstrapper::InitializeOncePerProcess() { @@ -150,8 +153,8 @@ void Bootstrapper::InitializeOncePerProcess() { v8::RegisterExtension(std::make_unique<TriggerFailureExtension>()); v8::RegisterExtension(std::make_unique<IgnitionStatisticsExtension>()); if (isValidCpuTraceMarkFunctionName()) { - v8::RegisterExtension( - std::make_unique<CpuTraceMarkExtension>(FLAG_expose_cputracemark_as)); + v8::RegisterExtension(std::make_unique<CpuTraceMarkExtension>( + v8_flags.expose_cputracemark_as)); } #ifdef ENABLE_VTUNE_TRACEMARK v8::RegisterExtension( @@ -360,7 +363,7 @@ Handle<JSGlobalProxy> Bootstrapper::NewRemoteContext( } void Bootstrapper::LogAllMaps() { - if (!FLAG_log_maps || isolate_->initialized_from_snapshot()) return; + if (!v8_flags.log_maps || isolate_->initialized_from_snapshot()) return; // Log all created Map objects that are on the heap. For snapshots the Map // logging happens during deserialization in order to avoid printing Maps // multiple times during partial deserialization. @@ -1774,9 +1777,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, native_context()->set_initial_array_prototype(*proto); InitializeJSArrayMaps(isolate_, native_context(), - handle(array_function->initial_map(), isolate_)); - SimpleInstallFunction(isolate_, array_function, "isArray", Builtin::kArrayIsArray, 1, true); SimpleInstallFunction(isolate_, array_function, "from", Builtin::kArrayFrom, @@ -2785,6 +2786,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, SimpleInstallFunction(isolate_, json_object, "stringify", Builtin::kJsonStringify, 3, true); InstallToStringTag(isolate_, json_object, "JSON"); + native_context()->set_json_object(*json_object); } { // -- M a t h @@ -3921,7 +3923,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, // The cleanupSome function is created but not exposed, as it is used // internally by InvokeFinalizationRegistryCleanupFromTask. // - // It is exposed by FLAG_harmony_weak_refs_with_cleanup_some. + // It is exposed by v8_flags.harmony_weak_refs_with_cleanup_some. Handle<JSFunction> cleanup_some_fun = SimpleCreateFunction( isolate_, factory->InternalizeUtf8String("cleanupSome"), Builtin::kFinalizationRegistryPrototypeCleanupSome, 0, false); @@ -4506,6 +4508,7 @@ void Genesis::InitializeConsole(Handle<JSObject> extras_binding) { EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_import_assertions) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_static_blocks) +EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_symbol_as_weakmap_key) #ifdef V8_INTL_SUPPORT EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_best_fit_matcher) @@ -4513,8 +4516,30 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_best_fit_matcher) #undef EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE +void Genesis::InitializeGlobal_harmony_json_parse_with_source() { + if (!v8_flags.harmony_json_parse_with_source) return; + Handle<Map> map = factory()->NewMap(JS_RAW_JSON_TYPE, JSRawJson::kSize, + TERMINAL_FAST_ELEMENTS_KIND, 1); + Map::EnsureDescriptorSlack(isolate_, map, 1); + { + Descriptor d = Descriptor::DataField( + isolate(), factory()->raw_json_string(), JSRawJson::kRawJsonIndex, NONE, + Representation::Tagged()); + map->AppendDescriptor(isolate(), &d); + } + map->SetPrototype(isolate(), map, isolate()->factory()->null_value()); + map->SetConstructor(native_context()->object_function()); + native_context()->set_js_raw_json_map(*map); + SimpleInstallFunction(isolate_, + handle(native_context()->json_object(), isolate_), + "rawJSON", Builtin::kJsonRawJson, 1, true); + SimpleInstallFunction(isolate_, + handle(native_context()->json_object(), isolate_), + "isRawJSON", Builtin::kJsonIsRawJson, 1, true); +} + void Genesis::InitializeGlobal_harmony_change_array_by_copy() { - if (!FLAG_harmony_change_array_by_copy) return; + if (!v8_flags.harmony_change_array_by_copy) return; { Handle<JSFunction> array_function(native_context()->array_function(), @@ -4546,13 +4571,15 @@ void Genesis::InitializeGlobal_harmony_change_array_by_copy() { isolate()); SimpleInstallFunction(isolate_, prototype, "toReversed", Builtin::kTypedArrayPrototypeToReversed, 0, true); + SimpleInstallFunction(isolate_, prototype, "toSorted", + Builtin::kTypedArrayPrototypeToSorted, 1, false); SimpleInstallFunction(isolate_, prototype, "with", Builtin::kTypedArrayPrototypeWith, 2, true); } } void Genesis::InitializeGlobal_harmony_regexp_unicode_sets() { - if (!FLAG_harmony_regexp_unicode_sets) return; + if (!v8_flags.harmony_regexp_unicode_sets) return; Handle<JSFunction> regexp_fun(native_context()->regexp_function(), isolate()); Handle<JSObject> regexp_prototype( @@ -4566,7 +4593,7 @@ void Genesis::InitializeGlobal_harmony_regexp_unicode_sets() { } void Genesis::InitializeGlobal_harmony_shadow_realm() { - if (!FLAG_harmony_shadow_realm) return; + if (!v8_flags.harmony_shadow_realm) return; Factory* factory = isolate()->factory(); // -- S h a d o w R e a l m // #sec-shadowrealm-objects @@ -4638,7 +4665,7 @@ void Genesis::InitializeGlobal_harmony_shadow_realm() { } void Genesis::InitializeGlobal_harmony_struct() { - if (!FLAG_harmony_struct) return; + if (!v8_flags.harmony_struct) return; Handle<JSGlobalObject> global(native_context()->global_object(), isolate()); Handle<String> name = @@ -4670,8 +4697,11 @@ void Genesis::InitializeGlobal_harmony_struct() { isolate()->factory()->NewDescriptorArray(1, 0, AllocationType::kSharedOld); Descriptor descriptor = Descriptor::AccessorConstant( - isolate()->shared_isolate()->factory()->length_string(), - isolate()->shared_isolate()->factory()->shared_array_length_accessor(), + isolate()->shared_heap_isolate()->factory()->length_string(), + isolate() + ->shared_heap_isolate() + ->factory() + ->shared_array_length_accessor(), ALL_ATTRIBUTES_MASK); descriptors->Set(InternalIndex(0), &descriptor); shared_array_fun->initial_map().InitializeDescriptors(isolate(), @@ -4728,7 +4758,7 @@ void Genesis::InitializeGlobal_harmony_struct() { } void Genesis::InitializeGlobal_harmony_array_find_last() { - if (!FLAG_harmony_array_find_last) return; + if (!v8_flags.harmony_array_find_last) return; { Handle<JSFunction> array_function(native_context()->array_function(), @@ -4761,7 +4791,7 @@ void Genesis::InitializeGlobal_harmony_array_find_last() { } void Genesis::InitializeGlobal_harmony_array_grouping() { - if (!FLAG_harmony_array_grouping) return; + if (!v8_flags.harmony_array_grouping) return; Handle<JSFunction> array_function(native_context()->array_function(), isolate()); @@ -4783,8 +4813,8 @@ void Genesis::InitializeGlobal_harmony_array_grouping() { } void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { - if (!FLAG_harmony_sharedarraybuffer || - FLAG_enable_sharedarraybuffer_per_context) { + if (!v8_flags.harmony_sharedarraybuffer || + v8_flags.enable_sharedarraybuffer_per_context) { return; } @@ -4795,7 +4825,7 @@ void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { } void Genesis::InitializeGlobal_harmony_atomics() { - if (!FLAG_harmony_atomics) return; + if (!v8_flags.harmony_atomics) return; Handle<JSGlobalObject> global(native_context()->global_object(), isolate()); @@ -4805,7 +4835,7 @@ void Genesis::InitializeGlobal_harmony_atomics() { } void Genesis::InitializeGlobal_harmony_weak_refs_with_cleanup_some() { - if (!FLAG_harmony_weak_refs_with_cleanup_some) return; + if (!v8_flags.harmony_weak_refs_with_cleanup_some) return; Handle<JSFunction> finalization_registry_fun = isolate()->js_finalization_registry_fun(); @@ -4820,7 +4850,7 @@ void Genesis::InitializeGlobal_harmony_weak_refs_with_cleanup_some() { } void Genesis::InitializeGlobal_regexp_linear_flag() { - if (!FLAG_enable_experimental_regexp_engine) return; + if (!v8_flags.enable_experimental_regexp_engine) return; Handle<JSFunction> regexp_fun(native_context()->regexp_function(), isolate()); Handle<JSObject> regexp_prototype( @@ -4834,7 +4864,7 @@ void Genesis::InitializeGlobal_regexp_linear_flag() { } void Genesis::InitializeGlobal_harmony_rab_gsab() { - if (!FLAG_harmony_rab_gsab) return; + if (!v8_flags.harmony_rab_gsab) return; Handle<JSObject> array_buffer_prototype( JSObject::cast(native_context()->array_buffer_fun().instance_prototype()), isolate()); @@ -4865,7 +4895,7 @@ void Genesis::InitializeGlobal_harmony_rab_gsab() { } void Genesis::InitializeGlobal_harmony_temporal() { - if (!FLAG_harmony_temporal) return; + if (!v8_flags.harmony_temporal) return; // -- T e m p o r a l // #sec-temporal-objects Handle<JSObject> temporal = @@ -5508,7 +5538,7 @@ void Genesis::InitializeGlobal_harmony_temporal() { #ifdef V8_INTL_SUPPORT void Genesis::InitializeGlobal_harmony_intl_number_format_v3() { - if (!FLAG_harmony_intl_number_format_v3) return; + if (!v8_flags.harmony_intl_number_format_v3) return; { Handle<JSFunction> number_format_constructor = @@ -5538,7 +5568,7 @@ void Genesis::InitializeGlobal_harmony_intl_number_format_v3() { #endif // V8_INTL_SUPPORT void Genesis::InitializeGlobal_experimental_web_snapshots() { - if (!FLAG_experimental_web_snapshots) return; + if (!v8_flags.experimental_web_snapshots) return; Handle<JSGlobalObject> global(native_context()->global_object(), isolate()); Handle<JSObject> web_snapshot_object = @@ -5552,6 +5582,46 @@ void Genesis::InitializeGlobal_experimental_web_snapshots() { Builtin::kWebSnapshotDeserialize, 2, false); } +#ifdef V8_INTL_SUPPORT +void Genesis::InitializeGlobal_harmony_intl_duration_format() { + if (!FLAG_harmony_intl_duration_format) return; + Handle<JSObject> intl = Handle<JSObject>::cast( + JSReceiver::GetProperty( + isolate(), + Handle<JSReceiver>(native_context()->global_object(), isolate()), + factory()->InternalizeUtf8String("Intl")) + .ToHandleChecked()); + + Handle<JSFunction> duration_format_fun = InstallFunction( + isolate(), intl, "DurationFormat", JS_DURATION_FORMAT_TYPE, + JSDurationFormat::kHeaderSize, 0, factory()->the_hole_value(), + Builtin::kDurationFormatConstructor); + duration_format_fun->shared().set_length(0); + duration_format_fun->shared().DontAdaptArguments(); + InstallWithIntrinsicDefaultProto( + isolate(), duration_format_fun, + Context::INTL_DURATION_FORMAT_FUNCTION_INDEX); + + SimpleInstallFunction(isolate(), duration_format_fun, "supportedLocalesOf", + Builtin::kDurationFormatSupportedLocalesOf, 1, false); + + Handle<JSObject> prototype( + JSObject::cast(duration_format_fun->instance_prototype()), isolate()); + + InstallToStringTag(isolate(), prototype, "Intl.DurationFormat"); + + SimpleInstallFunction(isolate(), prototype, "resolvedOptions", + Builtin::kDurationFormatPrototypeResolvedOptions, 0, + false); + + SimpleInstallFunction(isolate(), prototype, "format", + Builtin::kDurationFormatPrototypeFormat, 1, false); + SimpleInstallFunction(isolate(), prototype, "formatToParts", + Builtin::kDurationFormatPrototypeFormatToParts, 1, + false); +} +#endif // V8_INTL_SUPPORT + Handle<JSFunction> Genesis::CreateArrayBuffer( Handle<String> name, ArrayBufferKind array_buffer_kind) { // Create the %ArrayBufferPrototype% @@ -5791,6 +5861,58 @@ bool Genesis::InstallABunchOfRandomThings() { native_context()->set_data_property_descriptor_map(*map); } + { + // -- TemplateLiteral JSArray Map + Handle<JSFunction> array_function(native_context()->array_function(), + isolate()); + Handle<Map> template_map(array_function->initial_map(), isolate_); + template_map = Map::CopyAsElementsKind(isolate_, template_map, + PACKED_ELEMENTS, OMIT_TRANSITION); + template_map->set_instance_size(template_map->instance_size() + + kTaggedSize); + // Temporarily instantiate full template_literal_object to get the final + // map. + auto template_object = + Handle<JSArray>::cast(factory()->NewJSObjectFromMap(template_map)); + { + DisallowGarbageCollection no_gc; + JSArray raw = *template_object; + raw.set_elements(ReadOnlyRoots(isolate()).empty_fixed_array()); + raw.set_length(Smi::FromInt(0)); + } + + // Install a "raw" data property for {raw_object} on {template_object}. + // See ES#sec-gettemplateobject. + PropertyDescriptor raw_desc; + // Use arbrirary object {template_object} as ".raw" value. + raw_desc.set_value(template_object); + raw_desc.set_configurable(false); + raw_desc.set_enumerable(false); + raw_desc.set_writable(false); + JSArray::DefineOwnProperty(isolate(), template_object, + factory()->raw_string(), &raw_desc, + Just(kThrowOnError)) + .ToChecked(); + + // Freeze the {template_object} as well. + JSObject::SetIntegrityLevel(template_object, FROZEN, kThrowOnError) + .ToChecked(); + { + DisallowGarbageCollection no_gc; + // Verify TemplateLiteralObject::kRawFieldOffset + DescriptorArray desc = template_object->map().instance_descriptors(); + InternalIndex descriptor_index = + desc.Search(*factory()->raw_string(), desc.number_of_descriptors()); + FieldIndex index = + FieldIndex::ForDescriptor(template_object->map(), descriptor_index); + CHECK(index.is_inobject()); + CHECK_EQ(index.offset(), TemplateLiteralObject::kRawFieldOffset); + } + + native_context()->set_js_array_template_literal_object_map( + template_object->map()); + } + // Create a constructor for RegExp results (a variant of Array that // predefines the properties index, input, and groups). { @@ -6000,15 +6122,16 @@ bool Genesis::InstallSpecialObjects(Isolate* isolate, Handle<JSObject> Error = isolate->error_function(); Handle<String> name = isolate->factory()->stackTraceLimit_string(); - Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit), isolate); + Handle<Smi> stack_trace_limit(Smi::FromInt(v8_flags.stack_trace_limit), + isolate); JSObject::AddProperty(isolate, Error, name, stack_trace_limit, NONE); #if V8_ENABLE_WEBASSEMBLY - if (FLAG_expose_wasm) { + if (v8_flags.expose_wasm) { // Install the internal data structures into the isolate and expose on // the global object. WasmJs::Install(isolate, true); - } else if (FLAG_validate_asm) { + } else if (v8_flags.validate_asm) { // Install the internal data structures only; these are needed for asm.js // translated to Wasm to work correctly. WasmJs::Install(isolate, false); @@ -6051,21 +6174,22 @@ bool Genesis::InstallExtensions(Isolate* isolate, v8::ExtensionConfiguration* extensions) { ExtensionStates extension_states; // All extensions have state UNVISITED. return InstallAutoExtensions(isolate, &extension_states) && - (!FLAG_expose_gc || + (!v8_flags.expose_gc || InstallExtension(isolate, "v8/gc", &extension_states)) && - (!FLAG_expose_externalize_string || + (!v8_flags.expose_externalize_string || InstallExtension(isolate, "v8/externalize", &extension_states)) && - (!(FLAG_expose_statistics || TracingFlags::is_gc_stats_enabled()) || + (!(v8_flags.expose_statistics || + TracingFlags::is_gc_stats_enabled()) || InstallExtension(isolate, "v8/statistics", &extension_states)) && - (!FLAG_expose_trigger_failure || + (!v8_flags.expose_trigger_failure || InstallExtension(isolate, "v8/trigger-failure", &extension_states)) && - (!FLAG_expose_ignition_statistics || + (!v8_flags.expose_ignition_statistics || InstallExtension(isolate, "v8/ignition-statistics", &extension_states)) && (!isValidCpuTraceMarkFunctionName() || InstallExtension(isolate, "v8/cpumark", &extension_states)) && #ifdef ENABLE_VTUNE_TRACEMARK - (!FLAG_enable_vtune_domain_support || + (!v8_flags.enable_vtune_domain_support || InstallExtension(isolate, "v8/vtunedomain", &extension_states)) && #endif // ENABLE_VTUNE_TRACEMARK InstallRequestedExtensions(isolate, extensions, &extension_states); @@ -6465,7 +6589,7 @@ Genesis::Genesis( DCHECK(native_context().is_null()); base::ElapsedTimer timer; - if (FLAG_profile_deserialization) timer.Start(); + if (v8_flags.profile_deserialization) timer.Start(); DCHECK_EQ(0u, context_snapshot_index); // We get here if there was no context snapshot. CreateRoots(); @@ -6488,7 +6612,7 @@ Genesis::Genesis( if (!InstallExtrasBindings()) return; if (!ConfigureGlobalObject(global_proxy_template)) return; - if (FLAG_profile_deserialization) { + if (v8_flags.profile_deserialization) { double ms = timer.Elapsed().InMillisecondsF(); PrintF("[Initializing context from scratch took %0.3f ms]\n", ms); } @@ -6515,7 +6639,7 @@ Genesis::Genesis( string_function_prototype.map()); } - if (FLAG_disallow_code_generation_from_strings) { + if (v8_flags.disallow_code_generation_from_strings) { native_context()->set_allow_code_gen_from_strings( ReadOnlyRoots(isolate).false_value()); } diff --git a/deps/v8/src/init/heap-symbols.h b/deps/v8/src/init/heap-symbols.h index edc998f27e..7443a5c0e7 100644 --- a/deps/v8/src/init/heap-symbols.h +++ b/deps/v8/src/init/heap-symbols.h @@ -27,8 +27,10 @@ V(_, dateStyle_string, "dateStyle") \ V(_, dateTimeField_string, "dateTimeField") \ V(_, dayPeriod_string, "dayPeriod") \ + V(_, daysDisplay_string, "daysDisplay") \ V(_, decimal_string, "decimal") \ V(_, dialect_string, "dialect") \ + V(_, digital_string, "digital") \ V(_, direction_string, "direction") \ V(_, endRange_string, "endRange") \ V(_, engineering_string, "engineering") \ @@ -43,6 +45,7 @@ V(_, floor_string, "floor") \ V(_, format_string, "format") \ V(_, fraction_string, "fraction") \ + V(_, fractionalDigits_string, "fractionalDigits") \ V(_, fractionalSecond_string, "fractionalSecond") \ V(_, full_string, "full") \ V(_, granularity_string, "granularity") \ @@ -60,6 +63,7 @@ V(_, hour12_string, "hour12") \ V(_, hourCycle_string, "hourCycle") \ V(_, hourCycles_string, "hourCycles") \ + V(_, hoursDisplay_string, "hoursDisplay") \ V(_, ideo_string, "ideo") \ V(_, ignorePunctuation_string, "ignorePunctuation") \ V(_, Invalid_Date_string, "Invalid Date") \ @@ -78,6 +82,8 @@ V(_, ltr_string, "ltr") \ V(_, maximumFractionDigits_string, "maximumFractionDigits") \ V(_, maximumSignificantDigits_string, "maximumSignificantDigits") \ + V(_, microsecondsDisplay_string, "microsecondsDisplay") \ + V(_, millisecondsDisplay_string, "millisecondsDisplay") \ V(_, min2_string, "min2") \ V(_, minimalDays_string, "minimalDays") \ V(_, minimumFractionDigits_string, "minimumFractionDigits") \ @@ -85,8 +91,11 @@ V(_, minimumSignificantDigits_string, "minimumSignificantDigits") \ V(_, minus_0, "-0") \ V(_, minusSign_string, "minusSign") \ + V(_, minutesDisplay_string, "minutesDisplay") \ + V(_, monthsDisplay_string, "monthsDisplay") \ V(_, morePrecision_string, "morePrecision") \ V(_, nan_string, "nan") \ + V(_, nanosecondsDisplay_string, "nanosecondsDisplay") \ V(_, narrowSymbol_string, "narrowSymbol") \ V(_, negative_string, "negative") \ V(_, never_string, "never") \ @@ -106,6 +115,7 @@ V(_, roundingPriority_string, "roundingPriority") \ V(_, rtl_string, "rtl") \ V(_, scientific_string, "scientific") \ + V(_, secondsDisplay_string, "secondsDisplay") \ V(_, segment_string, "segment") \ V(_, SegmentIterator_string, "Segment Iterator") \ V(_, Segments_string, "Segments") \ @@ -125,6 +135,7 @@ V(_, timeZoneName_string, "timeZoneName") \ V(_, trailingZeroDisplay_string, "trailingZeroDisplay") \ V(_, trunc_string, "trunc") \ + V(_, two_digit_string, "2-digit") \ V(_, type_string, "type") \ V(_, unknown_string, "unknown") \ V(_, upper_string, "upper") \ @@ -133,8 +144,10 @@ V(_, unitDisplay_string, "unitDisplay") \ V(_, weekday_string, "weekday") \ V(_, weekend_string, "weekend") \ + V(_, weeksDisplay_string, "weeksDisplay") \ V(_, weekInfo_string, "weekInfo") \ - V(_, yearName_string, "yearName") + V(_, yearName_string, "yearName") \ + V(_, yearsDisplay_string, "yearsDisplay") #else // V8_INTL_SUPPORT #define INTERNALIZED_STRING_LIST_GENERATOR_INTL(V, _) #endif // V8_INTL_SUPPORT @@ -359,6 +372,7 @@ V(_, Proxy_string, "Proxy") \ V(_, query_colon_string, "(?:)") \ V(_, RangeError_string, "RangeError") \ + V(_, raw_json_string, "rawJSON") \ V(_, raw_string, "raw") \ V(_, ReferenceError_string, "ReferenceError") \ V(_, ReflectGet_string, "Reflect.get") \ @@ -528,6 +542,8 @@ F(MC_INCREMENTAL_START) \ F(MC_INCREMENTAL_SWEEPING) +#define MINOR_INCREMENTAL_SCOPES(F) F(MINOR_MC_INCREMENTAL_START) + #define TOP_MC_SCOPES(F) \ F(MC_CLEAR) \ F(MC_EPILOGUE) \ @@ -537,8 +553,16 @@ F(MC_PROLOGUE) \ F(MC_SWEEP) +#define TOP_MINOR_MC_SCOPES(F) \ + F(MINOR_MC_CLEAR) \ + F(MINOR_MC_EVACUATE) \ + F(MINOR_MC_FINISH) \ + F(MINOR_MC_MARK) \ + F(MINOR_MC_SWEEP) + #define TRACER_SCOPES(F) \ INCREMENTAL_SCOPES(F) \ + MINOR_INCREMENTAL_SCOPES(F) \ F(HEAP_EMBEDDER_TRACING_EPILOGUE) \ F(HEAP_EPILOGUE) \ F(HEAP_EPILOGUE_REDUCE_NEW_SPACE) \ @@ -580,8 +604,6 @@ F(MC_EVACUATE_UPDATE_POINTERS_SLOTS_MAIN) \ F(MC_EVACUATE_UPDATE_POINTERS_TO_NEW_ROOTS) \ F(MC_EVACUATE_UPDATE_POINTERS_WEAK) \ - F(MC_FINISH_SWEEP_NEW_LO) \ - F(MC_FINISH_SWEEP_NEW) \ F(MC_FINISH_SWEEP_ARRAY_BUFFERS) \ F(MC_MARK_CLIENT_HEAPS) \ F(MC_MARK_EMBEDDER_PROLOGUE) \ @@ -596,17 +618,18 @@ F(MC_MARK_WEAK_CLOSURE_EPHEMERON_LINEAR) \ F(MC_SWEEP_CODE) \ F(MC_SWEEP_CODE_LO) \ + F(MC_SWEEP_FINISH_NEW) \ F(MC_SWEEP_LO) \ F(MC_SWEEP_MAP) \ F(MC_SWEEP_NEW) \ + F(MC_SWEEP_NEW_LO) \ F(MC_SWEEP_OLD) \ + F(MC_SWEEP_SHARED) \ F(MINOR_MARK_COMPACTOR) \ F(MINOR_MC) \ - F(MINOR_MC_CLEAR) \ + TOP_MINOR_MC_SCOPES(F) \ F(MINOR_MC_CLEAR_STRING_TABLE) \ - F(MINOR_MC_CLEAR_WEAK_LISTS) \ F(MINOR_MC_COMPLETE_SWEEP_ARRAY_BUFFERS) \ - F(MINOR_MC_EVACUATE) \ F(MINOR_MC_EVACUATE_CLEAN_UP) \ F(MINOR_MC_EVACUATE_COPY) \ F(MINOR_MC_EVACUATE_COPY_PARALLEL) \ @@ -617,19 +640,17 @@ F(MINOR_MC_EVACUATE_UPDATE_POINTERS_PARALLEL) \ F(MINOR_MC_EVACUATE_UPDATE_POINTERS_SLOTS) \ F(MINOR_MC_EVACUATE_UPDATE_POINTERS_WEAK) \ - F(MINOR_MC_FINISH) \ F(MINOR_MC_FINISH_SWEEP_ARRAY_BUFFERS) \ - F(MINOR_MC_FINISH_SWEEP_NEW) \ - F(MINOR_MC_MARK) \ F(MINOR_MC_MARK_GLOBAL_HANDLES) \ + F(MINOR_MC_MARK_FINISH_INCREMENTAL) \ F(MINOR_MC_MARK_PARALLEL) \ F(MINOR_MC_MARK_SEED) \ F(MINOR_MC_MARK_ROOTS) \ - F(MINOR_MC_MARK_WEAK) \ - F(MINOR_MC_MARKING_DEQUE) \ - F(MINOR_MC_RESET_LIVENESS) \ - F(MINOR_MC_SWEEP) \ + F(MINOR_MC_MARK_CLOSURE_PARALLEL) \ + F(MINOR_MC_MARK_CLOSURE) \ F(MINOR_MC_SWEEP_NEW) \ + F(MINOR_MC_SWEEP_NEW_LO) \ + F(MINOR_MC_SWEEP_FINISH_NEW) \ F(SAFEPOINT) \ F(SCAVENGER) \ F(SCAVENGER_COMPLETE_SWEEP_ARRAY_BUFFERS) \ @@ -664,6 +685,7 @@ F(MINOR_MC_BACKGROUND_EVACUATE_COPY) \ F(MINOR_MC_BACKGROUND_EVACUATE_UPDATE_POINTERS) \ F(MINOR_MC_BACKGROUND_MARKING) \ + F(MINOR_MC_BACKGROUND_SWEEPING) \ F(SCAVENGER_BACKGROUND_SCAVENGE_PARALLEL) #define TRACER_YOUNG_EPOCH_SCOPES(F) \ @@ -673,6 +695,7 @@ F(MINOR_MC_BACKGROUND_EVACUATE_COPY) \ F(MINOR_MC_BACKGROUND_EVACUATE_UPDATE_POINTERS) \ F(MINOR_MC_BACKGROUND_MARKING) \ + F(MINOR_MC_BACKGROUND_SWEEPING) \ F(SCAVENGER) \ F(SCAVENGER_BACKGROUND_SCAVENGE_PARALLEL) \ F(SCAVENGER_COMPLETE_SWEEP_ARRAY_BUFFERS) diff --git a/deps/v8/src/init/v8.cc b/deps/v8/src/init/v8.cc index 13c2244df2..b6f68c6f17 100644 --- a/deps/v8/src/init/v8.cc +++ b/deps/v8/src/init/v8.cc @@ -99,7 +99,7 @@ void V8::InitializePlatform(v8::Platform* platform) { v8::base::SetPrintStackTrace(platform_->GetStackTracePrinter()); v8::tracing::TracingCategoryObserver::SetUp(); #if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING) - if (FLAG_enable_etw_stack_walking) { + if (v8_flags.enable_etw_stack_walking) { // TODO(sartang@microsoft.com): Move to platform specific diagnostics object v8::internal::ETWJITInterface::Register(); } @@ -114,10 +114,10 @@ void V8::InitializePlatform(v8::Platform* platform) { } #define DISABLE_FLAG(flag) \ - if (FLAG_##flag) { \ + if (v8_flags.flag) { \ PrintF(stderr, \ "Warning: disabling flag --" #flag " due to conflicting flags\n"); \ - FLAG_##flag = false; \ + v8_flags.flag = false; \ } void V8::Initialize() { @@ -125,52 +125,50 @@ void V8::Initialize() { CHECK(platform_); // Update logging information before enforcing flag implications. - FlagValue<bool>* log_all_flags[] = {&FLAG_log_all, - &FLAG_log_code, - &FLAG_log_code_disassemble, - &FLAG_log_source_code, - &FLAG_log_source_position, - &FLAG_log_feedback_vector, + FlagValue<bool>* log_all_flags[] = {&v8_flags.log_all, + &v8_flags.log_code, + &v8_flags.log_code_disassemble, + &v8_flags.log_source_code, + &v8_flags.log_source_position, + &v8_flags.log_feedback_vector, &v8_flags.log_function_events, - &FLAG_log_internal_timer_events, - &FLAG_log_deopt, - &FLAG_log_ic, - &FLAG_log_maps}; - if (FLAG_log_all) { + &v8_flags.log_internal_timer_events, + &v8_flags.log_deopt, + &v8_flags.log_ic, + &v8_flags.log_maps}; + if (v8_flags.log_all) { // Enable all logging flags for (auto* flag : log_all_flags) { *flag = true; } - FLAG_log = true; - } else if (!FLAG_log) { + v8_flags.log = true; + } else if (!v8_flags.log) { // Enable --log if any log flag is set. for (const auto* flag : log_all_flags) { if (!*flag) continue; - FLAG_log = true; + v8_flags.log = true; break; } // Profiling flags depend on logging. - FLAG_log = FLAG_log || FLAG_perf_prof || FLAG_perf_basic_prof || - FLAG_ll_prof || FLAG_prof || FLAG_prof_cpp || FLAG_gdbjit; -#if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING) - FLAG_log = FLAG_log || FLAG_enable_etw_stack_walking; -#endif + v8_flags.log = v8_flags.log || v8_flags.perf_prof || + v8_flags.perf_basic_prof || v8_flags.ll_prof || + v8_flags.prof || v8_flags.prof_cpp || v8_flags.gdbjit; } FlagList::EnforceFlagImplications(); - if (FLAG_predictable && FLAG_random_seed == 0) { + if (v8_flags.predictable && v8_flags.random_seed == 0) { // Avoid random seeds in predictable mode. - FLAG_random_seed = 12347; + v8_flags.random_seed = 12347; } - if (FLAG_stress_compaction) { - FLAG_force_marking_deque_overflows = true; - FLAG_gc_global = true; - FLAG_max_semi_space_size = 1; + if (v8_flags.stress_compaction) { + v8_flags.force_marking_deque_overflows = true; + v8_flags.gc_global = true; + v8_flags.max_semi_space_size = 1; } - if (FLAG_trace_turbo) { + if (v8_flags.trace_turbo) { // Create an empty file shared by the process (e.g. the wasm engine). std::ofstream(Isolate::GetTurboCfgFileName(nullptr).c_str(), std::ios_base::trunc); @@ -187,7 +185,7 @@ void V8::Initialize() { // TODO(jgruber): Remove this once / if wasm can run without executable // memory. #if V8_ENABLE_WEBASSEMBLY - if (FLAG_jitless && !FLAG_correctness_fuzzer_suppressions) { + if (v8_flags.jitless && !v8_flags.correctness_fuzzer_suppressions) { DISABLE_FLAG(expose_wasm); } #endif @@ -197,7 +195,7 @@ void V8::Initialize() { // leads to false positives on TSAN bots. // TODO(chromium:1205289): Teach relevant fuzzers to not pass TF tracing // flags instead, and remove this section. - if (FLAG_fuzzing && FLAG_concurrent_recompilation) { + if (v8_flags.fuzzing && v8_flags.concurrent_recompilation) { DISABLE_FLAG(trace_turbo); DISABLE_FLAG(trace_turbo_graph); DISABLE_FLAG(trace_turbo_scheduled); @@ -215,16 +213,16 @@ void V8::Initialize() { // The --jitless and --interpreted-frames-native-stack flags are incompatible // since the latter requires code generation while the former prohibits code // generation. - CHECK(!FLAG_interpreted_frames_native_stack || !FLAG_jitless); + CHECK(!v8_flags.interpreted_frames_native_stack || !v8_flags.jitless); - base::OS::Initialize(FLAG_hard_abort, FLAG_gc_fake_mmap); + base::OS::Initialize(v8_flags.hard_abort, v8_flags.gc_fake_mmap); - if (FLAG_random_seed) { - GetPlatformPageAllocator()->SetRandomMmapSeed(FLAG_random_seed); - GetPlatformVirtualAddressSpace()->SetRandomSeed(FLAG_random_seed); + if (v8_flags.random_seed) { + GetPlatformPageAllocator()->SetRandomMmapSeed(v8_flags.random_seed); + GetPlatformVirtualAddressSpace()->SetRandomSeed(v8_flags.random_seed); } - if (FLAG_print_flag_values) FlagList::PrintValues(); + if (v8_flags.print_flag_values) FlagList::PrintValues(); // Initialize the default FlagList::Hash. FlagList::Hash(); @@ -232,7 +230,7 @@ void V8::Initialize() { // Before initializing internals, freeze the flags such that further changes // are not allowed. Global initialization of the Isolate or the WasmEngine // already reads flags, so they should not be changed afterwards. - if (FLAG_freeze_flags_after_init) FlagList::FreezeFlags(); + if (v8_flags.freeze_flags_after_init) FlagList::FreezeFlags(); #if defined(V8_ENABLE_SANDBOX) // If enabled, the sandbox must be initialized first. @@ -291,7 +289,7 @@ void V8::DisposePlatform() { AdvanceStartupState(V8StartupState::kPlatformDisposing); CHECK(platform_); #if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING) - if (FLAG_enable_etw_stack_walking) { + if (v8_flags.enable_etw_stack_walking) { v8::internal::ETWJITInterface::Unregister(); } #endif |