0a238b3828
- There is no C20, so that stays at C17 - Math between different enum types disallowed, use explicit cast - operator++ removed from volatile types - stream print for wchar_t removed TEST=build Bug: https://github.com/dart-lang/sdk/issues/42074 Change-Id: Ie552b0bf24f8ac8991336c61fd4bd4913da42909 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393622 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
109 lines
2.6 KiB
C++
109 lines
2.6 KiB
C++
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef RUNTIME_VM_COMPILER_BACKEND_CODE_STATISTICS_H_
|
|
#define RUNTIME_VM_COMPILER_BACKEND_CODE_STATISTICS_H_
|
|
|
|
#if defined(DART_PRECOMPILED_RUNTIME)
|
|
#error "AOT runtime should not use compiler sources (including header files)"
|
|
#endif // defined(DART_PRECOMPILED_RUNTIME)
|
|
|
|
#include "vm/compiler/assembler/assembler.h"
|
|
#include "vm/compiler/backend/il.h"
|
|
#include "vm/object.h"
|
|
|
|
namespace dart {
|
|
|
|
class CombinedCodeStatistics {
|
|
public:
|
|
// clang-format off
|
|
enum EntryCounter {
|
|
#define DO(type, attrs) kTag##type,
|
|
FOR_EACH_CONCRETE_INSTRUCTION(DO)
|
|
#undef DO
|
|
|
|
#define DO(type, attrs) kTag##type##SlowPath,
|
|
FOR_EACH_CONCRETE_INSTRUCTION(DO)
|
|
#undef DO
|
|
|
|
kTagAssertAssignableParameterCheck,
|
|
kTagAssertAssignableInsertedByFrontend,
|
|
kTagAssertAssignableFromSource,
|
|
|
|
kTagCheckedEntry,
|
|
kTagIntrinsics,
|
|
|
|
kNumEntries,
|
|
};
|
|
// clang-format on
|
|
|
|
CombinedCodeStatistics();
|
|
|
|
void Begin(Instruction* instruction);
|
|
void End(Instruction* instruction);
|
|
|
|
void DumpStatistics();
|
|
|
|
static EntryCounter SlowPathCounterFor(Instruction::Tag tag) {
|
|
return static_cast<CombinedCodeStatistics::EntryCounter>(
|
|
static_cast<uint32_t>(CombinedCodeStatistics::kTagGraphEntrySlowPath) +
|
|
static_cast<uint32_t>(tag));
|
|
}
|
|
|
|
private:
|
|
friend class CodeStatistics;
|
|
|
|
static int CompareEntries(const void* a, const void* b);
|
|
|
|
typedef struct {
|
|
const char* name;
|
|
intptr_t bytes;
|
|
intptr_t count;
|
|
} Entry;
|
|
|
|
Entry entries_[kNumEntries];
|
|
intptr_t unaccounted_bytes_;
|
|
intptr_t alignment_bytes_;
|
|
intptr_t object_header_bytes_;
|
|
intptr_t return_const_count_;
|
|
intptr_t return_const_with_load_field_count_;
|
|
};
|
|
|
|
class CodeStatistics {
|
|
public:
|
|
explicit CodeStatistics(compiler::Assembler* assembler);
|
|
|
|
void Begin(Instruction* instruction);
|
|
void End(Instruction* instruction);
|
|
|
|
void SpecialBegin(intptr_t tag);
|
|
void SpecialEnd(intptr_t tag);
|
|
|
|
void AppendTo(CombinedCodeStatistics* stat);
|
|
|
|
void Finalize();
|
|
|
|
private:
|
|
static constexpr int kStackSize = 8;
|
|
|
|
compiler::Assembler* assembler_;
|
|
|
|
typedef struct {
|
|
intptr_t bytes;
|
|
intptr_t count;
|
|
} Entry;
|
|
|
|
Entry entries_[CombinedCodeStatistics::kNumEntries];
|
|
intptr_t instruction_bytes_;
|
|
intptr_t unaccounted_bytes_;
|
|
intptr_t alignment_bytes_;
|
|
|
|
intptr_t stack_[kStackSize];
|
|
intptr_t stack_index_;
|
|
};
|
|
|
|
} // namespace dart
|
|
|
|
#endif // RUNTIME_VM_COMPILER_BACKEND_CODE_STATISTICS_H_
|