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#include "src/objects/js-objects.h" 11 12namespace v8 { 13namespace internal { 14namespace compiler { 15 16// The nci flag is currently used to experiment with feedback collection in 17// optimized code produced by generic lowering. 18// Considerations: 19// - Should we increment the call count? https://crbug.com/v8/10524 20// - Is feedback already megamorphic in all these cases? 21// 22// TODO(jgruber): Remove once we've made a decision whether to collect feedback 23// unconditionally. 24inline bool CollectFeedbackInGenericLowering() { 25 return FLAG_turbo_collect_feedback_in_generic_lowering; 26} 27 28enum class StackCheckKind { 29 kJSFunctionEntry = 0, 30 kJSIterationBody, 31 kCodeStubAssembler, 32 kWasm, 33}; 34 35inline std::ostream& operator<<(std::ostream& os, StackCheckKind kind) { 36 switch (kind) { 37 case StackCheckKind::kJSFunctionEntry: 38 return os << "JSFunctionEntry"; 39 case StackCheckKind::kJSIterationBody: 40 return os << "JSIterationBody"; 41 case StackCheckKind::kCodeStubAssembler: 42 return os << "CodeStubAssembler"; 43 case StackCheckKind::kWasm: 44 return os << "Wasm"; 45 } 46 UNREACHABLE(); 47} 48 49inline size_t hash_value(StackCheckKind kind) { 50 return static_cast<size_t>(kind); 51} 52 53// The CallFeedbackRelation provides the meaning of the call feedback for a 54// TurboFan JSCall operator 55// - kReceiver: The call target was Function.prototype.apply and its receiver 56// was recorded as the feedback value. 57// - kTarget: The call target was recorded as the feedback value. 58// - kUnrelated: The feedback is no longer related to the call. If, during 59// lowering, a JSCall (e.g. of a higher order function) is replaced by a 60// JSCall with another target, the feedback has to be kept but is now 61// unrelated. 62enum class CallFeedbackRelation { kReceiver, kTarget, kUnrelated }; 63 64inline std::ostream& operator<<(std::ostream& os, 65 CallFeedbackRelation call_feedback_relation) { 66 switch (call_feedback_relation) { 67 case CallFeedbackRelation::kReceiver: 68 return os << "CallFeedbackRelation::kReceiver"; 69 case CallFeedbackRelation::kTarget: 70 return os << "CallFeedbackRelation::kTarget"; 71 case CallFeedbackRelation::kUnrelated: 72 return os << "CallFeedbackRelation::kUnrelated"; 73 } 74 UNREACHABLE(); 75 return os; 76} 77 78// Maximum depth and total number of elements and properties for literal 79// graphs to be considered for fast deep-copying. The limit is chosen to 80// match the maximum number of inobject properties, to ensure that the 81// performance of using object literals is not worse than using constructor 82// functions, see crbug.com/v8/6211 for details. 83const int kMaxFastLiteralDepth = 3; 84const int kMaxFastLiteralProperties = JSObject::kMaxInObjectProperties; 85 86} // namespace compiler 87} // namespace internal 88} // namespace v8 89 90// Support for floating point parameters in calls to C. 91// It's currently enabled only for the platforms listed below. We don't plan 92// to add support for IA32, because it has a totally different approach 93// (using FP stack). As support is added to more platforms, please make sure 94// to list them here in order to enable tests of this functionality. 95// Make sure to sync the following with src/d8/d8-test.cc. 96#if defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_ARM64) 97#define V8_ENABLE_FP_PARAMS_IN_C_LINKAGE 98#endif 99 100#endif // V8_COMPILER_GLOBALS_H_ 101