Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
prologue_builder.h
Go to the documentation of this file.
1// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_COMPILER_FRONTEND_PROLOGUE_BUILDER_H_
6#define RUNTIME_VM_COMPILER_FRONTEND_PROLOGUE_BUILDER_H_
7
8#if defined(DART_PRECOMPILED_RUNTIME)
9#error "AOT runtime should not use compiler sources (including header files)"
10#endif // defined(DART_PRECOMPILED_RUNTIME)
11
13
14namespace dart {
15namespace kernel {
16
17// Responsible for building IR code for prologues of functions.
18//
19// This code handles initialization of local variables which the
20// prologue needs to setup, including initialization of the:
21//
22// * current context variable, from the passed closure object
23// * function_type_arguments variable, from the stack above fp
24// * raw parameter variables, from the stack above fp
25//
26// if needed.
27//
28// Furthermore it performs all necessary checks which could lead into a
29// no-such-method bailout, including check that:
30//
31// * the number of passed positional arguments is correct
32// * the names of passed named arguments are correct
33// * the number of function type arguments is correct
34//
35// if needed.
36//
37// Most of these things are done by interpreting the caller-supplied arguments
38// descriptor.
40 public:
41 PrologueBuilder(const ParsedFunction* parsed_function,
42 intptr_t last_used_id,
43 bool compiling_for_osr,
44 bool is_inlining)
45 : BaseFlowGraphBuilder(parsed_function, last_used_id),
46 compiling_for_osr_(compiling_for_osr),
47 is_inlining_(is_inlining) {}
48
50 PrologueInfo* prologue_info);
51
53
54 static bool HasEmptyPrologue(const Function& function);
56
57 intptr_t last_used_block_id() const { return last_used_block_id_; }
58
59 private:
60 Fragment BuildClosureContextHandling();
61
62 Fragment BuildTypeArgumentsHandling();
63
64 Fragment BuildClosureDelayedTypeArgumentsHandling();
65
66 LocalVariable* ParameterVariable(intptr_t index) {
68 }
69
70 const Instance& DefaultParameterValueAt(intptr_t i) {
73 }
74 // Only invocation dispatchers that have compile-time arguments
75 // descriptors lack default parameter values (because their functions only
76 // have optional named parameters, all of which are provided in calls.)
78 return Instance::null_instance();
79 }
80
81 void SortOptionalNamedParametersInto(int* opt_param_position,
82 int num_fixed_params,
83 int num_params);
84
85 bool compiling_for_osr_;
86 bool is_inlining_;
87};
88
89} // namespace kernel
90} // namespace dart
91
92#endif // RUNTIME_VM_COMPILER_FRONTEND_PROLOGUE_BUILDER_H_
ZoneGrowableArray< const Instance * > * default_parameter_values() const
Definition parser.h:124
const Instance & DefaultParameterValueAt(intptr_t i) const
Definition parser.h:119
LocalVariable * RawParameterVariable(intptr_t i) const
Definition parser.h:235
BlockEntryInstr * BuildPrologue(BlockEntryInstr *entry, PrologueInfo *prologue_info)
static bool HasEmptyPrologue(const Function &function)
static bool PrologueSkippableOnUncheckedEntry(const Function &function)
PrologueBuilder(const ParsedFunction *parsed_function, intptr_t last_used_id, bool compiling_for_osr, bool is_inlining)
#define ASSERT(E)
Dart_NativeFunction function
Definition fuchsia.cc:51