5#if !defined(DART_PRECOMPILED_RUNTIME)
24 : line_starts_data_(line_starts_data) {
26 if (
type == kUint16ArrayElement) {
27 helper_ =
new KernelUint16LineStartsHelper();
28 }
else if (
type == kUint32ArrayElement) {
29 helper_ =
new KernelUint32LineStartsHelper();
36 const intptr_t line_count = line_starts_data_.
Length();
37 if (line_count == 0) {
40 return helper_->At(line_starts_data_, line_count - 1);
45 intptr_t* col)
const {
46 const intptr_t line_count = line_starts_data_.
Length();
47 if (position < 0 ||
static_cast<uint32_t
>(position) >
MaxPosition() ||
53 intptr_t hi = line_count;
55 const intptr_t mid = lo + (hi - lo) / 2;
56 const intptr_t mid_position = helper_->At(line_starts_data_, mid);
57 if (mid_position > position) {
65 *col = position - helper_->At(line_starts_data_, lo) + 1;
75 const intptr_t line_count = line_starts_data_.
Length();
76 if (line_number <= 0 || line_number > line_count) {
80 helper_->At(line_starts_data_, line_number - 1));
81 if (line_number == line_count) {
82 *last_token_index = *first_token_index;
85 helper_->At(line_starts_data_, line_number) - 1);
90uint32_t KernelLineStartsReader::KernelUint16LineStartsHelper::At(
92 intptr_t index)
const {
93 return data.GetUint16(index << 1);
96uint32_t KernelLineStartsReader::KernelUint32LineStartsHelper::At(
98 intptr_t index)
const {
99 return data.GetUint32(index << 2);
109 intptr_t data_program_offset,
110 intptr_t initial_script_index,
111 intptr_t record_for_script_id,
114 current_script_id_(initial_script_index),
115 record_for_script_id_(record_for_script_id),
116 record_token_positions_into_(record_token_positions_into) {}
125 intptr_t current_script_id_;
126 intptr_t record_for_script_id_;
133 intptr_t kernel_offset) {
137 if (tag == kProcedure) {
140 }
else if (tag == kConstructor) {
143 }
else if (tag == kFunctionNode) {
146 }
else if (tag == kField) {
149 }
else if (tag == kClass) {
159 if (record_for_script_id_ == current_script_id_ &&
160 record_token_positions_into_ !=
nullptr && position.
IsReal()) {
161 record_token_positions_into_->
Add(position.
Serialize());
180 return Object::empty_array().ptr();
186 for (intptr_t current = 1; current <
size; ++current) {
188 (*source)[++last] =
source->At(current);
194 for (intptr_t
i = 0;
i <= last; ++
i) {
196 array_object.
SetAt(
i, smi_value);
198 return array_object.
ptr();
204 intptr_t kernel_offset,
205 intptr_t data_kernel_offset,
209 if (kernel_data.
IsNull()) {
214 zone, helper,
script, kernel_data, data_kernel_offset,
215 script.kernel_script_index(),
script.kernel_script_index(),
227 const auto& kernel_info =
237 zone, isolate_group->object_store()->libraries());
243 auto& interesting_script = *
this;
248 for (intptr_t
i = 0;
i <
libs.Length();
i++) {
255 if (entry.IsClass()) {
256 const Class& klass = Class::Cast(entry);
257 if (klass.
script() == interesting_script.ptr()) {
262 temp_array = klass.
fields();
263 for (intptr_t
i = 0;
i < temp_array.Length(); ++
i) {
264 temp_field ^= temp_array.At(
i);
265 if (temp_field.kernel_offset() <= 0) {
269 entry_script = temp_field.Script();
270 if (entry_script.
ptr() != interesting_script.ptr()) {
273 data = temp_field.KernelLibrary();
275 temp_field.kernel_offset(),
276 temp_field.KernelLibraryOffset(),
277 zone, &helper, &token_positions);
280 for (intptr_t
i = 0;
i < temp_array.Length(); ++
i) {
281 temp_function ^= temp_array.At(
i);
282 entry_script = temp_function.script();
283 if (entry_script.
ptr() != interesting_script.ptr()) {
286 data = temp_function.KernelLibrary();
288 data, interesting_script, temp_function.kernel_offset(),
289 temp_function.KernelLibraryOffset(), zone, &helper,
298 ASSERT(library_kernel_offset > 0);
301 entry_script = klass.
script();
302 if (entry_script.
ptr() != interesting_script.ptr()) {
306 data, interesting_script, class_offset, library_kernel_offset,
307 zone, &helper, &token_positions);
309 }
else if (entry.IsFunction()) {
310 temp_function ^= entry.
ptr();
311 entry_script = temp_function.script();
312 if (entry_script.
ptr() != interesting_script.ptr()) {
315 data = temp_function.KernelLibrary();
317 temp_function.kernel_offset(),
318 temp_function.KernelLibraryOffset(),
319 zone, &helper, &token_positions);
320 }
else if (entry.IsField()) {
321 const Field& field = Field::Cast(entry);
326 entry_script = field.
Script();
327 if (entry_script.
ptr() != interesting_script.ptr()) {
341 script.set_debug_positions(array_object);
344#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
350 const auto& interesting_script = *
this;
352 const auto& kernel_info =
362 const intptr_t constant_coverage_constructors =
364 const Array& constructors =
366 for (intptr_t
i = 0;
i < constant_coverage_constructors; ++
i) {
375 return constructors.
ptr();
385 if (setjmp(*jump.
Set()) == 0) {
389 auto& kernel_program_info =
418 intptr_t data_program_offset,
421 constant_reader_(this, active_class) {}
424 bool is_annotations_offset) {
430 if (!is_annotations_offset) {
436 }
else if (tag == kProcedure) {
439 }
else if (tag == kField) {
442 }
else if (tag == kConstructor) {
445 }
else if (tag == kFunctionDeclaration) {
452 FATAL(
"No support for metadata on this type of kernel node: %" Pd32
468 intptr_t kernel_offset,
469 bool is_annotations_offset) {
471 if (setjmp(*jump.
Set()) == 0) {
475 const auto& kernel_info =
488 is_annotations_offset);
500 intptr_t data_program_offset,
503 constant_reader_(this, active_class) {}
522 intptr_t named_parameter_count = param_count - positional_count;
526 for (intptr_t
i = 0;
i < param_count; ++
i) {
529 if (
i == positional_count) {
530 intptr_t named_parameter_count_check =
532 ASSERT(named_parameter_count_check == named_parameter_count);
543 if ((tag == kSomething) && !
function.is_abstract()) {
550 if (tag == kSomething) {
554 Object::null_instance());
567 Object::null_instance());
570 return param_descriptor.
ptr();
575 if (setjmp(*jump.
Set()) == 0) {
579 const auto& kernel_info =
591 function.KernelLibraryOffset(), &active_class);
605 const intptr_t num_params =
function.NumParameters();
607 ASSERT(is_generic_covariant_impl->
length() == num_params);
609 const auto& kernel_info =
616 zone, &translation_helper,
628 const intptr_t num_positional_params = reader_helper.
ReadListLength();
629 intptr_t param_index =
function.NumImplicitParameters();
630 for (intptr_t
i = 0;
i < num_positional_params; ++
i, ++param_index) {
635 is_covariant->
Add(param_index);
638 is_generic_covariant_impl->
Add(param_index);
644 for (intptr_t
i = 0;
i < num_named_params; ++
i, ++param_index) {
649 is_covariant->
Add(param_index);
652 is_generic_covariant_impl->
Add(param_index);
662 if (
function.IsClosureFunction())
return false;
671 if (
function.IsRecordFieldGetter()) {
680 if (
function.IsInvokeFieldDispatcher()) {
691 if (
function.MaxNumberOfParametersInRegisters(zone) > 0) {
697 if (
function.IsImplicitGetterFunction()) {
705 if (
function.IsImplicitSetterFunction()) {
707 return !(field.is_covariant() || field.is_generic_covariant_impl());
710 const auto& type_params =
712 if (!type_params.IsNull()) {
714 for (intptr_t
i = 0, n = type_params.Length();
i < n; ++
i) {
715 bound = type_params.BoundAt(
i);
716 if (!bound.IsTopTypeForSubtyping() &&
717 !type_params.IsGenericCovariantImplAt(
i)) {
723 const intptr_t num_params =
function.NumParameters();
724 BitVector is_covariant(zone, num_params);
725 BitVector is_generic_covariant_impl(zone, num_params);
729 for (intptr_t
i =
function.NumImplicitParameters();
i < num_params; ++
i) {
731 if (!
type.IsTopTypeForSubtyping() &&
744 intptr_t kernel_data_program_offset,
745 intptr_t kernel_offset) {
749 kernel_data_program_offset);
760 const auto& kernel_program_info =
763 zone, kernel_program_info,
770 const auto& kernel_program_info =
773 zone, kernel_program_info,
782 intptr_t kernel_data_program_offset,
783 intptr_t kernel_offset) {
787 kernel_data_program_offset);
794 const auto& kernel_program_info =
797 zone, kernel_program_info,
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
void SetAt(intptr_t index, const Object &value) const
bool Contains(intptr_t i) const
static const Bool & False()
static const Bool & True()
intptr_t kernel_offset() const
TokenPosition token_pos() const
TokenPosition end_token_pos() const
bool is_finalized() const
ArrayPtr current_functions() const
intptr_t kernel_offset() const
intptr_t KernelLibraryOffset() const
TypedDataViewPtr KernelLibrary() const
KernelProgramInfoPtr KernelProgramInfo() const
void EnsureTopLevelClassIsFinalized() const
TypedDataViewPtr KernelLibrary() const
ClassPtr toplevel_class() const
intptr_t KernelLibraryOffset() const
KernelProgramInfoPtr kernel_program_info() const
static Object & ZoneHandle()
@ kParameterDefaultValueOffset
@ kParameterIsFinalOffset
@ kParameterMetadataOffset
void CollectTokenPositionsFor() const
ArrayPtr CollectConstConstructorCoverageFrom() const
static SmiPtr New(intptr_t value)
static Thread * Current()
DART_WARN_UNUSED_RESULT ErrorPtr StealStickyError()
IsolateGroup * isolate_group() const
int32_t Serialize() const
static TokenPosition Deserialize(int32_t value)
TypedDataElementType ElementType() const
void ReadUntilExcluding(Field field)
InstancePtr ReadConstantExpression()
ObjectPtr ReadAnnotations()
InstancePtr ReadConstantInitializer()
void ReadUntilExcluding(Field field)
void ReadUntilExcluding(Field field)
intptr_t total_parameter_count_
void ReadUntilExcluding(Field field)
DART_WARN_UNUSED_RESULT bool LocationForPosition(intptr_t position, intptr_t *line, intptr_t *col=nullptr) const
KernelLineStartsReader(const dart::TypedData &line_starts_data, dart::Zone *zone)
uint32_t MaxPosition() const
DART_WARN_UNUSED_RESULT bool TokenRangeAtLine(intptr_t line_number, dart::TokenPosition *first_token_index, dart::TokenPosition *last_token_index) const
void SetOffset(intptr_t offset)
void ReadUntilFunctionNode()
intptr_t ReadListLength()
TokenPosition ReadPosition()
Tag ReadTag(uint8_t *payload=nullptr)
virtual void ReportUnexpectedTag(const char *variant, Tag tag)
Tag PeekTag(uint8_t *payload=nullptr)
NameIndex ReadCanonicalNameReference()
KernelTokenPositionCollector(Zone *zone, TranslationHelper *translation_helper, const Script &script, const TypedDataView &data, intptr_t data_program_offset, intptr_t initial_script_index, intptr_t record_for_script_id, GrowableArray< intptr_t > *record_token_positions_into)
void CollectTokenPositions(intptr_t kernel_offset)
void RecordTokenPosition(TokenPosition position) override
void set_current_script_id(intptr_t id) override
ObjectPtr BuildParameterDescriptor(const Function &function)
ParameterDescriptorBuilder(TranslationHelper *translation_helper, Zone *zone, const TypedDataView &data, intptr_t data_program_offset, ActiveClass *active_class)
void ReadUntilExcluding(Field field)
void InitFromKernelProgramInfo(const KernelProgramInfo &info)
FunctionPtr LookupConstructorByKernelConstructor(NameIndex constructor, bool required=true)
NameIndex EnclosingName(NameIndex name)
virtual ClassPtr LookupClassByKernelClass(NameIndex klass, bool required=true)
bool IsGenericCovariantImpl() const
intptr_t annotation_count_
void ReadUntilExcluding(Field field)
Dart_NativeFunction function
ObjectPtr BuildParameterDescriptor(const Function &function)
static void CollectKernelLibraryTokenPositions(const TypedDataView &kernel_data, const Script &script, intptr_t kernel_offset, intptr_t data_kernel_offset, Zone *zone, TranslationHelper *helper, GrowableArray< intptr_t > *token_positions)
static int LowestFirst(const intptr_t *a, const intptr_t *b)
bool NeedsDynamicInvocationForwarder(const Function &function)
void ReadParameterCovariance(const Function &function, BitVector *is_covariant, BitVector *is_generic_covariant_impl)
static ProcedureAttributesMetadata ProcedureAttributesOf(Zone *zone, const KernelProgramInfo &kernel_program_info, const TypedDataView &kernel_data, intptr_t kernel_data_program_offset, intptr_t kernel_offset)
TableSelectorMetadata * TableSelectorMetadataForProgram(const KernelProgramInfo &info, Zone *zone)
ObjectPtr EvaluateMetadata(const Library &library, intptr_t kernel_offset, bool is_annotations_offset)
static UnboxingInfoMetadata * UnboxingInfoMetadataOf(Zone *zone, const KernelProgramInfo &kernel_program_info, const TypedDataView &kernel_data, intptr_t kernel_data_program_offset, intptr_t kernel_offset)
static ArrayPtr AsSortedDuplicateFreeArray(GrowableArray< intptr_t > *source)
ObjectPtr EvaluateStaticConstFieldInitializer(const Field &field)
static int8_t data[kExtLength]
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size