| 1 | // Copyright (c) 2019, 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_CODE_ENTRY_KIND_H_ |
| 6 | #define RUNTIME_VM_CODE_ENTRY_KIND_H_ |
| 7 | |
| 8 | namespace dart { |
| 9 | |
| 10 | // Compiled functions might have several different entry points, which either |
| 11 | // perform additional checking on entry into the function or skip some of the |
| 12 | // checks normally performed on the entry. |
| 13 | // |
| 14 | // Which checks are performed and skipped depend on the function and VM mode. |
| 15 | enum class CodeEntryKind { |
| 16 | // Normal entry into the function. |
| 17 | // |
| 18 | // Usually such entries perform type checks for all parameters which are not |
| 19 | // guaranteed to be type checked on the callee side. This can happen if |
| 20 | // parameter type depends on the type parameter of an enclosing class. |
| 21 | kNormal, |
| 22 | |
| 23 | // Unchecked entry into the function. |
| 24 | // |
| 25 | // These entries usually skip most of the type checks that normal entries |
| 26 | // perform and are used when optimizing compiler can prove that those |
| 27 | // checks are not needed at a specific call site. |
| 28 | kUnchecked, |
| 29 | |
| 30 | // Monomorphic entry into the function. |
| 31 | // |
| 32 | // In AOT mode we might patch call-site to directly invoke target function, |
| 33 | // which would then validate that it is invoked with the expected type of |
| 34 | // the receiver. This validation is handled by monomorphic entry, which then |
| 35 | // falls through to the normal entry. |
| 36 | kMonomorphic, |
| 37 | |
| 38 | // Similar to monomorphic entry but with a fallthrough into unchecked entry. |
| 39 | kMonomorphicUnchecked, |
| 40 | }; |
| 41 | |
| 42 | } // namespace dart |
| 43 | |
| 44 | #endif // RUNTIME_VM_CODE_ENTRY_KIND_H_ |
| 45 | |