[sfi] Replace start/end position with UncompiledData

Add new types for function data for SharedFunctionInfo, for uncompiled
functions. UncompiledData holds start/end positions, allowing us to
remove these fields from SFI. Uncompiled functions with pre-parsed
scope data now hold an UncompiledDataWithScope that has a pointer to
PreParsedScopeData -- this allows us to also remove the start/end pos
from PreParsedScopeData.

Bug: chromium:818642
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I56f3c4e62cbf38929babac734a332709f12a8202
Reviewed-on: https://chromium-review.googlesource.com/1126381
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54319}
This commit is contained in:
Leszek Swirski 2018-07-09 10:34:34 +01:00 committed by Commit Bot
parent 43744b9670
commit 39e2d97bc4
30 changed files with 807 additions and 453 deletions

View File

@ -742,6 +742,33 @@ StartupData SnapshotCreator::CreateBlob(
isolate->heap()->read_only_space()->ClearStringPaddingIfNeeded();
if (function_code_handling == FunctionCodeHandling::kClear) {
// Clear out re-compilable data from all shared function infos. Any
// JSFunctions using these SFIs will have their code pointers reset by the
// partial serializer.
//
// We have to iterate the heap and collect handles to each clearable SFI,
// before we disable allocation, since we have to allocate UncompiledDatas
// to be able to recompile them.
i::HandleScope scope(isolate);
std::vector<i::Handle<i::SharedFunctionInfo>> sfis_to_clear;
i::HeapIterator heap_iterator(isolate->heap());
while (i::HeapObject* current_obj = heap_iterator.next()) {
if (current_obj->IsSharedFunctionInfo()) {
i::SharedFunctionInfo* shared =
i::SharedFunctionInfo::cast(current_obj);
if (shared->CanDiscardCompiled()) {
sfis_to_clear.emplace_back(shared, isolate);
}
}
}
i::AllowHeapAllocation allocate_for_discard;
for (i::Handle<i::SharedFunctionInfo> shared : sfis_to_clear) {
i::SharedFunctionInfo::DiscardCompiled(isolate, shared);
}
}
i::DisallowHeapAllocation no_gc_from_here_on;
int num_contexts = num_additional_contexts + 1;
@ -778,19 +805,12 @@ StartupData SnapshotCreator::CreateBlob(
i::ReadOnlyRoots(isolate).undefined_value());
fun->set_code(isolate->builtins()->builtin(i::Builtins::kCompileLazy));
}
}
// Clear out re-compilable data from all shared function infos. Any
// JSFunctions using these SFIs will have their code pointers reset by the
// partial serializer.
if (current_obj->IsSharedFunctionInfo() &&
function_code_handling == FunctionCodeHandling::kClear) {
i::SharedFunctionInfo* shared = i::SharedFunctionInfo::cast(current_obj);
if (shared->CanFlushCompiled()) {
shared->FlushCompiled();
if (function_code_handling == FunctionCodeHandling::kClear) {
DCHECK(fun->shared()->HasWasmExportedFunctionData() ||
fun->shared()->HasBuiltinId() ||
fun->shared()->IsApiFunction() ||
fun->shared()->HasUncompiledDataWithoutPreParsedScope());
}
DCHECK(shared->HasWasmExportedFunctionData() || shared->HasBuiltinId() ||
shared->IsApiFunction());
}
}

View File

@ -617,9 +617,6 @@ Handle<JSFunction> Genesis::CreateEmptyFunction() {
script->set_type(Script::TYPE_NATIVE);
Handle<WeakFixedArray> infos = factory()->NewWeakFixedArray(2);
script->set_shared_function_infos(*infos);
// TODO(cbruni): fix position information here.
empty_function->shared()->set_raw_start_position(0);
empty_function->shared()->set_raw_end_position(source->length());
empty_function->shared()->set_scope_info(*scope_info);
empty_function->shared()->set_function_literal_id(1);
empty_function->shared()->DontAdaptArguments();

View File

@ -11983,18 +11983,24 @@ TNode<Code> CodeStubAssembler::GetSharedFunctionInfoCode(
TNode<Int32T> data_type = LoadInstanceType(CAST(sfi_data));
int32_t case_values[] = {BYTECODE_ARRAY_TYPE,
WASM_EXPORTED_FUNCTION_DATA_TYPE, FIXED_ARRAY_TYPE,
TUPLE2_TYPE, FUNCTION_TEMPLATE_INFO_TYPE};
WASM_EXPORTED_FUNCTION_DATA_TYPE,
FIXED_ARRAY_TYPE,
UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE,
UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE,
FUNCTION_TEMPLATE_INFO_TYPE};
Label check_is_bytecode_array(this);
Label check_is_exported_function_data(this);
Label check_is_fixed_array(this);
Label check_is_pre_parsed_scope_data(this);
Label check_is_uncompiled_data_without_pre_parsed_scope(this);
Label check_is_uncompiled_data_with_pre_parsed_scope(this);
Label check_is_function_template_info(this);
Label check_is_interpreter_data(this);
Label* case_labels[] = {
&check_is_bytecode_array, &check_is_exported_function_data,
&check_is_fixed_array, &check_is_pre_parsed_scope_data,
&check_is_function_template_info};
Label* case_labels[] = {&check_is_bytecode_array,
&check_is_exported_function_data,
&check_is_fixed_array,
&check_is_uncompiled_data_without_pre_parsed_scope,
&check_is_uncompiled_data_with_pre_parsed_scope,
&check_is_function_template_info};
STATIC_ASSERT(arraysize(case_values) == arraysize(case_labels));
Switch(data_type, &check_is_interpreter_data, case_values, case_labels,
arraysize(case_labels));
@ -12017,8 +12023,11 @@ TNode<Code> CodeStubAssembler::GetSharedFunctionInfoCode(
sfi_code = HeapConstant(BUILTIN_CODE(isolate(), InstantiateAsmJs));
Goto(&done);
// IsPreParsedScopeData: Compile lazy
BIND(&check_is_pre_parsed_scope_data);
// IsUncompiledDataWithPreParsedScope | IsUncompiledDataWithoutPreParsedScope:
// Compile lazy
BIND(&check_is_uncompiled_data_with_pre_parsed_scope);
Goto(&check_is_uncompiled_data_without_pre_parsed_scope);
BIND(&check_is_uncompiled_data_without_pre_parsed_scope);
DCHECK(!Builtins::IsLazy(Builtins::kCompileLazy));
sfi_code = HeapConstant(BUILTIN_CODE(isolate(), CompileLazy));
Goto(if_compile_lazy ? if_compile_lazy : &done);

View File

@ -77,6 +77,12 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
V(Tuple3Map, tuple3_map, Tuple3Map) \
V(ArrayBoilerplateDescriptionMap, array_boilerplate_description_map, \
ArrayBoilerplateDescriptionMap) \
V(UncompiledDataWithoutPreParsedScopeMap, \
uncompiled_data_without_pre_parsed_scope_map, \
UncompiledDataWithoutPreParsedScopeMap) \
V(UncompiledDataWithPreParsedScopeMap, \
uncompiled_data_with_pre_parsed_scope_map, \
UncompiledDataWithPreParsedScopeMap) \
V(UndefinedValue, undefined_value, Undefined) \
V(WeakCellMap, weak_cell_map, WeakCellMap) \
V(WeakFixedArrayMap, weak_fixed_array_map, WeakFixedArrayMap)

View File

@ -1087,14 +1087,11 @@ bool Compiler::Compile(Handle<SharedFunctionInfo> shared_info,
}
if (FLAG_preparser_scope_analysis) {
if (shared_info->HasPreParsedScopeData()) {
Handle<PreParsedScopeData> data(
PreParsedScopeData::cast(shared_info->preparsed_scope_data()),
isolate);
parse_info.consumed_preparsed_scope_data()->SetData(isolate, data);
// After we've compiled the function, we don't need data about its
// skippable functions any more.
shared_info->ClearPreParsedScopeData();
if (shared_info->HasUncompiledDataWithPreParsedScope()) {
parse_info.consumed_preparsed_scope_data()->SetData(
isolate, handle(shared_info->uncompiled_data_with_pre_parsed_scope()
->pre_parsed_scope_data(),
isolate));
}
}

View File

@ -295,6 +295,8 @@ Type::bitset BitsetType::Lub(HeapObjectType const& type) {
case MODULE_TYPE:
case MODULE_INFO_ENTRY_TYPE:
case CELL_TYPE:
case UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE:
case UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE:
return kOtherInternal;
// Remaining instance types are unsupported for now. If any of them do

View File

@ -974,13 +974,9 @@ void UpdatePositions(Isolate* isolate, Handle<SharedFunctionInfo> sfi,
int new_end_position = LiveEdit::TranslatePosition(diffs, sfi->EndPosition());
int new_function_token_position =
LiveEdit::TranslatePosition(diffs, sfi->function_token_position());
sfi->set_raw_start_position(new_start_position);
sfi->set_raw_end_position(new_end_position);
if (sfi->scope_info()->HasPositionInfo()) {
sfi->scope_info()->SetPositionInfo(new_start_position, new_end_position);
}
sfi->SetFunctionTokenPosition(new_function_token_position);
sfi->SetPosition(new_start_position, new_end_position);
sfi->SetFunctionTokenPosition(new_function_token_position,
new_start_position);
if (sfi->HasBytecodeArray()) {
TranslateSourcePositionTable(handle(sfi->GetBytecodeArray(), isolate),
diffs);
@ -1066,7 +1062,9 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script,
new_script_sfis->Set(mapping.second->function_literal_id(),
HeapObjectReference::Weak(*sfi));
if (sfi->HasPreParsedScopeData()) sfi->ClearPreParsedScopeData();
if (sfi->HasUncompiledDataWithPreParsedScope()) {
sfi->ClearPreParsedScopeData();
}
for (auto& js_function : data->js_functions) {
js_function->set_feedback_cell(*isolate->factory()->many_closures_cell());

View File

@ -2495,6 +2495,32 @@ Handle<PreParsedScopeData> Factory::NewPreParsedScopeData() {
return result;
}
Handle<UncompiledDataWithoutPreParsedScope>
Factory::NewUncompiledDataWithoutPreParsedScope(int32_t start_position,
int32_t end_position) {
Handle<UncompiledDataWithoutPreParsedScope> result(
UncompiledDataWithoutPreParsedScope::cast(
New(uncompiled_data_without_pre_parsed_scope_map(), TENURED)),
isolate());
result->set_start_position(start_position);
result->set_end_position(end_position);
return result;
}
Handle<UncompiledDataWithPreParsedScope>
Factory::NewUncompiledDataWithPreParsedScope(
int32_t start_position, int32_t end_position,
Handle<PreParsedScopeData> pre_parsed_scope_data) {
Handle<UncompiledDataWithPreParsedScope> result(
UncompiledDataWithPreParsedScope::cast(
New(uncompiled_data_with_pre_parsed_scope_map(), TENURED)),
isolate());
result->set_start_position(start_position);
result->set_end_position(end_position);
result->set_pre_parsed_scope_data(*pre_parsed_scope_data);
return result;
}
Handle<JSObject> Factory::NewExternal(void* value) {
Handle<Foreign> foreign = NewForeign(reinterpret_cast<Address>(value));
Handle<JSObject> external = NewJSObjectFromMap(external_map());
@ -3470,8 +3496,6 @@ Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
share->set_length(0);
share->set_internal_formal_parameter_count(0);
share->set_expected_nof_properties(0);
share->set_raw_start_position_and_type(0);
share->set_raw_end_position(0);
share->set_raw_function_token_offset(0);
// All flags default to false or 0.
share->set_flags(0);

View File

@ -51,6 +51,8 @@ class RegExpMatchInfo;
class ScriptContextTable;
class StoreHandler;
class TemplateObjectDescription;
class UncompiledDataWithoutPreParsedScope;
class UncompiledDataWithPreParsedScope;
class WasmExportedFunctionData;
struct SourceRange;
template <typename T>
@ -717,6 +719,13 @@ class V8_EXPORT_PRIVATE Factory {
Handle<PreParsedScopeData> NewPreParsedScopeData();
Handle<UncompiledDataWithoutPreParsedScope>
NewUncompiledDataWithoutPreParsedScope(int32_t start_position,
int32_t end_position);
Handle<UncompiledDataWithPreParsedScope> NewUncompiledDataWithPreParsedScope(
int32_t start_position, int32_t end_position, Handle<PreParsedScopeData>);
// Create an External object for V8's external API.
Handle<JSObject> NewExternal(void* value);

View File

@ -52,115 +52,117 @@ using v8::MemoryPressureLevel;
// Heap roots that are known to be immortal immovable, for which we can safely
// skip write barriers. This list is not complete and has omissions.
#define IMMORTAL_IMMOVABLE_ROOT_LIST(V) \
V(ArgumentsMarker) \
V(ArgumentsMarkerMap) \
V(ArrayBufferNeuteringProtector) \
V(ArrayIteratorProtector) \
V(BigIntMap) \
V(BlockContextMap) \
V(ObjectBoilerplateDescriptionMap) \
V(BooleanMap) \
V(ByteArrayMap) \
V(BytecodeArrayMap) \
V(CatchContextMap) \
V(CellMap) \
V(CodeMap) \
V(DebugEvaluateContextMap) \
V(DescriptorArrayMap) \
V(EphemeronHashTableMap) \
V(EmptyByteArray) \
V(EmptyDescriptorArray) \
V(EmptyFixedArray) \
V(EmptyFixedFloat32Array) \
V(EmptyFixedFloat64Array) \
V(EmptyFixedInt16Array) \
V(EmptyFixedInt32Array) \
V(EmptyFixedInt8Array) \
V(EmptyFixedUint16Array) \
V(EmptyFixedUint32Array) \
V(EmptyFixedUint8Array) \
V(EmptyFixedUint8ClampedArray) \
V(EmptyOrderedHashMap) \
V(EmptyOrderedHashSet) \
V(EmptyPropertyCell) \
V(EmptyScopeInfo) \
V(EmptyScript) \
V(EmptySloppyArgumentsElements) \
V(EmptySlowElementDictionary) \
V(EmptyWeakCell) \
V(EvalContextMap) \
V(Exception) \
V(FalseValue) \
V(FixedArrayMap) \
V(FixedCOWArrayMap) \
V(FixedDoubleArrayMap) \
V(ForeignMap) \
V(FreeSpaceMap) \
V(FunctionContextMap) \
V(GlobalDictionaryMap) \
V(GlobalPropertyCellMap) \
V(HashTableMap) \
V(HeapNumberMap) \
V(HoleNanValue) \
V(InfinityValue) \
V(IsConcatSpreadableProtector) \
V(JSMessageObjectMap) \
V(JsConstructEntryCode) \
V(JsEntryCode) \
V(ManyClosuresCell) \
V(ManyClosuresCellMap) \
V(MetaMap) \
V(MinusInfinityValue) \
V(MinusZeroValue) \
V(ModuleContextMap) \
V(ModuleInfoMap) \
V(MutableHeapNumberMap) \
V(NameDictionaryMap) \
V(NanValue) \
V(NativeContextMap) \
V(NoClosuresCellMap) \
V(NoElementsProtector) \
V(NullMap) \
V(NullValue) \
V(NumberDictionaryMap) \
V(OneClosureCellMap) \
V(OnePointerFillerMap) \
V(OptimizedOut) \
V(OrderedHashMapMap) \
V(OrderedHashSetMap) \
V(PropertyArrayMap) \
V(ScopeInfoMap) \
V(ScriptContextMap) \
V(ScriptContextTableMap) \
V(SelfReferenceMarker) \
V(SharedFunctionInfoMap) \
V(SimpleNumberDictionaryMap) \
V(SloppyArgumentsElementsMap) \
V(SmallOrderedHashMapMap) \
V(SmallOrderedHashSetMap) \
V(ArraySpeciesProtector) \
V(TypedArraySpeciesProtector) \
V(PromiseSpeciesProtector) \
V(StaleRegister) \
V(StringLengthProtector) \
V(StringTableMap) \
V(SymbolMap) \
V(TerminationException) \
V(TheHoleMap) \
V(TheHoleValue) \
V(TransitionArrayMap) \
V(TrueValue) \
V(TwoPointerFillerMap) \
V(UndefinedMap) \
V(UndefinedValue) \
V(UninitializedMap) \
V(UninitializedValue) \
V(WeakCellMap) \
V(WeakFixedArrayMap) \
V(WeakArrayListMap) \
V(WithContextMap) \
V(empty_string) \
#define IMMORTAL_IMMOVABLE_ROOT_LIST(V) \
V(ArgumentsMarker) \
V(ArgumentsMarkerMap) \
V(ArrayBufferNeuteringProtector) \
V(ArrayIteratorProtector) \
V(BigIntMap) \
V(BlockContextMap) \
V(ObjectBoilerplateDescriptionMap) \
V(BooleanMap) \
V(ByteArrayMap) \
V(BytecodeArrayMap) \
V(CatchContextMap) \
V(CellMap) \
V(CodeMap) \
V(DebugEvaluateContextMap) \
V(DescriptorArrayMap) \
V(EphemeronHashTableMap) \
V(EmptyByteArray) \
V(EmptyDescriptorArray) \
V(EmptyFixedArray) \
V(EmptyFixedFloat32Array) \
V(EmptyFixedFloat64Array) \
V(EmptyFixedInt16Array) \
V(EmptyFixedInt32Array) \
V(EmptyFixedInt8Array) \
V(EmptyFixedUint16Array) \
V(EmptyFixedUint32Array) \
V(EmptyFixedUint8Array) \
V(EmptyFixedUint8ClampedArray) \
V(EmptyOrderedHashMap) \
V(EmptyOrderedHashSet) \
V(EmptyPropertyCell) \
V(EmptyScopeInfo) \
V(EmptyScript) \
V(EmptySloppyArgumentsElements) \
V(EmptySlowElementDictionary) \
V(EmptyWeakCell) \
V(EvalContextMap) \
V(Exception) \
V(FalseValue) \
V(FixedArrayMap) \
V(FixedCOWArrayMap) \
V(FixedDoubleArrayMap) \
V(ForeignMap) \
V(FreeSpaceMap) \
V(FunctionContextMap) \
V(GlobalDictionaryMap) \
V(GlobalPropertyCellMap) \
V(HashTableMap) \
V(HeapNumberMap) \
V(HoleNanValue) \
V(InfinityValue) \
V(IsConcatSpreadableProtector) \
V(JSMessageObjectMap) \
V(JsConstructEntryCode) \
V(JsEntryCode) \
V(ManyClosuresCell) \
V(ManyClosuresCellMap) \
V(MetaMap) \
V(MinusInfinityValue) \
V(MinusZeroValue) \
V(ModuleContextMap) \
V(ModuleInfoMap) \
V(MutableHeapNumberMap) \
V(NameDictionaryMap) \
V(NanValue) \
V(NativeContextMap) \
V(NoClosuresCellMap) \
V(NoElementsProtector) \
V(NullMap) \
V(NullValue) \
V(NumberDictionaryMap) \
V(OneClosureCellMap) \
V(OnePointerFillerMap) \
V(OptimizedOut) \
V(OrderedHashMapMap) \
V(OrderedHashSetMap) \
V(PropertyArrayMap) \
V(ScopeInfoMap) \
V(ScriptContextMap) \
V(ScriptContextTableMap) \
V(SelfReferenceMarker) \
V(SharedFunctionInfoMap) \
V(SimpleNumberDictionaryMap) \
V(SloppyArgumentsElementsMap) \
V(SmallOrderedHashMapMap) \
V(SmallOrderedHashSetMap) \
V(ArraySpeciesProtector) \
V(TypedArraySpeciesProtector) \
V(PromiseSpeciesProtector) \
V(StaleRegister) \
V(StringLengthProtector) \
V(StringTableMap) \
V(SymbolMap) \
V(TerminationException) \
V(TheHoleMap) \
V(TheHoleValue) \
V(TransitionArrayMap) \
V(TrueValue) \
V(TwoPointerFillerMap) \
V(UndefinedMap) \
V(UndefinedValue) \
V(UninitializedMap) \
V(UninitializedValue) \
V(UncompiledDataWithoutPreParsedScopeMap) \
V(UncompiledDataWithPreParsedScopeMap) \
V(WeakCellMap) \
V(WeakFixedArrayMap) \
V(WeakArrayListMap) \
V(WithContextMap) \
V(empty_string) \
PRIVATE_SYMBOL_LIST(V)
#define FIXED_ARRAY_ELEMENTS_WRITE_BARRIER(heap, array, start, length) \

View File

@ -23,43 +23,45 @@ class DataHandler;
class JSArrayBuffer;
class JSRegExp;
class JSWeakCollection;
class UncompiledDataWithPreParsedScope;
#define TYPED_VISITOR_ID_LIST(V) \
V(AllocationSite) \
V(BigInt) \
V(ByteArray) \
V(BytecodeArray) \
V(Cell) \
V(Code) \
V(CodeDataContainer) \
V(ConsString) \
V(DataHandler) \
V(EphemeronHashTable) \
V(FeedbackCell) \
V(FeedbackVector) \
V(FixedArray) \
V(FixedDoubleArray) \
V(FixedFloat64Array) \
V(FixedTypedArrayBase) \
V(JSArrayBuffer) \
V(JSFunction) \
V(JSObject) \
V(JSWeakCollection) \
V(Map) \
V(Oddball) \
V(PropertyArray) \
V(PropertyCell) \
V(PrototypeInfo) \
V(SeqOneByteString) \
V(SeqTwoByteString) \
V(SharedFunctionInfo) \
V(SlicedString) \
V(SmallOrderedHashMap) \
V(SmallOrderedHashSet) \
V(Symbol) \
V(ThinString) \
V(TransitionArray) \
V(WasmInstanceObject) \
#define TYPED_VISITOR_ID_LIST(V) \
V(AllocationSite) \
V(BigInt) \
V(ByteArray) \
V(BytecodeArray) \
V(Cell) \
V(Code) \
V(CodeDataContainer) \
V(ConsString) \
V(DataHandler) \
V(EphemeronHashTable) \
V(FeedbackCell) \
V(FeedbackVector) \
V(FixedArray) \
V(FixedDoubleArray) \
V(FixedFloat64Array) \
V(FixedTypedArrayBase) \
V(JSArrayBuffer) \
V(JSFunction) \
V(JSObject) \
V(JSWeakCollection) \
V(Map) \
V(Oddball) \
V(PropertyArray) \
V(PropertyCell) \
V(PrototypeInfo) \
V(SeqOneByteString) \
V(SeqTwoByteString) \
V(SharedFunctionInfo) \
V(SlicedString) \
V(SmallOrderedHashMap) \
V(SmallOrderedHashSet) \
V(Symbol) \
V(ThinString) \
V(TransitionArray) \
V(UncompiledDataWithPreParsedScope) \
V(WasmInstanceObject) \
V(WeakCell)
// The base class for visitors that need to dispatch on object type. The default

View File

@ -498,6 +498,12 @@ bool Heap::CreateInitialMaps() {
ALLOCATE_MAP(CALL_HANDLER_INFO_TYPE, CallHandlerInfo::kSize,
next_call_side_effect_free_call_handler_info)
ALLOCATE_MAP(UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE,
UncompiledDataWithoutPreParsedScope::kSize,
uncompiled_data_without_pre_parsed_scope)
ALLOCATE_MAP(UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE,
UncompiledDataWithPreParsedScope::kSize,
uncompiled_data_with_pre_parsed_scope)
ALLOCATE_MAP(SHARED_FUNCTION_INFO_TYPE, SharedFunctionInfo::kAlignedSize,
shared_function_info)

View File

@ -760,12 +760,16 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3, T4 p4) {
case CODE_DATA_CONTAINER_TYPE:
return Op::template apply<CodeDataContainer::BodyDescriptor>(p1, p2, p3,
p4);
case UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE:
return Op::template apply<
UncompiledDataWithPreParsedScope::BodyDescriptor>(p1, p2, p3, p4);
case HEAP_NUMBER_TYPE:
case MUTABLE_HEAP_NUMBER_TYPE:
case FILLER_TYPE:
case BYTE_ARRAY_TYPE:
case FREE_SPACE_TYPE:
case BIGINT_TYPE:
case UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE:
return ReturnType();
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \

View File

@ -318,6 +318,14 @@ void HeapObject::HeapObjectVerify(Isolate* isolate) {
case FOREIGN_TYPE:
Foreign::cast(this)->ForeignVerify(isolate);
break;
case UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE:
UncompiledDataWithoutPreParsedScope::cast(this)
->UncompiledDataWithoutPreParsedScopeVerify(isolate);
break;
case UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE:
UncompiledDataWithPreParsedScope::cast(this)
->UncompiledDataWithPreParsedScopeVerify(isolate);
break;
case SHARED_FUNCTION_INFO_TYPE:
SharedFunctionInfo::cast(this)->SharedFunctionInfoVerify(isolate);
break;
@ -948,7 +956,8 @@ void SharedFunctionInfo::SharedFunctionInfoVerify(Isolate* isolate) {
CHECK(HasWasmExportedFunctionData() || IsApiFunction() ||
HasBytecodeArray() || HasAsmWasmData() || HasBuiltinId() ||
HasPreParsedScopeData());
HasUncompiledDataWithPreParsedScope() ||
HasUncompiledDataWithoutPreParsedScope());
CHECK(function_identifier_or_debug_info()->IsUndefined(isolate) ||
HasBuiltinFunctionId() || HasInferredName() || HasDebugInfo());
@ -970,8 +979,6 @@ void SharedFunctionInfo::SharedFunctionInfoVerify(Isolate* isolate) {
ScopeInfo* info = scope_info();
CHECK(kind() == info->function_kind());
CHECK_EQ(kind() == kModule, info->scope_type() == MODULE_SCOPE);
CHECK_EQ(raw_start_position(), info->StartPosition());
CHECK_EQ(raw_end_position(), info->EndPosition());
}
if (IsApiFunction()) {
@ -1779,6 +1786,17 @@ void PreParsedScopeData::PreParsedScopeDataVerify(Isolate* isolate) {
CHECK(child_data()->IsFixedArray());
}
void UncompiledDataWithPreParsedScope::UncompiledDataWithPreParsedScopeVerify(
Isolate* isolate) {
CHECK(IsUncompiledDataWithPreParsedScope());
VerifyPointer(pre_parsed_scope_data());
}
void UncompiledDataWithoutPreParsedScope::
UncompiledDataWithoutPreParsedScopeVerify(Isolate* isolate) {
CHECK(IsUncompiledDataWithoutPreParsedScope());
}
void InterpreterData::InterpreterDataVerify(Isolate* isolate) {
CHECK(IsInterpreterData());
CHECK(bytecode_array()->IsBytecodeArray());

View File

@ -163,6 +163,8 @@ namespace internal {
V(SMALL_ORDERED_HASH_MAP_TYPE) \
V(SMALL_ORDERED_HASH_SET_TYPE) \
V(STORE_HANDLER_TYPE) \
V(UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE) \
V(UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE) \
V(WEAK_CELL_TYPE) \
V(WEAK_ARRAY_LIST_TYPE) \
\

View File

@ -146,6 +146,10 @@ TYPE_CHECKER(StringTable, STRING_TABLE_TYPE)
TYPE_CHECKER(Symbol, SYMBOL_TYPE)
TYPE_CHECKER(TemplateObjectDescription, TUPLE2_TYPE)
TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE)
TYPE_CHECKER(UncompiledDataWithoutPreParsedScope,
UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE)
TYPE_CHECKER(UncompiledDataWithPreParsedScope,
UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE)
TYPE_CHECKER(WasmGlobalObject, WASM_GLOBAL_TYPE)
TYPE_CHECKER(WasmInstanceObject, WASM_INSTANCE_TYPE)
TYPE_CHECKER(WasmMemoryObject, WASM_MEMORY_TYPE)
@ -163,6 +167,10 @@ TYPE_CHECKER(JSLocale, JS_INTL_LOCALE_TYPE)
TYPED_ARRAYS(TYPED_ARRAY_TYPE_CHECKER)
#undef TYPED_ARRAY_TYPE_CHECKER
bool HeapObject::IsUncompiledData() const {
return IsUncompiledDataWithoutPreParsedScope() ||
IsUncompiledDataWithPreParsedScope();
}
bool HeapObject::IsFixedArrayBase() const {
return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase();

View File

@ -262,6 +262,14 @@ void HeapObject::HeapObjectPrint(Isolate* isolate,
case CALL_HANDLER_INFO_TYPE:
CallHandlerInfo::cast(this)->CallHandlerInfoPrint(os);
break;
case UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE:
UncompiledDataWithoutPreParsedScope::cast(this)
->UncompiledDataWithoutPreParsedScopePrint(os);
break;
case UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE:
UncompiledDataWithPreParsedScope::cast(this)
->UncompiledDataWithPreParsedScopePrint(os);
break;
case SHARED_FUNCTION_INFO_TYPE:
SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(os);
break;
@ -2106,6 +2114,23 @@ void PreParsedScopeData::PreParsedScopeDataPrint(std::ostream& os) { // NOLINT
os << "\n";
}
void UncompiledDataWithoutPreParsedScope::
UncompiledDataWithoutPreParsedScopePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "UncompiledDataWithoutPreParsedScope");
os << "\n - start position: " << start_position();
os << "\n - end position: " << end_position();
os << "\n";
}
void UncompiledDataWithPreParsedScope::UncompiledDataWithPreParsedScopePrint(
std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "UncompiledDataWithPreParsedScope");
os << "\n - start position: " << start_position();
os << "\n - end position: " << end_position();
os << "\n - pre_parsed_scope_data: " << Brief(pre_parsed_scope_data());
os << "\n";
}
void InterpreterData::InterpreterDataPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "InterpreterData");
os << "\n - bytecode_array: " << Brief(bytecode_array());

View File

@ -3094,6 +3094,9 @@ VisitorId Map::GetVisitorId(Map* map) {
case WASM_INSTANCE_TYPE:
return kVisitWasmInstanceObject;
case UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE:
return kVisitUncompiledDataWithPreParsedScope;
case JS_OBJECT_TYPE:
case JS_ERROR_TYPE:
case JS_ARGUMENTS_TYPE:
@ -3143,6 +3146,7 @@ VisitorId Map::GetVisitorId(Map* map) {
case HEAP_NUMBER_TYPE:
case MUTABLE_HEAP_NUMBER_TYPE:
case FEEDBACK_METADATA_TYPE:
case UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE:
return kVisitDataObject;
case BIGINT_TYPE:
@ -3428,6 +3432,23 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
TYPED_ARRAYS(TYPED_ARRAY_SHORT_PRINT)
#undef TYPED_ARRAY_SHORT_PRINT
case UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE: {
UncompiledDataWithoutPreParsedScope* data =
UncompiledDataWithoutPreParsedScope::cast(this);
os << "<UncompiledDataWithoutPreParsedScope (" << data->start_position()
<< ", " << data->end_position() << ")]>";
break;
}
case UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE: {
UncompiledDataWithPreParsedScope* data =
UncompiledDataWithPreParsedScope::cast(this);
os << "<UncompiledDataWithPreParsedScope (" << data->start_position()
<< ", " << data->end_position()
<< ") preparsed=" << Brief(data->pre_parsed_scope_data()) << ">";
break;
}
case SHARED_FUNCTION_INFO_TYPE: {
SharedFunctionInfo* shared = SharedFunctionInfo::cast(this);
std::unique_ptr<char[]> debug_name = shared->DebugName()->ToCString();
@ -13695,7 +13716,8 @@ void SharedFunctionInfo::SetScript(Handle<SharedFunctionInfo> shared,
if (shared->script() == *script_object) return;
Isolate* isolate = shared->GetIsolate();
if (reset_preparsed_scope_data && shared->HasPreParsedScopeData()) {
if (reset_preparsed_scope_data &&
shared->HasUncompiledDataWithPreParsedScope()) {
shared->ClearPreParsedScopeData();
}
@ -13981,15 +14003,18 @@ void SharedFunctionInfo::DisableOptimization(BailoutReason reason) {
void SharedFunctionInfo::InitFromFunctionLiteral(
Handle<SharedFunctionInfo> shared_info, FunctionLiteral* lit,
bool is_toplevel) {
Isolate* isolate = shared_info->GetIsolate();
bool needs_position_info = true;
// When adding fields here, make sure DeclarationScope::AnalyzePartially is
// updated accordingly.
shared_info->set_internal_formal_parameter_count(lit->parameter_count());
shared_info->set_raw_start_position(lit->start_position());
shared_info->set_raw_end_position(lit->end_position());
shared_info->SetFunctionTokenPosition(lit->function_token_position());
shared_info->SetFunctionTokenPosition(lit->function_token_position(),
lit->start_position());
if (shared_info->scope_info()->HasPositionInfo()) {
shared_info->scope_info()->SetPositionInfo(lit->start_position(),
lit->end_position());
needs_position_info = false;
}
shared_info->set_is_declaration(lit->is_declaration());
shared_info->set_is_named_expression(lit->is_named_expression());
@ -14026,6 +14051,14 @@ void SharedFunctionInfo::InitFromFunctionLiteral(
shared_info->set_has_duplicate_parameters(lit->has_duplicate_parameters());
shared_info->SetExpectedNofPropertiesFromEstimate(lit);
DCHECK_NULL(lit->produced_preparsed_scope_data());
if (lit->ShouldEagerCompile()) {
// If we're about to eager compile, we'll have the function literal
// available, so there's no need to wastefully allocate an uncompiled
// data.
// TODO(leszeks): This should be explicitly passed as a parameter, rather
// than relying on a property of the literal.
needs_position_info = false;
}
} else {
// Set an invalid length for lazy functions. This way we can set the correct
// value after compiling, but avoid overwriting values set manually by the
@ -14035,15 +14068,25 @@ void SharedFunctionInfo::InitFromFunctionLiteral(
ProducedPreParsedScopeData* scope_data =
lit->produced_preparsed_scope_data();
if (scope_data != nullptr) {
MaybeHandle<PreParsedScopeData> maybe_data =
scope_data->Serialize(shared_info->GetIsolate());
if (!maybe_data.is_null()) {
Handle<PreParsedScopeData> data = maybe_data.ToHandleChecked();
shared_info->set_preparsed_scope_data(*data);
Handle<PreParsedScopeData> pre_parsed_scope_data;
if (scope_data->Serialize(shared_info->GetIsolate())
.ToHandle(&pre_parsed_scope_data)) {
Handle<UncompiledData> data =
isolate->factory()->NewUncompiledDataWithPreParsedScope(
lit->start_position(), lit->end_position(),
pre_parsed_scope_data);
shared_info->set_uncompiled_data(*data);
needs_position_info = false;
}
}
}
}
if (needs_position_info) {
Handle<UncompiledData> data =
isolate->factory()->NewUncompiledDataWithoutPreParsedScope(
lit->start_position(), lit->end_position());
shared_info->set_uncompiled_data(*data);
}
}
void SharedFunctionInfo::SetExpectedNofPropertiesFromEstimate(
@ -14065,13 +14108,13 @@ void SharedFunctionInfo::SetExpectedNofPropertiesFromEstimate(
set_expected_nof_properties(estimate);
}
void SharedFunctionInfo::SetFunctionTokenPosition(int function_token_position) {
DCHECK_NE(StartPosition(), kNoSourcePosition);
void SharedFunctionInfo::SetFunctionTokenPosition(int function_token_position,
int start_position) {
int offset;
if (function_token_position == kNoSourcePosition) {
offset = 0;
} else {
offset = StartPosition() - function_token_position;
offset = start_position - function_token_position;
}
if (offset > kMaximumFunctionTokenOffset) {

View File

@ -173,6 +173,9 @@
// - WeakCell
// - FeedbackCell
// - FeedbackVector
// - UncompiledData
// - UncompiledDataWithoutPreParsedScope
// - UncompiledDataWithPreParsedScope
//
// Formats of Object*:
// Smi: [31 bit signed int] 0
@ -525,6 +528,8 @@ enum InstanceType : uint16_t {
SMALL_ORDERED_HASH_MAP_TYPE,
SMALL_ORDERED_HASH_SET_TYPE,
STORE_HANDLER_TYPE,
UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE,
UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE,
WEAK_CELL_TYPE,
WEAK_ARRAY_LIST_TYPE,
@ -707,6 +712,7 @@ class StringStream;
class FeedbackCell;
class FeedbackMetadata;
class FeedbackVector;
class UncompiledData;
class WeakCell;
class TemplateInfo;
class TransitionArray;
@ -882,6 +888,9 @@ template <class C> inline bool Is(Object* obj);
V(TemplateObjectDescription) \
V(ThinString) \
V(TransitionArray) \
V(UncompiledData) \
V(UncompiledDataWithPreParsedScope) \
V(UncompiledDataWithoutPreParsedScope) \
V(Undetectable) \
V(UniqueName) \
V(WasmGlobalObject) \

View File

@ -16,50 +16,51 @@
namespace v8 {
namespace internal {
#define VISITOR_ID_LIST(V) \
V(AllocationSite) \
V(BigInt) \
V(ByteArray) \
V(BytecodeArray) \
V(Cell) \
V(Code) \
V(CodeDataContainer) \
V(ConsString) \
V(DataHandler) \
V(DataObject) \
V(EphemeronHashTable) \
V(FeedbackCell) \
V(FeedbackVector) \
V(FixedArray) \
V(FixedDoubleArray) \
V(FixedFloat64Array) \
V(FixedTypedArrayBase) \
V(FreeSpace) \
V(JSApiObject) \
V(JSArrayBuffer) \
V(JSFunction) \
V(JSObject) \
V(JSObjectFast) \
V(JSWeakCollection) \
V(Map) \
V(NativeContext) \
V(Oddball) \
V(PropertyArray) \
V(PropertyCell) \
V(PrototypeInfo) \
V(SeqOneByteString) \
V(SeqTwoByteString) \
V(SharedFunctionInfo) \
V(ShortcutCandidate) \
V(SlicedString) \
V(SmallOrderedHashMap) \
V(SmallOrderedHashSet) \
V(Struct) \
V(Symbol) \
V(ThinString) \
V(TransitionArray) \
V(WasmInstanceObject) \
V(WeakCell) \
#define VISITOR_ID_LIST(V) \
V(AllocationSite) \
V(BigInt) \
V(ByteArray) \
V(BytecodeArray) \
V(Cell) \
V(Code) \
V(CodeDataContainer) \
V(ConsString) \
V(DataHandler) \
V(DataObject) \
V(EphemeronHashTable) \
V(FeedbackCell) \
V(FeedbackVector) \
V(FixedArray) \
V(FixedDoubleArray) \
V(FixedFloat64Array) \
V(FixedTypedArrayBase) \
V(FreeSpace) \
V(JSApiObject) \
V(JSArrayBuffer) \
V(JSFunction) \
V(JSObject) \
V(JSObjectFast) \
V(JSWeakCollection) \
V(Map) \
V(NativeContext) \
V(Oddball) \
V(PropertyArray) \
V(PropertyCell) \
V(PrototypeInfo) \
V(SeqOneByteString) \
V(SeqTwoByteString) \
V(SharedFunctionInfo) \
V(ShortcutCandidate) \
V(SlicedString) \
V(SmallOrderedHashMap) \
V(SmallOrderedHashSet) \
V(Struct) \
V(Symbol) \
V(ThinString) \
V(TransitionArray) \
V(UncompiledDataWithPreParsedScope) \
V(WasmInstanceObject) \
V(WeakCell) \
V(WeakArray)
// For data objects, JS objects and structs along with generic visitor which

View File

@ -22,6 +22,16 @@ CAST_ACCESSOR(PreParsedScopeData)
ACCESSORS(PreParsedScopeData, scope_data, PodArray<uint8_t>, kScopeDataOffset)
ACCESSORS(PreParsedScopeData, child_data, FixedArray, kChildDataOffset)
CAST_ACCESSOR(UncompiledData)
INT32_ACCESSORS(UncompiledData, start_position, kStartPositionOffset)
INT32_ACCESSORS(UncompiledData, end_position, kEndPositionOffset)
CAST_ACCESSOR(UncompiledDataWithoutPreParsedScope)
CAST_ACCESSOR(UncompiledDataWithPreParsedScope)
ACCESSORS(UncompiledDataWithPreParsedScope, pre_parsed_scope_data,
PreParsedScopeData, kPreParsedScopeDataOffset)
CAST_ACCESSOR(InterpreterData)
ACCESSORS(InterpreterData, bytecode_array, BytecodeArray, kBytecodeArrayOffset)
ACCESSORS(InterpreterData, interpreter_trampoline, Code,
@ -37,12 +47,6 @@ ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset)
ACCESSORS(SharedFunctionInfo, function_identifier_or_debug_info, Object,
kFunctionIdentifierOrDebugInfoOffset)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, raw_start_position_and_type,
is_named_expression,
SharedFunctionInfo::IsNamedExpressionBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, raw_start_position_and_type,
is_toplevel, SharedFunctionInfo::IsTopLevelBit)
INT_ACCESSORS(SharedFunctionInfo, function_literal_id, kFunctionLiteralIdOffset)
#if V8_SFI_HAS_UNIQUE_ID
INT_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset)
@ -54,9 +58,6 @@ UINT16_ACCESSORS(SharedFunctionInfo, expected_nof_properties,
kExpectedNofPropertiesOffset)
UINT16_ACCESSORS(SharedFunctionInfo, raw_function_token_offset,
kFunctionTokenOffsetOffset)
INT_ACCESSORS(SharedFunctionInfo, raw_end_position, kEndPositionOffset)
INT_ACCESSORS(SharedFunctionInfo, raw_start_position_and_type,
kStartPositionAndTypeOffset)
INT_ACCESSORS(SharedFunctionInfo, flags, kFlagsOffset)
bool SharedFunctionInfo::HasSharedName() const {
@ -134,6 +135,11 @@ BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, deserialized,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, has_reported_binary_coverage,
SharedFunctionInfo::HasReportedBinaryCoverageBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, is_named_expression,
SharedFunctionInfo::IsNamedExpressionBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, is_toplevel,
SharedFunctionInfo::IsTopLevelBit)
bool SharedFunctionInfo::optimization_disabled() const {
return disable_optimization_reason() != BailoutReason::kNoReason;
}
@ -236,32 +242,64 @@ void SharedFunctionInfo::DontAdaptArguments() {
set_internal_formal_parameter_count(kDontAdaptArgumentsSentinel);
}
BIT_FIELD_ACCESSORS(SharedFunctionInfo, raw_start_position_and_type,
raw_start_position, SharedFunctionInfo::StartPositionBits)
int SharedFunctionInfo::StartPosition() const {
ScopeInfo* info = scope_info();
if (!info->HasPositionInfo()) {
// TODO(cbruni): use preparsed_scope_data
return raw_start_position();
Object* maybe_scope_info = name_or_scope_info();
if (maybe_scope_info->IsScopeInfo()) {
ScopeInfo* info = ScopeInfo::cast(maybe_scope_info);
if (info->HasPositionInfo()) {
return info->StartPosition();
}
} else if (HasUncompiledData()) {
// Works with or without scope.
return uncompiled_data()->start_position();
} else if (IsApiFunction() || HasBuiltinId()) {
DCHECK_IMPLIES(HasBuiltinId(), builtin_id() != Builtins::kCompileLazy);
return 0;
}
return info->StartPosition();
return kNoSourcePosition;
}
int SharedFunctionInfo::EndPosition() const {
ScopeInfo* info = scope_info();
if (!info->HasPositionInfo()) {
// TODO(cbruni): use preparsed_scope_data
return raw_end_position();
Object* maybe_scope_info = name_or_scope_info();
if (maybe_scope_info->IsScopeInfo()) {
ScopeInfo* info = ScopeInfo::cast(maybe_scope_info);
if (info->HasPositionInfo()) {
return info->EndPosition();
}
} else if (HasUncompiledData()) {
// Works with or without scope.
return uncompiled_data()->end_position();
} else if (IsApiFunction() || HasBuiltinId()) {
DCHECK_IMPLIES(HasBuiltinId(), builtin_id() != Builtins::kCompileLazy);
return 0;
}
return kNoSourcePosition;
}
void SharedFunctionInfo::SetPosition(int start_position, int end_position) {
Object* maybe_scope_info = name_or_scope_info();
if (maybe_scope_info->IsScopeInfo()) {
ScopeInfo* info = ScopeInfo::cast(maybe_scope_info);
if (info->HasPositionInfo()) {
info->SetPositionInfo(start_position, end_position);
}
} else if (HasUncompiledData()) {
if (HasUncompiledDataWithPreParsedScope()) {
// Clear out preparsed scope data, since the position setter invalidates
// any scope data.
ClearPreParsedScopeData();
}
uncompiled_data()->set_start_position(start_position);
uncompiled_data()->set_end_position(end_position);
} else {
UNREACHABLE();
}
return info->EndPosition();
}
Code* SharedFunctionInfo::GetCode() const {
// ======
// NOTE: This chain of checks MUST be kept in sync with the equivalent CSA
// GetSharedFunctionInfoCode method in code-stub-assembler.cc, and the
// architecture-specific GetSharedFunctionInfoCode methods in builtins-*.cc.
// GetSharedFunctionInfoCode method in code-stub-assembler.cc.
// ======
Isolate* isolate = GetIsolate();
@ -278,9 +316,9 @@ Code* SharedFunctionInfo::GetCode() const {
// Having a fixed array means we are an asm.js/wasm function.
DCHECK(HasAsmWasmData());
return isolate->builtins()->builtin(Builtins::kInstantiateAsmJs);
} else if (data->IsPreParsedScopeData()) {
// Having pre-parsed scope data means we need to compile.
DCHECK(HasPreParsedScopeData());
} else if (data->IsUncompiledData()) {
// Having uncompiled data (with or without scope) means we need to compile.
DCHECK(HasUncompiledData());
return isolate->builtins()->builtin(Builtins::kCompileLazy);
} else if (data->IsFunctionTemplateInfo()) {
// Having a function template info means we are an API function.
@ -311,11 +349,6 @@ ScopeInfo* SharedFunctionInfo::scope_info() const {
void SharedFunctionInfo::set_scope_info(ScopeInfo* scope_info,
WriteBarrierMode mode) {
// TODO(cbruni): this code is no longer necessary once we store the positon
// only on the ScopeInfo.
if (scope_info->HasPositionInfo()) {
scope_info->SetPositionInfo(raw_start_position(), raw_end_position());
}
// Move the existing name onto the ScopeInfo.
Object* name = name_or_scope_info();
if (name->IsScopeInfo()) {
@ -387,7 +420,7 @@ void SharedFunctionInfo::set_feedback_metadata(FeedbackMetadata* value,
bool SharedFunctionInfo::is_compiled() const {
Object* data = function_data();
return data != Smi::FromEnum(Builtins::kCompileLazy) &&
!data->IsPreParsedScopeData();
!data->IsUncompiledData();
}
uint16_t SharedFunctionInfo::GetLength() const {
@ -452,7 +485,8 @@ void SharedFunctionInfo::SetDebugBytecodeArray(BytecodeArray* bytecode) {
}
void SharedFunctionInfo::set_bytecode_array(BytecodeArray* bytecode) {
DCHECK(function_data() == Smi::FromEnum(Builtins::kCompileLazy));
DCHECK(function_data() == Smi::FromEnum(Builtins::kCompileLazy) ||
HasUncompiledData());
set_function_data(bytecode);
}
@ -487,7 +521,7 @@ FixedArray* SharedFunctionInfo::asm_wasm_data() const {
void SharedFunctionInfo::set_asm_wasm_data(FixedArray* data) {
DCHECK(function_data() == Smi::FromEnum(Builtins::kCompileLazy) ||
HasAsmWasmData());
HasUncompiledData() || HasAsmWasmData());
set_function_data(data);
}
@ -508,25 +542,72 @@ void SharedFunctionInfo::set_builtin_id(int builtin_id) {
set_function_data(Smi::FromInt(builtin_id), SKIP_WRITE_BARRIER);
}
bool SharedFunctionInfo::HasPreParsedScopeData() const {
return function_data()->IsPreParsedScopeData();
bool SharedFunctionInfo::HasUncompiledData() const {
return function_data()->IsUncompiledData();
}
PreParsedScopeData* SharedFunctionInfo::preparsed_scope_data() const {
DCHECK(HasPreParsedScopeData());
return PreParsedScopeData::cast(function_data());
UncompiledData* SharedFunctionInfo::uncompiled_data() const {
DCHECK(HasUncompiledData());
return UncompiledData::cast(function_data());
}
void SharedFunctionInfo::set_preparsed_scope_data(
PreParsedScopeData* preparsed_scope_data) {
void SharedFunctionInfo::set_uncompiled_data(UncompiledData* uncompiled_data) {
DCHECK(function_data() == Smi::FromEnum(Builtins::kCompileLazy));
set_function_data(preparsed_scope_data);
DCHECK(uncompiled_data->IsUncompiledData());
set_function_data(uncompiled_data);
}
bool SharedFunctionInfo::HasUncompiledDataWithPreParsedScope() const {
return function_data()->IsUncompiledDataWithPreParsedScope();
}
UncompiledDataWithPreParsedScope*
SharedFunctionInfo::uncompiled_data_with_pre_parsed_scope() const {
DCHECK(HasUncompiledDataWithPreParsedScope());
return UncompiledDataWithPreParsedScope::cast(function_data());
}
void SharedFunctionInfo::set_uncompiled_data_with_pre_parsed_scope(
UncompiledDataWithPreParsedScope* uncompiled_data_with_pre_parsed_scope) {
DCHECK(function_data() == Smi::FromEnum(Builtins::kCompileLazy));
DCHECK(uncompiled_data_with_pre_parsed_scope
->IsUncompiledDataWithPreParsedScope());
set_function_data(uncompiled_data_with_pre_parsed_scope);
}
bool SharedFunctionInfo::HasUncompiledDataWithoutPreParsedScope() const {
return function_data()->IsUncompiledDataWithoutPreParsedScope();
}
void SharedFunctionInfo::ClearPreParsedScopeData() {
DCHECK(function_data() == Smi::FromEnum(Builtins::kCompileLazy) ||
HasPreParsedScopeData());
set_builtin_id(Builtins::kCompileLazy);
DCHECK(HasUncompiledDataWithPreParsedScope());
UncompiledDataWithPreParsedScope* data =
uncompiled_data_with_pre_parsed_scope();
// Trim off the pre-parsed scope data from the uncompiled data by swapping the
// map, leaving only an uncompiled data without pre-parsed scope.
DisallowHeapAllocation no_gc;
Heap* heap = Heap::FromWritableHeapObject(data);
// Swap the map.
heap->NotifyObjectLayoutChange(data, UncompiledDataWithPreParsedScope::kSize,
no_gc);
STATIC_ASSERT(UncompiledDataWithoutPreParsedScope::kSize <
UncompiledDataWithPreParsedScope::kSize);
STATIC_ASSERT(UncompiledDataWithoutPreParsedScope::kSize ==
UncompiledData::kSize);
data->synchronized_set_map(
GetReadOnlyRoots().uncompiled_data_without_pre_parsed_scope_map());
// Fill the remaining space with filler.
heap->CreateFillerObjectAt(
data->address() + UncompiledDataWithoutPreParsedScope::kSize,
UncompiledDataWithPreParsedScope::kSize -
UncompiledDataWithoutPreParsedScope::kSize,
ClearRecordedSlots::kNo);
// Ensure that the clear was successful.
DCHECK(HasUncompiledDataWithoutPreParsedScope());
}
bool SharedFunctionInfo::HasWasmExportedFunctionData() const {
@ -613,33 +694,49 @@ bool SharedFunctionInfo::IsSubjectToDebugging() {
return IsUserJavaScript() && !HasAsmWasmData();
}
bool SharedFunctionInfo::CanFlushCompiled() const {
bool can_decompile =
(HasBytecodeArray() || HasAsmWasmData() || HasPreParsedScopeData());
bool SharedFunctionInfo::CanDiscardCompiled() const {
bool can_decompile = (HasBytecodeArray() || HasAsmWasmData() ||
HasUncompiledDataWithPreParsedScope());
return can_decompile;
}
void SharedFunctionInfo::FlushCompiled() {
DisallowHeapAllocation no_gc;
// static
void SharedFunctionInfo::DiscardCompiled(
Isolate* isolate, Handle<SharedFunctionInfo> shared_info) {
DCHECK(shared_info->CanDiscardCompiled());
DCHECK(CanFlushCompiled());
int start_position = shared_info->StartPosition();
int end_position = shared_info->EndPosition();
if (is_compiled()) {
if (shared_info->is_compiled()) {
HeapObject* outer_scope_info;
if (scope_info()->HasOuterScopeInfo()) {
outer_scope_info = scope_info()->OuterScopeInfo();
if (shared_info->scope_info()->HasOuterScopeInfo()) {
outer_scope_info = shared_info->scope_info()->OuterScopeInfo();
} else {
outer_scope_info = GetReadOnlyRoots().the_hole_value();
outer_scope_info = ReadOnlyRoots(isolate).the_hole_value();
}
// Raw setter to avoid validity checks, since we're performing the unusual
// task of decompiling.
set_raw_outer_scope_info_or_feedback_metadata(outer_scope_info);
shared_info->set_raw_outer_scope_info_or_feedback_metadata(
outer_scope_info);
} else {
DCHECK(outer_scope_info()->IsScopeInfo() ||
outer_scope_info()->IsTheHole());
DCHECK(shared_info->outer_scope_info()->IsScopeInfo() ||
shared_info->outer_scope_info()->IsTheHole());
}
set_builtin_id(Builtins::kCompileLazy);
if (shared_info->HasUncompiledDataWithPreParsedScope()) {
// If this is uncompiled data with a pre-parsed scope data, we can just
// clear out the scope data and keep the uncompiled data.
shared_info->ClearPreParsedScopeData();
} else {
// Create a new UncompiledData, without pre-parsed scope, and update the
// function data to point to it. Use the raw function data setter to avoid
// validity checks, since we're performing the unusual task of decompiling.
Handle<UncompiledData> data =
isolate->factory()->NewUncompiledDataWithoutPreParsedScope(
start_position, end_position);
shared_info->set_function_data(*data);
}
}
} // namespace internal

View File

@ -20,6 +20,8 @@ class CoverageInfo;
class DebugInfo;
class WasmExportedFunctionData;
// Data collected by the pre-parser storing information about scopes and inner
// functions.
class PreParsedScopeData : public Struct {
public:
DECL_ACCESSORS(scope_data, PodArray<uint8_t>)
@ -37,6 +39,78 @@ class PreParsedScopeData : public Struct {
DISALLOW_IMPLICIT_CONSTRUCTORS(PreParsedScopeData);
};
// Abstract class representing extra data for an uncompiled function, which is
// not stored in the SharedFunctionInfo.
class UncompiledData : public HeapObject {
public:
DECL_INT32_ACCESSORS(start_position)
DECL_INT32_ACCESSORS(end_position)
DECL_CAST(UncompiledData)
#define UNCOMPILED_DATA_FIELDS(V) \
V(kStartPositionOffset, kInt32Size) \
V(kEndPositionOffset, kInt32Size) \
/* Total size. */ \
V(kUnalignedSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, UNCOMPILED_DATA_FIELDS)
#undef UNCOMPILED_DATA_FIELDS
static const int kSize = POINTER_SIZE_ALIGN(kUnalignedSize);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(UncompiledData);
};
// Class representing data for an uncompiled function that does not have any
// data from the pre-parser, either because it's a leaf function or because the
// pre-parser bailed out.
class UncompiledDataWithoutPreParsedScope : public UncompiledData {
public:
DECL_CAST(UncompiledDataWithoutPreParsedScope)
DECL_PRINTER(UncompiledDataWithoutPreParsedScope)
DECL_VERIFIER(UncompiledDataWithoutPreParsedScope)
static const int kSize = UncompiledData::kSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(UncompiledDataWithoutPreParsedScope);
};
// Class representing data for an uncompiled function that has pre-parsed scope
// data.
class UncompiledDataWithPreParsedScope : public UncompiledData {
public:
DECL_ACCESSORS(pre_parsed_scope_data, PreParsedScopeData)
DECL_CAST(UncompiledDataWithPreParsedScope)
DECL_PRINTER(UncompiledDataWithPreParsedScope)
DECL_VERIFIER(UncompiledDataWithPreParsedScope)
#define UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_FIELDS(V) \
V(kStartOfPointerFieldsOffset, 0) \
V(kPreParsedScopeDataOffset, kPointerSize) \
V(kEndOfPointerFieldsOffset, 0) \
/* Total size. */ \
V(kUnalignedSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(UncompiledData::kSize,
UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_FIELDS)
#undef UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_FIELDS
static const int kSize = POINTER_SIZE_ALIGN(kUnalignedSize);
typedef FixedBodyDescriptor<kStartOfPointerFieldsOffset,
kEndOfPointerFieldsOffset, kUnalignedSize>
BodyDescriptor;
// No weak fields.
typedef BodyDescriptor BodyDescriptorWeak;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(UncompiledDataWithPreParsedScope);
};
class InterpreterData : public Struct {
public:
DECL_ACCESSORS(bytecode_array, BytecodeArray)
@ -112,6 +186,10 @@ class SharedFunctionInfo : public HeapObject {
// Start position of this function in the script source.
inline int StartPosition() const;
// Set the start and end position of this function in the script source.
// Updates the scope info if available.
inline void SetPosition(int start_position, int end_position);
// [outer scope info | feedback metadata] Shared storage for outer scope info
// (on uncompiled functions) and feedback metadata (on compiled functions).
DECL_ACCESSORS(raw_outer_scope_info_or_feedback_metadata, HeapObject)
@ -168,7 +246,10 @@ class SharedFunctionInfo : public HeapObject {
// interpreter trampoline [HasInterpreterData()]
// - a FixedArray with Asm->Wasm conversion [HasAsmWasmData()].
// - a Smi containing the builtin id [HasBuiltinId()]
// - a PreParsedScopeData for the parser [HasPreParsedScopeData()]
// - a UncompiledDataWithoutPreParsedScope for lazy compilation
// [HasUncompiledDataWithoutPreParsedScope()]
// - a UncompiledDataWithPreParsedScope for lazy compilation
// [HasUncompiledDataWithPreParsedScope()]
// - a WasmExportedFunctionData for Wasm [HasWasmExportedFunctionData()]
DECL_ACCESSORS(function_data, Object)
@ -196,14 +277,23 @@ class SharedFunctionInfo : public HeapObject {
inline bool HasBuiltinId() const;
inline int builtin_id() const;
inline void set_builtin_id(int builtin_id);
inline bool HasPreParsedScopeData() const;
inline PreParsedScopeData* preparsed_scope_data() const;
inline void set_preparsed_scope_data(PreParsedScopeData* data);
inline void ClearPreParsedScopeData();
inline bool HasUncompiledData() const;
inline UncompiledData* uncompiled_data() const;
inline void set_uncompiled_data(UncompiledData* data);
inline bool HasUncompiledDataWithPreParsedScope() const;
inline UncompiledDataWithPreParsedScope*
uncompiled_data_with_pre_parsed_scope() const;
inline void set_uncompiled_data_with_pre_parsed_scope(
UncompiledDataWithPreParsedScope* data);
inline bool HasUncompiledDataWithoutPreParsedScope() const;
inline bool HasWasmExportedFunctionData() const;
inline WasmExportedFunctionData* wasm_exported_function_data() const;
inline void set_wasm_exported_function_data(WasmExportedFunctionData* data);
// Clear out pre-parsed scope data from UncompiledDataWithPreParsedScope,
// turning it into UncompiledDataWithoutPreParsedScope.
inline void ClearPreParsedScopeData();
// [function identifier]: This field holds an additional identifier for the
// function.
// - a Smi identifying a builtin function [HasBuiltinFunctionId()].
@ -257,34 +347,18 @@ class SharedFunctionInfo : public HeapObject {
// kFunctionTokenOutOfRange.
inline int function_token_position() const;
// [raw_start_position_and_type]: Field used to store both the source code
// position, whether or not the function is a function expression,
// and whether or not the function is a toplevel function. The two
// least significants bit indicates whether the function is an
// expression and the rest contains the source code position.
// TODO(cbruni): start_position should be removed from SFI.
DECL_INT_ACCESSORS(raw_start_position_and_type)
// Position of this function in the script source.
// TODO(cbruni): start_position should be removed from SFI.
DECL_INT_ACCESSORS(raw_start_position)
// End position of this function in the script source.
// TODO(cbruni): end_position should be removed from SFI.
DECL_INT_ACCESSORS(raw_end_position)
// Returns true if the function has shared name.
inline bool HasSharedName() const;
// [flags] Bit field containing various flags about the function.
DECL_INT_ACCESSORS(flags)
// Is this function a named function expression in the source code.
DECL_BOOLEAN_ACCESSORS(is_named_expression)
// Is this function a top-level function (scripts, evals).
DECL_BOOLEAN_ACCESSORS(is_toplevel)
// [flags] Bit field containing various flags about the function.
DECL_INT_ACCESSORS(flags)
// Indicates if this function can be lazy compiled.
DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation)
@ -375,11 +449,12 @@ class SharedFunctionInfo : public HeapObject {
// True if one can flush compiled code from this function, in such a way that
// it can later be re-compiled.
inline bool CanFlushCompiled() const;
inline bool CanDiscardCompiled() const;
// Flush compiled data from this function, setting it back to CompileLazy and
// clearing any feedback metadata.
inline void FlushCompiled();
static inline void DiscardCompiled(Isolate* isolate,
Handle<SharedFunctionInfo> shared_info);
// Check whether or not this function is inlineable.
bool IsInlineable();
@ -399,8 +474,10 @@ class SharedFunctionInfo : public HeapObject {
// Sets the expected number of properties based on estimate from parser.
void SetExpectedNofPropertiesFromEstimate(FunctionLiteral* literal);
// Sets the FunctionTokenOffset field based on the
void SetFunctionTokenPosition(int function_token_position);
// Sets the FunctionTokenOffset field based on the given token position and
// start position.
void SetFunctionTokenPosition(int function_token_position,
int start_position);
inline bool construct_as_builtin() const;
@ -483,8 +560,6 @@ class SharedFunctionInfo : public HeapObject {
V(kFormalParameterCountOffset, kUInt16Size) \
V(kExpectedNofPropertiesOffset, kUInt16Size) \
V(kFunctionTokenOffsetOffset, kUInt16Size) \
V(kStartPositionAndTypeOffset, kInt32Size) \
V(kEndPositionOffset, kInt32Size) \
V(kFlagsOffset, kInt32Size) \
/* Total size. */ \
V(kSize, 0)
@ -501,15 +576,6 @@ class SharedFunctionInfo : public HeapObject {
// No weak fields.
typedef BodyDescriptor BodyDescriptorWeak;
// Bit fields in |raw_start_position_and_type|.
#define START_POSITION_AND_TYPE_BIT_FIELDS(V, _) \
V(IsNamedExpressionBit, bool, 1, _) \
V(IsTopLevelBit, bool, 1, _) \
V(StartPositionBits, int, 30, _)
DEFINE_BIT_FIELDS(START_POSITION_AND_TYPE_BIT_FIELDS)
#undef START_POSITION_AND_TYPE_BIT_FIELDS
// Bit positions in |flags|.
#define FLAGS_BIT_FIELDS(V, _) \
V(IsNativeBit, bool, 1, _) \
@ -530,7 +596,9 @@ class SharedFunctionInfo : public HeapObject {
V(IsAnonymousExpressionBit, bool, 1, _) \
V(NameShouldPrintAsAnonymousBit, bool, 1, _) \
V(IsDeserializedBit, bool, 1, _) \
V(HasReportedBinaryCoverageBit, bool, 1, _)
V(HasReportedBinaryCoverageBit, bool, 1, _) \
V(IsNamedExpressionBit, bool, 1, _) \
V(IsTopLevelBit, bool, 1, _)
DEFINE_BIT_FIELDS(FLAGS_BIT_FIELDS)
#undef FLAGS_BIT_FIELDS

View File

@ -99,6 +99,10 @@ namespace internal {
V(Map, small_ordered_hash_map_map, SmallOrderedHashMapMap) \
V(Map, small_ordered_hash_set_map, SmallOrderedHashSetMap) \
V(Map, string_table_map, StringTableMap) \
V(Map, uncompiled_data_without_pre_parsed_scope_map, \
UncompiledDataWithoutPreParsedScopeMap) \
V(Map, uncompiled_data_with_pre_parsed_scope_map, \
UncompiledDataWithPreParsedScopeMap) \
V(Map, weak_fixed_array_map, WeakFixedArrayMap) \
V(Map, weak_array_list_map, WeakArrayListMap) \
V(Map, ephemeron_hash_table_map, EphemeronHashTableMap) \

View File

@ -130,9 +130,10 @@ RUNTIME_FUNCTION(Runtime_InstantiateAsmJs) {
}
}
// Remove wasm data, mark as broken for asm->wasm, replace function code with
// CompileLazy, and return a smi 0 to indicate failure.
// UncompiledData, and return a smi 0 to indicate failure.
if (function->shared()->HasAsmWasmData()) {
function->shared()->FlushCompiled();
SharedFunctionInfo::DiscardCompiled(isolate,
handle(function->shared(), isolate));
}
function->shared()->set_is_asm_wasm_broken(true);
DCHECK(function->code() ==

View File

@ -111,9 +111,6 @@ RUNTIME_FUNCTION(Runtime_SetCode) {
source_shared->raw_outer_scope_info_or_feedback_metadata());
target_shared->set_internal_formal_parameter_count(
source_shared->internal_formal_parameter_count());
target_shared->set_raw_start_position_and_type(
source_shared->raw_start_position_and_type());
target_shared->set_raw_end_position(source_shared->raw_end_position());
bool was_native = target_shared->native();
target_shared->set_flags(source_shared->flags());
target_shared->set_native(was_native);

View File

@ -5003,7 +5003,8 @@ static void RemoveCodeAndGC(const v8::FunctionCallbackInfo<v8::Value>& args) {
Isolate* isolate = CcTest::i_isolate();
Handle<Object> obj = v8::Utils::OpenHandle(*args[0]);
Handle<JSFunction> fun = Handle<JSFunction>::cast(obj);
fun->shared()->FlushCompiled(); // Bytecode is code too.
// Bytecode is code too.
SharedFunctionInfo::DiscardCompiled(isolate, handle(fun->shared(), isolate));
fun->set_code(*BUILTIN_CODE(isolate, CompileLazy));
CcTest::CollectAllAvailableGarbage();
}

View File

@ -734,13 +734,15 @@ TEST(PreParserScopeAnalysis) {
if (inners[inner_ix].bailout == Bailout::BAILOUT_IF_OUTER_SLOPPY &&
!outers[outer_ix].strict_outer) {
CHECK(!shared->HasPreParsedScopeData());
CHECK(!shared->HasUncompiledDataWithPreParsedScope());
continue;
}
CHECK(shared->HasPreParsedScopeData());
CHECK(shared->HasUncompiledDataWithPreParsedScope());
i::Handle<i::PreParsedScopeData> produced_data_on_heap(
i::PreParsedScopeData::cast(shared->preparsed_scope_data()), isolate);
shared->uncompiled_data_with_pre_parsed_scope()
->pre_parsed_scope_data(),
isolate);
// Parse the lazy function using the scope data.
i::ParseInfo using_scope_data(isolate, shared);

View File

@ -38,7 +38,10 @@ Handle<SharedFunctionInfo> CreateSharedFunctionInfo(
isolate->factory()->NewSharedFunctionInfoForBuiltin(
isolate->factory()->NewStringFromAsciiChecked("f"),
Builtins::kCompileLazy);
shared->set_raw_end_position(source->length());
// Ensure that the function can be compiled lazily.
shared->set_uncompiled_data(
*isolate->factory()->NewUncompiledDataWithoutPreParsedScope(
0, source->length()));
// Make sure we have an outer scope info, even though it's empty
shared->set_raw_outer_scope_info_or_feedback_metadata(
ScopeInfo::Empty(isolate));

View File

@ -189,11 +189,6 @@ consts_misc = [
{ 'name': 'scopeinfo_idx_first_vars',
'value': 'ScopeInfo::kVariablePartIndex' },
{ 'name': 'sharedfunctioninfo_start_position_mask',
'value': 'SharedFunctionInfo::StartPositionBits::kMask' },
{ 'name': 'sharedfunctioninfo_start_position_shift',
'value': 'SharedFunctionInfo::StartPositionBits::kShift' },
{ 'name': 'jsarray_buffer_was_neutered_mask',
'value': 'JSArrayBuffer::WasNeutered::kMask' },
{ 'name': 'jsarray_buffer_was_neutered_shift',
@ -263,9 +258,9 @@ extras_accessors = [
'ExternalString, resource, Object, kResourceOffset',
'SeqOneByteString, chars, char, kHeaderSize',
'SeqTwoByteString, chars, char, kHeaderSize',
'SharedFunctionInfo, raw_function_token_offset, int, kFunctionTokenOffsetOffset',
'SharedFunctionInfo, start_position_and_type, int, kStartPositionAndTypeOffset',
'SharedFunctionInfo, end_position, int, kEndPositionOffset',
'UncompiledData, start_position, int32_t, kStartPositionOffset',
'UncompiledData, end_position, int32_t, kEndPositionOffset',
'SharedFunctionInfo, raw_function_token_offset, int16_t, kFunctionTokenOffsetOffset',
'SharedFunctionInfo, internal_formal_parameter_count, uint16_t, kFormalParameterCountOffset',
'SharedFunctionInfo, flags, int, kFlagsOffset',
'SharedFunctionInfo, length, uint16_t, kLengthOffset',

View File

@ -120,8 +120,10 @@ INSTANCE_TYPES = {
216: "SMALL_ORDERED_HASH_MAP_TYPE",
217: "SMALL_ORDERED_HASH_SET_TYPE",
218: "STORE_HANDLER_TYPE",
219: "WEAK_CELL_TYPE",
220: "WEAK_ARRAY_LIST_TYPE",
219: "UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE",
220: "UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE",
221: "WEAK_CELL_TYPE",
222: "WEAK_ARRAY_LIST_TYPE",
1024: "JS_PROXY_TYPE",
1025: "JS_GLOBAL_OBJECT_TYPE",
1026: "JS_GLOBAL_PROXY_TYPE",
@ -173,7 +175,7 @@ KNOWN_MAPS = {
("RO_SPACE", 0x022e1): (131, "NullMap"),
("RO_SPACE", 0x02359): (205, "DescriptorArrayMap"),
("RO_SPACE", 0x023c1): (182, "FixedArrayMap"),
("RO_SPACE", 0x02429): (219, "WeakCellMap"),
("RO_SPACE", 0x02429): (221, "WeakCellMap"),
("RO_SPACE", 0x024d1): (152, "OnePointerFillerMap"),
("RO_SPACE", 0x02539): (152, "TwoPointerFillerMap"),
("RO_SPACE", 0x025d1): (131, "UninitializedMap"),
@ -236,72 +238,74 @@ KNOWN_MAPS = {
("RO_SPACE", 0x04091): (216, "SmallOrderedHashMapMap"),
("RO_SPACE", 0x040f9): (217, "SmallOrderedHashSetMap"),
("RO_SPACE", 0x04161): (191, "StringTableMap"),
("RO_SPACE", 0x041c9): (204, "WeakFixedArrayMap"),
("RO_SPACE", 0x04231): (220, "WeakArrayListMap"),
("RO_SPACE", 0x04299): (192, "EphemeronHashTableMap"),
("RO_SPACE", 0x04301): (106, "NativeSourceStringMap"),
("RO_SPACE", 0x04369): (64, "StringMap"),
("RO_SPACE", 0x043d1): (73, "ConsOneByteStringMap"),
("RO_SPACE", 0x04439): (65, "ConsStringMap"),
("RO_SPACE", 0x044a1): (77, "ThinOneByteStringMap"),
("RO_SPACE", 0x04509): (69, "ThinStringMap"),
("RO_SPACE", 0x04571): (67, "SlicedStringMap"),
("RO_SPACE", 0x045d9): (75, "SlicedOneByteStringMap"),
("RO_SPACE", 0x04641): (66, "ExternalStringMap"),
("RO_SPACE", 0x046a9): (82, "ExternalStringWithOneByteDataMap"),
("RO_SPACE", 0x04711): (74, "ExternalOneByteStringMap"),
("RO_SPACE", 0x04779): (98, "ShortExternalStringMap"),
("RO_SPACE", 0x047e1): (114, "ShortExternalStringWithOneByteDataMap"),
("RO_SPACE", 0x04849): (0, "InternalizedStringMap"),
("RO_SPACE", 0x048b1): (2, "ExternalInternalizedStringMap"),
("RO_SPACE", 0x04919): (18, "ExternalInternalizedStringWithOneByteDataMap"),
("RO_SPACE", 0x04981): (10, "ExternalOneByteInternalizedStringMap"),
("RO_SPACE", 0x049e9): (34, "ShortExternalInternalizedStringMap"),
("RO_SPACE", 0x04a51): (50, "ShortExternalInternalizedStringWithOneByteDataMap"),
("RO_SPACE", 0x04ab9): (42, "ShortExternalOneByteInternalizedStringMap"),
("RO_SPACE", 0x04b21): (106, "ShortExternalOneByteStringMap"),
("RO_SPACE", 0x04b89): (140, "FixedUint8ArrayMap"),
("RO_SPACE", 0x04bf1): (139, "FixedInt8ArrayMap"),
("RO_SPACE", 0x04c59): (142, "FixedUint16ArrayMap"),
("RO_SPACE", 0x04cc1): (141, "FixedInt16ArrayMap"),
("RO_SPACE", 0x04d29): (144, "FixedUint32ArrayMap"),
("RO_SPACE", 0x04d91): (143, "FixedInt32ArrayMap"),
("RO_SPACE", 0x04df9): (145, "FixedFloat32ArrayMap"),
("RO_SPACE", 0x04e61): (146, "FixedFloat64ArrayMap"),
("RO_SPACE", 0x04ec9): (147, "FixedUint8ClampedArrayMap"),
("RO_SPACE", 0x04f31): (149, "FixedBigUint64ArrayMap"),
("RO_SPACE", 0x04f99): (148, "FixedBigInt64ArrayMap"),
("RO_SPACE", 0x05001): (131, "SelfReferenceMarkerMap"),
("RO_SPACE", 0x05081): (171, "Tuple2Map"),
("RO_SPACE", 0x053d1): (161, "InterceptorInfoMap"),
("RO_SPACE", 0x054f1): (169, "ScriptMap"),
("RO_SPACE", 0x09dc9): (154, "AccessorInfoMap"),
("RO_SPACE", 0x09e31): (153, "AccessCheckInfoMap"),
("RO_SPACE", 0x09e99): (155, "AccessorPairMap"),
("RO_SPACE", 0x09f01): (156, "AliasedArgumentsEntryMap"),
("RO_SPACE", 0x09f69): (157, "AllocationMementoMap"),
("RO_SPACE", 0x09fd1): (158, "AsyncGeneratorRequestMap"),
("RO_SPACE", 0x0a039): (159, "DebugInfoMap"),
("RO_SPACE", 0x0a0a1): (160, "FunctionTemplateInfoMap"),
("RO_SPACE", 0x0a109): (162, "InterpreterDataMap"),
("RO_SPACE", 0x0a171): (163, "ModuleInfoEntryMap"),
("RO_SPACE", 0x0a1d9): (164, "ModuleMap"),
("RO_SPACE", 0x0a241): (165, "ObjectTemplateInfoMap"),
("RO_SPACE", 0x0a2a9): (166, "PromiseCapabilityMap"),
("RO_SPACE", 0x0a311): (167, "PromiseReactionMap"),
("RO_SPACE", 0x0a379): (168, "PrototypeInfoMap"),
("RO_SPACE", 0x0a3e1): (170, "StackFrameInfoMap"),
("RO_SPACE", 0x0a449): (172, "Tuple3Map"),
("RO_SPACE", 0x0a4b1): (173, "ArrayBoilerplateDescriptionMap"),
("RO_SPACE", 0x0a519): (174, "WasmDebugInfoMap"),
("RO_SPACE", 0x0a581): (175, "WasmExportedFunctionDataMap"),
("RO_SPACE", 0x0a5e9): (176, "CallableTaskMap"),
("RO_SPACE", 0x0a651): (177, "CallbackTaskMap"),
("RO_SPACE", 0x0a6b9): (178, "PromiseFulfillReactionJobTaskMap"),
("RO_SPACE", 0x0a721): (179, "PromiseRejectReactionJobTaskMap"),
("RO_SPACE", 0x0a789): (180, "PromiseResolveThenableJobTaskMap"),
("RO_SPACE", 0x0a7f1): (181, "AllocationSiteMap"),
("RO_SPACE", 0x0a859): (181, "AllocationSiteMap"),
("RO_SPACE", 0x041c9): (219, "UncompiledDataWithoutPreParsedScopeMap"),
("RO_SPACE", 0x04231): (220, "UncompiledDataWithPreParsedScopeMap"),
("RO_SPACE", 0x04299): (204, "WeakFixedArrayMap"),
("RO_SPACE", 0x04301): (222, "WeakArrayListMap"),
("RO_SPACE", 0x04369): (192, "EphemeronHashTableMap"),
("RO_SPACE", 0x043d1): (106, "NativeSourceStringMap"),
("RO_SPACE", 0x04439): (64, "StringMap"),
("RO_SPACE", 0x044a1): (73, "ConsOneByteStringMap"),
("RO_SPACE", 0x04509): (65, "ConsStringMap"),
("RO_SPACE", 0x04571): (77, "ThinOneByteStringMap"),
("RO_SPACE", 0x045d9): (69, "ThinStringMap"),
("RO_SPACE", 0x04641): (67, "SlicedStringMap"),
("RO_SPACE", 0x046a9): (75, "SlicedOneByteStringMap"),
("RO_SPACE", 0x04711): (66, "ExternalStringMap"),
("RO_SPACE", 0x04779): (82, "ExternalStringWithOneByteDataMap"),
("RO_SPACE", 0x047e1): (74, "ExternalOneByteStringMap"),
("RO_SPACE", 0x04849): (98, "ShortExternalStringMap"),
("RO_SPACE", 0x048b1): (114, "ShortExternalStringWithOneByteDataMap"),
("RO_SPACE", 0x04919): (0, "InternalizedStringMap"),
("RO_SPACE", 0x04981): (2, "ExternalInternalizedStringMap"),
("RO_SPACE", 0x049e9): (18, "ExternalInternalizedStringWithOneByteDataMap"),
("RO_SPACE", 0x04a51): (10, "ExternalOneByteInternalizedStringMap"),
("RO_SPACE", 0x04ab9): (34, "ShortExternalInternalizedStringMap"),
("RO_SPACE", 0x04b21): (50, "ShortExternalInternalizedStringWithOneByteDataMap"),
("RO_SPACE", 0x04b89): (42, "ShortExternalOneByteInternalizedStringMap"),
("RO_SPACE", 0x04bf1): (106, "ShortExternalOneByteStringMap"),
("RO_SPACE", 0x04c59): (140, "FixedUint8ArrayMap"),
("RO_SPACE", 0x04cc1): (139, "FixedInt8ArrayMap"),
("RO_SPACE", 0x04d29): (142, "FixedUint16ArrayMap"),
("RO_SPACE", 0x04d91): (141, "FixedInt16ArrayMap"),
("RO_SPACE", 0x04df9): (144, "FixedUint32ArrayMap"),
("RO_SPACE", 0x04e61): (143, "FixedInt32ArrayMap"),
("RO_SPACE", 0x04ec9): (145, "FixedFloat32ArrayMap"),
("RO_SPACE", 0x04f31): (146, "FixedFloat64ArrayMap"),
("RO_SPACE", 0x04f99): (147, "FixedUint8ClampedArrayMap"),
("RO_SPACE", 0x05001): (149, "FixedBigUint64ArrayMap"),
("RO_SPACE", 0x05069): (148, "FixedBigInt64ArrayMap"),
("RO_SPACE", 0x050d1): (131, "SelfReferenceMarkerMap"),
("RO_SPACE", 0x05151): (171, "Tuple2Map"),
("RO_SPACE", 0x054a1): (161, "InterceptorInfoMap"),
("RO_SPACE", 0x055c1): (169, "ScriptMap"),
("RO_SPACE", 0x09e99): (154, "AccessorInfoMap"),
("RO_SPACE", 0x09f01): (153, "AccessCheckInfoMap"),
("RO_SPACE", 0x09f69): (155, "AccessorPairMap"),
("RO_SPACE", 0x09fd1): (156, "AliasedArgumentsEntryMap"),
("RO_SPACE", 0x0a039): (157, "AllocationMementoMap"),
("RO_SPACE", 0x0a0a1): (158, "AsyncGeneratorRequestMap"),
("RO_SPACE", 0x0a109): (159, "DebugInfoMap"),
("RO_SPACE", 0x0a171): (160, "FunctionTemplateInfoMap"),
("RO_SPACE", 0x0a1d9): (162, "InterpreterDataMap"),
("RO_SPACE", 0x0a241): (163, "ModuleInfoEntryMap"),
("RO_SPACE", 0x0a2a9): (164, "ModuleMap"),
("RO_SPACE", 0x0a311): (165, "ObjectTemplateInfoMap"),
("RO_SPACE", 0x0a379): (166, "PromiseCapabilityMap"),
("RO_SPACE", 0x0a3e1): (167, "PromiseReactionMap"),
("RO_SPACE", 0x0a449): (168, "PrototypeInfoMap"),
("RO_SPACE", 0x0a4b1): (170, "StackFrameInfoMap"),
("RO_SPACE", 0x0a519): (172, "Tuple3Map"),
("RO_SPACE", 0x0a581): (173, "ArrayBoilerplateDescriptionMap"),
("RO_SPACE", 0x0a5e9): (174, "WasmDebugInfoMap"),
("RO_SPACE", 0x0a651): (175, "WasmExportedFunctionDataMap"),
("RO_SPACE", 0x0a6b9): (176, "CallableTaskMap"),
("RO_SPACE", 0x0a721): (177, "CallbackTaskMap"),
("RO_SPACE", 0x0a789): (178, "PromiseFulfillReactionJobTaskMap"),
("RO_SPACE", 0x0a7f1): (179, "PromiseRejectReactionJobTaskMap"),
("RO_SPACE", 0x0a859): (180, "PromiseResolveThenableJobTaskMap"),
("RO_SPACE", 0x0a8c1): (181, "AllocationSiteMap"),
("RO_SPACE", 0x0a929): (181, "AllocationSiteMap"),
("MAP_SPACE", 0x02201): (1057, "ExternalMap"),
("MAP_SPACE", 0x02259): (1072, "JSMessageObjectMap"),
}
@ -325,26 +329,26 @@ KNOWN_OBJECTS = {
("RO_SPACE", 0x03149): "TerminationException",
("RO_SPACE", 0x03211): "OptimizedOut",
("RO_SPACE", 0x032d1): "StaleRegister",
("RO_SPACE", 0x050f9): "EmptyByteArray",
("RO_SPACE", 0x05121): "EmptyFixedUint8Array",
("RO_SPACE", 0x05141): "EmptyFixedInt8Array",
("RO_SPACE", 0x05161): "EmptyFixedUint16Array",
("RO_SPACE", 0x05181): "EmptyFixedInt16Array",
("RO_SPACE", 0x051a1): "EmptyFixedUint32Array",
("RO_SPACE", 0x051c1): "EmptyFixedInt32Array",
("RO_SPACE", 0x051e1): "EmptyFixedFloat32Array",
("RO_SPACE", 0x05201): "EmptyFixedFloat64Array",
("RO_SPACE", 0x05221): "EmptyFixedUint8ClampedArray",
("RO_SPACE", 0x05281): "EmptySloppyArgumentsElements",
("RO_SPACE", 0x052a1): "EmptySlowElementDictionary",
("RO_SPACE", 0x052e9): "EmptyOrderedHashMap",
("RO_SPACE", 0x05311): "EmptyOrderedHashSet",
("RO_SPACE", 0x05349): "EmptyPropertyCell",
("RO_SPACE", 0x05371): "EmptyWeakCell",
("RO_SPACE", 0x05461): "InfinityValue",
("RO_SPACE", 0x05471): "MinusZeroValue",
("RO_SPACE", 0x05481): "MinusInfinityValue",
("RO_SPACE", 0x05491): "SelfReferenceMarker",
("RO_SPACE", 0x051c9): "EmptyByteArray",
("RO_SPACE", 0x051f1): "EmptyFixedUint8Array",
("RO_SPACE", 0x05211): "EmptyFixedInt8Array",
("RO_SPACE", 0x05231): "EmptyFixedUint16Array",
("RO_SPACE", 0x05251): "EmptyFixedInt16Array",
("RO_SPACE", 0x05271): "EmptyFixedUint32Array",
("RO_SPACE", 0x05291): "EmptyFixedInt32Array",
("RO_SPACE", 0x052b1): "EmptyFixedFloat32Array",
("RO_SPACE", 0x052d1): "EmptyFixedFloat64Array",
("RO_SPACE", 0x052f1): "EmptyFixedUint8ClampedArray",
("RO_SPACE", 0x05351): "EmptySloppyArgumentsElements",
("RO_SPACE", 0x05371): "EmptySlowElementDictionary",
("RO_SPACE", 0x053b9): "EmptyOrderedHashMap",
("RO_SPACE", 0x053e1): "EmptyOrderedHashSet",
("RO_SPACE", 0x05419): "EmptyPropertyCell",
("RO_SPACE", 0x05441): "EmptyWeakCell",
("RO_SPACE", 0x05531): "InfinityValue",
("RO_SPACE", 0x05541): "MinusZeroValue",
("RO_SPACE", 0x05551): "MinusInfinityValue",
("RO_SPACE", 0x05561): "SelfReferenceMarker",
("OLD_SPACE", 0x02211): "EmptyScript",
("OLD_SPACE", 0x02291): "ManyClosuresCell",
("OLD_SPACE", 0x022b1): "NoElementsProtector",