11cb0ef41Sopenharmony_ci// Copyright 2019 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_COMPILER_GLOBALS_H_ 61cb0ef41Sopenharmony_ci#define V8_COMPILER_GLOBALS_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include "src/common/globals.h" 91cb0ef41Sopenharmony_ci#include "src/flags/flags.h" 101cb0ef41Sopenharmony_ci#include "src/objects/js-objects.h" 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cinamespace v8 { 131cb0ef41Sopenharmony_cinamespace internal { 141cb0ef41Sopenharmony_cinamespace compiler { 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci// The nci flag is currently used to experiment with feedback collection in 171cb0ef41Sopenharmony_ci// optimized code produced by generic lowering. 181cb0ef41Sopenharmony_ci// Considerations: 191cb0ef41Sopenharmony_ci// - Should we increment the call count? https://crbug.com/v8/10524 201cb0ef41Sopenharmony_ci// - Is feedback already megamorphic in all these cases? 211cb0ef41Sopenharmony_ci// 221cb0ef41Sopenharmony_ci// TODO(jgruber): Remove once we've made a decision whether to collect feedback 231cb0ef41Sopenharmony_ci// unconditionally. 241cb0ef41Sopenharmony_ciinline bool CollectFeedbackInGenericLowering() { 251cb0ef41Sopenharmony_ci return FLAG_turbo_collect_feedback_in_generic_lowering; 261cb0ef41Sopenharmony_ci} 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_cienum class StackCheckKind { 291cb0ef41Sopenharmony_ci kJSFunctionEntry = 0, 301cb0ef41Sopenharmony_ci kJSIterationBody, 311cb0ef41Sopenharmony_ci kCodeStubAssembler, 321cb0ef41Sopenharmony_ci kWasm, 331cb0ef41Sopenharmony_ci}; 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ciinline std::ostream& operator<<(std::ostream& os, StackCheckKind kind) { 361cb0ef41Sopenharmony_ci switch (kind) { 371cb0ef41Sopenharmony_ci case StackCheckKind::kJSFunctionEntry: 381cb0ef41Sopenharmony_ci return os << "JSFunctionEntry"; 391cb0ef41Sopenharmony_ci case StackCheckKind::kJSIterationBody: 401cb0ef41Sopenharmony_ci return os << "JSIterationBody"; 411cb0ef41Sopenharmony_ci case StackCheckKind::kCodeStubAssembler: 421cb0ef41Sopenharmony_ci return os << "CodeStubAssembler"; 431cb0ef41Sopenharmony_ci case StackCheckKind::kWasm: 441cb0ef41Sopenharmony_ci return os << "Wasm"; 451cb0ef41Sopenharmony_ci } 461cb0ef41Sopenharmony_ci UNREACHABLE(); 471cb0ef41Sopenharmony_ci} 481cb0ef41Sopenharmony_ci 491cb0ef41Sopenharmony_ciinline size_t hash_value(StackCheckKind kind) { 501cb0ef41Sopenharmony_ci return static_cast<size_t>(kind); 511cb0ef41Sopenharmony_ci} 521cb0ef41Sopenharmony_ci 531cb0ef41Sopenharmony_ci// The CallFeedbackRelation provides the meaning of the call feedback for a 541cb0ef41Sopenharmony_ci// TurboFan JSCall operator 551cb0ef41Sopenharmony_ci// - kReceiver: The call target was Function.prototype.apply and its receiver 561cb0ef41Sopenharmony_ci// was recorded as the feedback value. 571cb0ef41Sopenharmony_ci// - kTarget: The call target was recorded as the feedback value. 581cb0ef41Sopenharmony_ci// - kUnrelated: The feedback is no longer related to the call. If, during 591cb0ef41Sopenharmony_ci// lowering, a JSCall (e.g. of a higher order function) is replaced by a 601cb0ef41Sopenharmony_ci// JSCall with another target, the feedback has to be kept but is now 611cb0ef41Sopenharmony_ci// unrelated. 621cb0ef41Sopenharmony_cienum class CallFeedbackRelation { kReceiver, kTarget, kUnrelated }; 631cb0ef41Sopenharmony_ci 641cb0ef41Sopenharmony_ciinline std::ostream& operator<<(std::ostream& os, 651cb0ef41Sopenharmony_ci CallFeedbackRelation call_feedback_relation) { 661cb0ef41Sopenharmony_ci switch (call_feedback_relation) { 671cb0ef41Sopenharmony_ci case CallFeedbackRelation::kReceiver: 681cb0ef41Sopenharmony_ci return os << "CallFeedbackRelation::kReceiver"; 691cb0ef41Sopenharmony_ci case CallFeedbackRelation::kTarget: 701cb0ef41Sopenharmony_ci return os << "CallFeedbackRelation::kTarget"; 711cb0ef41Sopenharmony_ci case CallFeedbackRelation::kUnrelated: 721cb0ef41Sopenharmony_ci return os << "CallFeedbackRelation::kUnrelated"; 731cb0ef41Sopenharmony_ci } 741cb0ef41Sopenharmony_ci UNREACHABLE(); 751cb0ef41Sopenharmony_ci return os; 761cb0ef41Sopenharmony_ci} 771cb0ef41Sopenharmony_ci 781cb0ef41Sopenharmony_ci// Maximum depth and total number of elements and properties for literal 791cb0ef41Sopenharmony_ci// graphs to be considered for fast deep-copying. The limit is chosen to 801cb0ef41Sopenharmony_ci// match the maximum number of inobject properties, to ensure that the 811cb0ef41Sopenharmony_ci// performance of using object literals is not worse than using constructor 821cb0ef41Sopenharmony_ci// functions, see crbug.com/v8/6211 for details. 831cb0ef41Sopenharmony_ciconst int kMaxFastLiteralDepth = 3; 841cb0ef41Sopenharmony_ciconst int kMaxFastLiteralProperties = JSObject::kMaxInObjectProperties; 851cb0ef41Sopenharmony_ci 861cb0ef41Sopenharmony_ci} // namespace compiler 871cb0ef41Sopenharmony_ci} // namespace internal 881cb0ef41Sopenharmony_ci} // namespace v8 891cb0ef41Sopenharmony_ci 901cb0ef41Sopenharmony_ci// Support for floating point parameters in calls to C. 911cb0ef41Sopenharmony_ci// It's currently enabled only for the platforms listed below. We don't plan 921cb0ef41Sopenharmony_ci// to add support for IA32, because it has a totally different approach 931cb0ef41Sopenharmony_ci// (using FP stack). As support is added to more platforms, please make sure 941cb0ef41Sopenharmony_ci// to list them here in order to enable tests of this functionality. 951cb0ef41Sopenharmony_ci// Make sure to sync the following with src/d8/d8-test.cc. 961cb0ef41Sopenharmony_ci#if defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_ARM64) 971cb0ef41Sopenharmony_ci#define V8_ENABLE_FP_PARAMS_IN_C_LINKAGE 981cb0ef41Sopenharmony_ci#endif 991cb0ef41Sopenharmony_ci 1001cb0ef41Sopenharmony_ci#endif // V8_COMPILER_GLOBALS_H_ 101