• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_COMPILER_GLOBALS_H_
6 #define V8_COMPILER_GLOBALS_H_
7 
8 #include "src/common/globals.h"
9 #include "src/flags/flags.h"
10 
11 namespace v8 {
12 namespace internal {
13 namespace compiler {
14 
15 // The nci flag is currently used to experiment with feedback collection in
16 // optimized code produced by generic lowering.
17 // Considerations:
18 // - Should we increment the call count? https://crbug.com/v8/10524
19 // - Is feedback already megamorphic in all these cases?
20 //
21 // TODO(jgruber): Remove once we've made a decision whether to collect feedback
22 // unconditionally.
CollectFeedbackInGenericLowering()23 inline bool CollectFeedbackInGenericLowering() {
24   return FLAG_turbo_collect_feedback_in_generic_lowering;
25 }
26 
27 enum class StackCheckKind {
28   kJSFunctionEntry = 0,
29   kJSIterationBody,
30   kCodeStubAssembler,
31   kWasm,
32 };
33 
34 inline std::ostream& operator<<(std::ostream& os, StackCheckKind kind) {
35   switch (kind) {
36     case StackCheckKind::kJSFunctionEntry:
37       return os << "JSFunctionEntry";
38     case StackCheckKind::kJSIterationBody:
39       return os << "JSIterationBody";
40     case StackCheckKind::kCodeStubAssembler:
41       return os << "CodeStubAssembler";
42     case StackCheckKind::kWasm:
43       return os << "Wasm";
44   }
45   UNREACHABLE();
46 }
47 
hash_value(StackCheckKind kind)48 inline size_t hash_value(StackCheckKind kind) {
49   return static_cast<size_t>(kind);
50 }
51 
52 // The CallFeedbackRelation states whether the target feedback stored with a
53 // JSCall is related to the call. If, during lowering, a JSCall (e.g. of a
54 // higher order function) is replaced by a JSCall with another target, the
55 // feedback has to be kept but is now unrelated.
56 enum class CallFeedbackRelation { kRelated, kUnrelated };
57 
58 inline std::ostream& operator<<(std::ostream& os,
59                                 CallFeedbackRelation call_feedback_relation) {
60   switch (call_feedback_relation) {
61     case CallFeedbackRelation::kRelated:
62       return os << "CallFeedbackRelation::kRelated";
63     case CallFeedbackRelation::kUnrelated:
64       return os << "CallFeedbackRelation::kUnrelated";
65   }
66   UNREACHABLE();
67   return os;
68 }
69 
70 }  // namespace compiler
71 }  // namespace internal
72 }  // namespace v8
73 
74 // Support for floating point parameters in calls to C.
75 // It's currently enabled only for the platforms listed below. We don't plan
76 // to add support for IA32, because it has a totally different approach
77 // (using FP stack). As support is added to more platforms, please make sure
78 // to list them here in order to enable tests of this functionality.
79 #if defined(V8_TARGET_ARCH_X64)
80 #define V8_ENABLE_FP_PARAMS_IN_C_LINKAGE
81 #endif
82 
83 #endif  // V8_COMPILER_GLOBALS_H_
84