[VM] Restore small intrinsics (which never take the fall-through path) on AOT
This reduces flutter gallery RX size by around 0.2% Change-Id: Iaf4db565ce42e70e0d1811b762820d2114daec9b Reviewed-on: https://dart-review.googlesource.com/72440 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
05ab41c99b
commit
ab7b1e3539
@@ -890,16 +890,25 @@ void FlowGraphCompiler::EmitPrologue() {
|
||||
// R4: arguments descriptor array.
|
||||
void FlowGraphCompiler::CompileGraph() {
|
||||
InitCompiler();
|
||||
#ifdef DART_PRECOMPILER
|
||||
const Function& function = parsed_function().function();
|
||||
if (function.IsDynamicFunction()) {
|
||||
SpecialStatsBegin(CombinedCodeStatistics::kTagCheckedEntry);
|
||||
__ MonomorphicCheckedEntry();
|
||||
SpecialStatsEnd(CombinedCodeStatistics::kTagCheckedEntry);
|
||||
}
|
||||
#endif // DART_PRECOMPILER
|
||||
if (FLAG_precompiled_mode) {
|
||||
const Function& function = parsed_function().function();
|
||||
if (function.IsDynamicFunction()) {
|
||||
SpecialStatsBegin(CombinedCodeStatistics::kTagCheckedEntry);
|
||||
__ MonomorphicCheckedEntry();
|
||||
SpecialStatsEnd(CombinedCodeStatistics::kTagCheckedEntry);
|
||||
}
|
||||
|
||||
// For JIT we have multiple entrypoints functionality which moved the
|
||||
// intrinsification as well as the setup of the frame to the
|
||||
// [TargetEntryInstr::EmitNativeCode].
|
||||
if (TryIntrinsify()) {
|
||||
// Skip regular code generation.
|
||||
return;
|
||||
}
|
||||
EmitFrameEntry();
|
||||
ASSERT(__ constant_pool_allowed());
|
||||
}
|
||||
|
||||
__ set_constant_pool_allowed(true);
|
||||
VisitBlocks();
|
||||
|
||||
__ bkpt(0);
|
||||
|
||||
@@ -842,18 +842,26 @@ void FlowGraphCompiler::EmitFrameEntry() {
|
||||
// R4: arguments descriptor array.
|
||||
void FlowGraphCompiler::CompileGraph() {
|
||||
InitCompiler();
|
||||
#ifdef DART_PRECOMPILER
|
||||
const Function& function = parsed_function().function();
|
||||
if (function.IsDynamicFunction()) {
|
||||
__ MonomorphicCheckedEntry();
|
||||
}
|
||||
#endif // DART_PRECOMPILER
|
||||
|
||||
if (FLAG_precompiled_mode) {
|
||||
const Function& function = parsed_function().function();
|
||||
if (function.IsDynamicFunction()) {
|
||||
SpecialStatsBegin(CombinedCodeStatistics::kTagCheckedEntry);
|
||||
__ MonomorphicCheckedEntry();
|
||||
SpecialStatsEnd(CombinedCodeStatistics::kTagCheckedEntry);
|
||||
}
|
||||
}
|
||||
|
||||
// For JIT we have multiple entrypoints functionality which moved the
|
||||
// intrinsification as well as the setup of the frame to the
|
||||
// [TargetEntryInstr::EmitNativeCode].
|
||||
//
|
||||
// Though this has not been implemented on ARM64, which is why this code here
|
||||
// is outside the "ifdef DART_PRECOMPILER".
|
||||
if (TryIntrinsify()) {
|
||||
// Skip regular code generation.
|
||||
return;
|
||||
}
|
||||
|
||||
EmitFrameEntry();
|
||||
ASSERT(assembler()->constant_pool_allowed());
|
||||
|
||||
|
||||
@@ -880,14 +880,25 @@ void FlowGraphCompiler::EmitPrologue() {
|
||||
|
||||
void FlowGraphCompiler::CompileGraph() {
|
||||
InitCompiler();
|
||||
#ifdef DART_PRECOMPILER
|
||||
const Function& function = parsed_function().function();
|
||||
if (function.IsDynamicFunction()) {
|
||||
__ MonomorphicCheckedEntry();
|
||||
}
|
||||
#endif // DART_PRECOMPILER
|
||||
|
||||
__ set_constant_pool_allowed(true);
|
||||
if (FLAG_precompiled_mode) {
|
||||
const Function& function = parsed_function().function();
|
||||
if (function.IsDynamicFunction()) {
|
||||
SpecialStatsBegin(CombinedCodeStatistics::kTagCheckedEntry);
|
||||
__ MonomorphicCheckedEntry();
|
||||
SpecialStatsEnd(CombinedCodeStatistics::kTagCheckedEntry);
|
||||
}
|
||||
|
||||
// For JIT we have multiple entrypoints functionality which moved the
|
||||
// intrinsification to the [TargetEntryInstr::EmitNativeCode].
|
||||
if (TryIntrinsify()) {
|
||||
// Skip regular code generation.
|
||||
return;
|
||||
}
|
||||
EmitFrameEntry();
|
||||
ASSERT(__ constant_pool_allowed());
|
||||
}
|
||||
|
||||
ASSERT(!block_order().is_empty());
|
||||
VisitBlocks();
|
||||
|
||||
|
||||
@@ -3620,16 +3620,26 @@ LocationSummary* TargetEntryInstr::MakeLocationSummary(Zone* zone,
|
||||
void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
__ Bind(compiler->GetJumpLabel(this));
|
||||
|
||||
// In the AOT compiler we want to reduce code size, so generate no
|
||||
// fall-through code in [FlowGraphCompiler::CompileGraph()].
|
||||
// (As opposed to here where we don't check for the return value of
|
||||
// [Intrinsify]).
|
||||
if (!FLAG_precompiled_mode) {
|
||||
#if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM)
|
||||
if (compiler->flow_graph().IsEntryPoint(this)) {
|
||||
__ set_constant_pool_allowed(false);
|
||||
// TODO(#34162): Don't emit more code if 'TryIntrinsify' returns 'true'
|
||||
// (meaning the function was fully intrinsified).
|
||||
compiler->TryIntrinsify();
|
||||
compiler->EmitPrologue();
|
||||
ASSERT(__ constant_pool_allowed());
|
||||
}
|
||||
if (compiler->flow_graph().IsEntryPoint(this)) {
|
||||
// NOTE: Because in JIT X64/ARM mode the graph can have multiple
|
||||
// entrypoints, so we generate several times the same intrinsification &
|
||||
// frame setup. That's why we cannot rely on the constant pool being
|
||||
// `false` when we come in here.
|
||||
__ set_constant_pool_allowed(false);
|
||||
// TODO(#34162): Don't emit more code if 'TryIntrinsify' returns 'true'
|
||||
// (meaning the function was fully intrinsified).
|
||||
compiler->TryIntrinsify();
|
||||
compiler->EmitPrologue();
|
||||
ASSERT(__ constant_pool_allowed());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!compiler->is_optimizing()) {
|
||||
#if !defined(TARGET_ARCH_DBC)
|
||||
|
||||
Reference in New Issue
Block a user