v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
maglev-graph-builder.cc File Reference
#include "src/maglev/maglev-graph-builder.h"
#include <algorithm>
#include <limits>
#include <optional>
#include <utility>
#include "src/base/bounds.h"
#include "src/base/ieee754.h"
#include "src/base/logging.h"
#include "src/base/vector.h"
#include "src/builtins/builtins-constructor.h"
#include "src/builtins/builtins.h"
#include "src/codegen/cpu-features.h"
#include "src/codegen/interface-descriptors-inl.h"
#include "src/common/assert-scope.h"
#include "src/common/globals.h"
#include "src/common/message-template.h"
#include "src/compiler/access-info.h"
#include "src/compiler/bytecode-liveness-map.h"
#include "src/compiler/compilation-dependencies.h"
#include "src/compiler/feedback-source.h"
#include "src/compiler/heap-refs.h"
#include "src/compiler/js-heap-broker-inl.h"
#include "src/compiler/js-heap-broker.h"
#include "src/compiler/processed-feedback.h"
#include "src/deoptimizer/deoptimize-reason.h"
#include "src/execution/protectors.h"
#include "src/flags/flags.h"
#include "src/handles/maybe-handles-inl.h"
#include "src/ic/handler-configuration-inl.h"
#include "src/interpreter/bytecode-array-iterator.h"
#include "src/interpreter/bytecode-flags-and-tokens.h"
#include "src/interpreter/bytecode-register.h"
#include "src/interpreter/bytecodes.h"
#include "src/maglev/maglev-compilation-info.h"
#include "src/maglev/maglev-compilation-unit.h"
#include "src/maglev/maglev-graph-printer.h"
#include "src/maglev/maglev-interpreter-frame-state.h"
#include "src/maglev/maglev-ir-inl.h"
#include "src/maglev/maglev-ir.h"
#include "src/numbers/conversions.h"
#include "src/numbers/ieee754.h"
#include "src/objects/arguments.h"
#include "src/objects/elements-kind.h"
#include "src/objects/feedback-vector.h"
#include "src/objects/fixed-array.h"
#include "src/objects/heap-number-inl.h"
#include "src/objects/instance-type-inl.h"
#include "src/objects/js-array.h"
#include "src/objects/js-function.h"
#include "src/objects/js-objects.h"
#include "src/objects/literal-objects-inl.h"
#include "src/objects/name-inl.h"
#include "src/objects/object-list-macros.h"
#include "src/objects/property-cell.h"
#include "src/objects/property-details.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/slots-inl.h"
#include "src/objects/type-hints.h"
#include "src/roots/roots.h"
#include "src/utils/utils.h"
#include "src/zone/zone.h"

Go to the source code of this file.

Classes

class  v8::internal::maglev::CallArguments
 
class  v8::internal::maglev::MaglevGraphBuilder::SaveCallSpeculationScope
 
class  v8::internal::maglev::MaglevGraphBuilder::DeoptFrameScope
 
class  v8::internal::maglev::MaglevGraphBuilder::MaglevSubGraphBuilder::Variable
 
class  v8::internal::maglev::MaglevGraphBuilder::MaglevSubGraphBuilder::Label
 
class  v8::internal::maglev::MaglevGraphBuilder::MaglevSubGraphBuilder::LoopLabel
 
class  v8::internal::maglev::MaglevGraphBuilder::MaglevSubGraphBuilder::BorrowParentKnownNodeAspectsAndVOs
 

Namespaces

namespace  v8
 
namespace  v8::internal
 
namespace  v8::internal::maglev
 

Macros

#define TRACE(...)
 
#define FAIL(...)
 
#define CASE(Name, ...)
 
#define NODE_FOR_OPERATION_HELPER(Name)
 
#define MAP_BINARY_OPERATION_TO_INT32_NODE(V)
 
#define MAP_UNARY_OPERATION_TO_INT32_NODE(V)
 
#define MAP_OPERATION_TO_FLOAT64_NODE(V)
 
#define CASE(op, _, identity)
 
#define SPECIALIZATION(op, OpNode, ...)
 
#define SPECIALIZATION(op, OpNode)
 
#define SHORT_STAR_VISITOR(Name, ...)
 
#define GENERATE_CASE(Name)
 
#define BUILD_AND_RETURN_LOAD_TYPED_ARRAY(Type)
 
#define BUILD_STORE_TYPED_ARRAY(Type, value)
 
#define CASE(Name)
 
#define TRACE_INLINING(...)
 
#define TRACE_CANNOT_INLINE(...)
 
#define MATH_UNARY_IEEE_BUILTIN_REDUCER(MathName, ExtName, EnumName)
 
#define CASE(Name, ...)
 
#define CASE(Name, _, arg_count)
 
#define DEBUG_BREAK(Name, ...)
 

Functions

template<Operation kOperation>
static constexpr std::optional< int > v8::internal::maglev::Int32Identity ()
 
template<Operation kOperation, typename type >
bool v8::internal::maglev::OperationValue (type left, type right)
 
NodeType v8::internal::maglev::StaticTypeForNode (compiler::JSHeapBroker *broker, LocalIsolate *isolate, ValueNode *node)
 

Macro Definition Documentation

◆ BUILD_AND_RETURN_LOAD_TYPED_ARRAY

#define BUILD_AND_RETURN_LOAD_TYPED_ARRAY ( Type)
Value:
return AddNewNode<Load##Type##TypedArrayElement>({object, index}, \
elements_kind);

◆ BUILD_STORE_TYPED_ARRAY

#define BUILD_STORE_TYPED_ARRAY ( Type,
value )
Value:
AddNewNode<Store##Type##TypedArrayElement>({object, index, (value)}, \
elements_kind);
OptionalOpIndex index
std::unique_ptr< ValueMirror > value

◆ CASE [1/5]

#define CASE ( Name)
Value:
case Opcode::k##Name: { \
return GetBooleanConstant( \
!value->Cast<Name>()->ToBoolean(local_isolate())); \
}

◆ CASE [2/5]

#define CASE ( Name,
_,
arg_count )
Value:
case Runtime::kInline##Name: \
DCHECK_IMPLIES(arg_count != -1, arg_count == args.register_count()); \
return VisitIntrinsic##Name(args);
base::Vector< const DirectHandle< Object > > args
Definition execution.cc:74

◆ CASE [3/5]

#define CASE ( Name,
... )
Value:
case Bytecode::k##Name: \
return GetResultLocationAndSizeForBytecode<Bytecode::k##Name, \
__VA_ARGS__>(iterator_);

◆ CASE [4/5]

#define CASE ( Name,
... )
Value:
case Builtin::k##Name: \
return TryReduce##Name(target, args);

◆ CASE [5/5]

#define CASE ( op,
_,
identity )
Value:
case Operation::k##op: \
return identity;

◆ DEBUG_BREAK

#define DEBUG_BREAK ( Name,
... )
Value:
ReduceResult MaglevGraphBuilder::Visit##Name() { UNREACHABLE(); }
#define UNREACHABLE()
Definition logging.h:67

Definition at line 15116 of file maglev-graph-builder.cc.

◆ FAIL

#define FAIL ( ...)
Value:
TRACE("Failed " << __func__ << ":" << __LINE__ << ": " << __VA_ARGS__); \
return {};
#define TRACE(...)

Definition at line 78 of file maglev-graph-builder.cc.

◆ GENERATE_CASE

#define GENERATE_CASE ( Name)
Value:
case Opcode::k##Name:

◆ MAP_BINARY_OPERATION_TO_INT32_NODE

#define MAP_BINARY_OPERATION_TO_INT32_NODE ( V)
Value:
V(Add, Int32AddWithOverflow, 0) \
V(Subtract, Int32SubtractWithOverflow, 0) \
V(Multiply, Int32MultiplyWithOverflow, 1) \
V(Divide, Int32DivideWithOverflow, 1) \
V(Modulus, Int32ModulusWithOverflow, {}) \
V(BitwiseAnd, Int32BitwiseAnd, ~0) \
V(BitwiseOr, Int32BitwiseOr, 0) \
V(BitwiseXor, Int32BitwiseXor, 0) \
V(ShiftLeft, Int32ShiftLeft, 0) \
V(ShiftRight, Int32ShiftRight, 0) \
V(ShiftRightLogical, Int32ShiftRightLogical, {})
#define V(Name)

Definition at line 2093 of file maglev-graph-builder.cc.

◆ MAP_OPERATION_TO_FLOAT64_NODE

#define MAP_OPERATION_TO_FLOAT64_NODE ( V)
Value:
V(Add, Float64Add) \
V(Subtract, Float64Subtract) \
V(Multiply, Float64Multiply) \
V(Divide, Float64Divide) \
V(Modulus, Float64Modulus) \
V(Exponentiate, Float64Exponentiate)

Definition at line 2114 of file maglev-graph-builder.cc.

◆ MAP_UNARY_OPERATION_TO_INT32_NODE

#define MAP_UNARY_OPERATION_TO_INT32_NODE ( V)
Value:
V(BitwiseNot, Int32BitwiseNot) \
V(Increment, Int32IncrementWithOverflow) \
V(Decrement, Int32DecrementWithOverflow) \
V(Negate, Int32NegateWithOverflow)

Definition at line 2106 of file maglev-graph-builder.cc.

◆ MATH_UNARY_IEEE_BUILTIN_REDUCER

#define MATH_UNARY_IEEE_BUILTIN_REDUCER ( MathName,
ExtName,
EnumName )
Value:
MaybeReduceResult MaglevGraphBuilder::TryReduce##MathName( \
compiler::JSFunctionRef target, CallArguments& args) { \
if (args.count() < 1) { \
return GetRootConstant(RootIndex::kNanValue); \
} \
if (!CanSpeculateCall()) { \
ValueRepresentation rep = args[0]->properties().value_representation(); \
if (rep == ValueRepresentation::kTagged || \
rep == ValueRepresentation::kHoleyFloat64) { \
return {}; \
} \
} \
ValueNode* value = \
GetFloat64ForToNumber(args[0], NodeType::kNumber, \
TaggedToFloat64ConversionType::kOnlyNumber); \
return AddNewNode<Float64Ieee754Unary>( \
{value}, Float64Ieee754Unary::Ieee754Function::k##EnumName); \
}

Definition at line 10408 of file maglev-graph-builder.cc.

◆ NODE_FOR_OPERATION_HELPER

#define NODE_FOR_OPERATION_HELPER ( Name)
Value:
template <> \
struct NodeForOperationHelper<Operation::k##Name> { \
using generic_type = Generic##Name; \
};
Operation
Definition operation.h:43

Definition at line 2057 of file maglev-graph-builder.cc.

◆ SHORT_STAR_VISITOR

#define SHORT_STAR_VISITOR ( Name,
... )
Value:
ReduceResult MaglevGraphBuilder::Visit##Name() { \
MoveNodeBetweenRegisters( \
interpreter::Register::virtual_accumulator(), \
interpreter::Register::FromShortStar(interpreter::Bytecode::k##Name)); \
return ReduceResult::Done(); \
}

Definition at line 3801 of file maglev-graph-builder.cc.

◆ SPECIALIZATION [1/2]

#define SPECIALIZATION ( op,
OpNode )
Value:
template <> \
struct Float64NodeForHelper<Operation::k##op> { \
using type = OpNode; \
};

Definition at line 2138 of file maglev-graph-builder.cc.

◆ SPECIALIZATION [2/2]

#define SPECIALIZATION ( op,
OpNode,
... )
Value:
template <> \
struct Int32NodeForHelper<Operation::k##op> { \
using type = OpNode; \
};

Definition at line 2138 of file maglev-graph-builder.cc.

◆ TRACE

#define TRACE ( ...)
Value:
if (v8_flags.trace_maglev_graph_building) { \
std::cout << __VA_ARGS__ << std::endl; \
}

Definition at line 73 of file maglev-graph-builder.cc.

◆ TRACE_CANNOT_INLINE

#define TRACE_CANNOT_INLINE ( ...)
Value:
TRACE_INLINING(" cannot inline " << shared << ": " << __VA_ARGS__)
#define TRACE_INLINING(...)

Definition at line 8329 of file maglev-graph-builder.cc.

◆ TRACE_INLINING

#define TRACE_INLINING ( ...)
Value:
do { \
if (v8_flags.trace_maglev_inlining) \
StdoutStream{} << __VA_ARGS__ << std::endl; \
} while (false)

Definition at line 8323 of file maglev-graph-builder.cc.

Variable Documentation

◆ any_map_is_unstable_

bool any_map_is_unstable_ = false
private

Definition at line 5067 of file maglev-graph-builder.cc.

◆ broker_

compiler::JSHeapBroker* broker_
private

Definition at line 5060 of file maglev-graph-builder.cc.

◆ emit_check_with_migration_

bool emit_check_with_migration_ = false
private

Definition at line 5066 of file maglev-graph-builder.cc.

◆ existing_known_maps_found_

bool existing_known_maps_found_ = true
private

Definition at line 5065 of file maglev-graph-builder.cc.

◆ intersect_set_

compiler::ZoneRefSet<Map> intersect_set_
private

Definition at line 5063 of file maglev-graph-builder.cc.

◆ known_maps_are_subset_of_requested_maps_

bool known_maps_are_subset_of_requested_maps_ = true
private

Definition at line 5064 of file maglev-graph-builder.cc.

◆ node_type_

NodeType node_type_ = EmptyNodeType()
private

Definition at line 5068 of file maglev-graph-builder.cc.

◆ requested_maps_

base::Vector<const compiler::MapRef> requested_maps_
private

Definition at line 5062 of file maglev-graph-builder.cc.

◆ zone_

Zone* zone_
private

Definition at line 5061 of file maglev-graph-builder.cc.