c1df0d4c10
If the left-hand side of the store is an allocation and no GC-triggering instructions have been executed since, it is safe to elide the store barrier. This gives a 1.4% code size reduction on Flutter Gallery ARM32. Change-Id: Ib7227d3ef9d798d5e30f238f3f789f9a2e637d6a Cq-Include-Trybots: luci.dart.try: vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try Reviewed-on: https://dart-review.googlesource.com/64687 Commit-Queue: Samir Jindel <sjindel@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
104 lines
2.3 KiB
C++
104 lines
2.3 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_
|
|
|
|
#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_INSTRUCTION(DO)
|
|
#undef DO
|
|
|
|
#define DO(type, attrs) kTag##type##SlowPath,
|
|
FOR_EACH_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>(
|
|
CombinedCodeStatistics::kTagGraphEntrySlowPath + 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(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 const int kStackSize = 8;
|
|
|
|
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_
|