V8 Project
v8::internal::compiler::SimplifiedLowering Class Reference

#include <simplified-lowering.h>

+ Collaboration diagram for v8::internal::compiler::SimplifiedLowering:

Public Member Functions

 SimplifiedLowering (JSGraph *jsgraph)
 
virtual ~SimplifiedLowering ()
 
void LowerAllNodes ()
 
void DoLoadField (Node *node)
 
void DoStoreField (Node *node)
 
void DoLoadElement (Node *node)
 
void DoStoreElement (Node *node)
 
void DoStringAdd (Node *node)
 
void DoStringEqual (Node *node)
 
void DoStringLessThan (Node *node)
 
void DoStringLessThanOrEqual (Node *node)
 

Private Member Functions

Node * SmiTag (Node *node)
 
Node * IsTagged (Node *node)
 
Node * Untag (Node *node)
 
Node * OffsetMinusTagConstant (int32_t offset)
 
Node * ComputeIndex (const ElementAccess &access, Node *index)
 
Node * StringComparison (Node *node, bool requires_ordering)
 
Zonezone ()
 
JSGraphjsgraph ()
 
Graphgraph ()
 
CommonOperatorBuilder * common ()
 
MachineOperatorBuilder * machine ()
 

Private Attributes

JSGraphjsgraph_
 

Friends

class RepresentationSelector
 

Detailed Description

Definition at line 17 of file simplified-lowering.h.

Constructor & Destructor Documentation

◆ SimplifiedLowering()

v8::internal::compiler::SimplifiedLowering::SimplifiedLowering ( JSGraph jsgraph)
inlineexplicit

◆ ~SimplifiedLowering()

virtual v8::internal::compiler::SimplifiedLowering::~SimplifiedLowering ( )
inlinevirtual

Definition at line 20 of file simplified-lowering.h.

20 {}

Member Function Documentation

◆ common()

CommonOperatorBuilder* v8::internal::compiler::SimplifiedLowering::common ( )
inlineprivate

Definition at line 49 of file simplified-lowering.h.

49 { return jsgraph()->common(); }
CommonOperatorBuilder * common()
Definition: js-graph.h:87

References v8::internal::compiler::JSGraph::common(), and jsgraph().

Referenced by DoStringAdd(), StringComparison(), and v8::internal::compiler::RepresentationSelector::VisitPhi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ComputeIndex()

Node * v8::internal::compiler::SimplifiedLowering::ComputeIndex ( const ElementAccess access,
Node *  index 
)
private

Definition at line 855 of file simplified-lowering.cc.

856  {
857  int element_size = ElementSizeOf(access.machine_type);
858  if (element_size != 1) {
859  index = graph()->NewNode(machine()->Int32Mul(),
860  jsgraph()->Int32Constant(element_size), index);
861  }
862  int fixed_offset = access.header_size - access.tag();
863  if (fixed_offset == 0) return index;
864  return graph()->NewNode(machine()->Int32Add(), index,
865  jsgraph()->Int32Constant(fixed_offset));
866 }
Node * NewNode(const Operator *op, int input_count, Node **inputs)
Definition: graph.cc:24
int ElementSizeOf(MachineType machine_type)
Definition: machine-type.h:83

References v8::internal::compiler::ElementSizeOf(), graph(), v8::internal::compiler::ElementAccess::header_size, jsgraph(), machine(), v8::internal::compiler::ElementAccess::machine_type, v8::internal::compiler::Graph::NewNode(), and v8::internal::compiler::ElementAccess::tag().

Referenced by DoLoadElement(), and DoStoreElement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoLoadElement()

void v8::internal::compiler::SimplifiedLowering::DoLoadElement ( Node *  node)

Definition at line 869 of file simplified-lowering.cc.

869  {
870  const ElementAccess& access = ElementAccessOf(node->op());
871  node->set_op(machine()->Load(access.machine_type));
872  node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
873  node->RemoveInput(2);
874 }
Node * ComputeIndex(const ElementAccess &access, Node *index)
const ElementAccess & ElementAccessOf(const Operator *op)

References ComputeIndex(), v8::internal::compiler::ElementAccessOf(), machine(), and v8::internal::compiler::ElementAccess::machine_type.

Referenced by v8::internal::compiler::RepresentationSelector::VisitNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoLoadField()

void v8::internal::compiler::SimplifiedLowering::DoLoadField ( Node *  node)

Definition at line 836 of file simplified-lowering.cc.

836  {
837  const FieldAccess& access = FieldAccessOf(node->op());
838  node->set_op(machine()->Load(access.machine_type));
839  Node* offset = jsgraph()->Int32Constant(access.offset - access.tag());
840  node->InsertInput(zone(), 1, offset);
841 }
Node * Int32Constant(int32_t value)
Definition: js-graph.cc:150
const FieldAccess & FieldAccessOf(const Operator *op)

References v8::internal::compiler::FieldAccessOf(), v8::internal::compiler::JSGraph::Int32Constant(), jsgraph(), machine(), v8::internal::compiler::FieldAccess::machine_type, v8::internal::compiler::FieldAccess::offset, v8::internal::compiler::FieldAccess::tag(), and zone().

Referenced by v8::internal::compiler::RepresentationSelector::VisitNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoStoreElement()

void v8::internal::compiler::SimplifiedLowering::DoStoreElement ( Node *  node)

Definition at line 877 of file simplified-lowering.cc.

877  {
878  const ElementAccess& access = ElementAccessOf(node->op());
880  access.base_is_tagged, access.machine_type, access.type);
881  node->set_op(
882  machine()->Store(StoreRepresentation(access.machine_type, kind)));
883  node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
884  node->RemoveInput(2);
885 }
static WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged, MachineType representation, Type *type)

References v8::internal::compiler::ElementAccess::base_is_tagged, ComputeIndex(), v8::internal::compiler::ComputeWriteBarrierKind(), v8::internal::compiler::ElementAccessOf(), machine(), v8::internal::compiler::ElementAccess::machine_type, and v8::internal::compiler::ElementAccess::type.

Referenced by v8::internal::compiler::RepresentationSelector::VisitNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoStoreField()

void v8::internal::compiler::SimplifiedLowering::DoStoreField ( Node *  node)

Definition at line 844 of file simplified-lowering.cc.

844  {
845  const FieldAccess& access = FieldAccessOf(node->op());
847  access.base_is_tagged, access.machine_type, access.type);
848  node->set_op(
849  machine()->Store(StoreRepresentation(access.machine_type, kind)));
850  Node* offset = jsgraph()->Int32Constant(access.offset - access.tag());
851  node->InsertInput(zone(), 1, offset);
852 }

References v8::internal::compiler::FieldAccess::base_is_tagged, v8::internal::compiler::ComputeWriteBarrierKind(), v8::internal::compiler::FieldAccessOf(), v8::internal::compiler::JSGraph::Int32Constant(), jsgraph(), machine(), v8::internal::compiler::FieldAccess::machine_type, v8::internal::compiler::FieldAccess::offset, v8::internal::compiler::FieldAccess::tag(), v8::internal::compiler::FieldAccess::type, and zone().

Referenced by v8::internal::compiler::RepresentationSelector::VisitNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoStringAdd()

void v8::internal::compiler::SimplifiedLowering::DoStringAdd ( Node *  node)

Definition at line 888 of file simplified-lowering.cc.

888  {
889  Callable callable = CodeFactory::StringAdd(
890  zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
891  CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
892  CallDescriptor* desc =
893  Linkage::GetStubCallDescriptor(callable.descriptor(), 0, flags, zone());
894  node->set_op(common()->Call(desc));
895  node->InsertInput(zone(), 0, jsgraph()->HeapConstant(callable.code()));
896  node->AppendInput(zone(), jsgraph()->UndefinedConstant());
897  node->AppendInput(zone(), graph()->start());
898  node->AppendInput(zone(), graph()->start());
899 }
CallDescriptor * GetStubCallDescriptor(CallInterfaceDescriptor descriptor, int stack_parameter_count=0, CallDescriptor::Flags flags=CallDescriptor::kNoFlags)
Definition: linkage.cc:103
@ STRING_ADD_CHECK_NONE
Definition: code-stubs.h:1212

References common(), v8::internal::anonymous_namespace{flags.cc}::flags, v8::internal::compiler::Linkage::GetStubCallDescriptor(), graph(), jsgraph(), v8::internal::NOT_TENURED, v8::internal::STRING_ADD_CHECK_NONE, and zone().

Referenced by v8::internal::compiler::RepresentationSelector::VisitNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoStringEqual()

void v8::internal::compiler::SimplifiedLowering::DoStringEqual ( Node *  node)

Definition at line 921 of file simplified-lowering.cc.

921  {
922  node->set_op(machine()->WordEqual());
923  node->ReplaceInput(0, StringComparison(node, false));
924  node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
925 }
Node * StringComparison(Node *node, bool requires_ordering)

References v8::internal::EQUAL, jsgraph(), machine(), and StringComparison().

Referenced by v8::internal::compiler::RepresentationSelector::VisitNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoStringLessThan()

void v8::internal::compiler::SimplifiedLowering::DoStringLessThan ( Node *  node)

Definition at line 928 of file simplified-lowering.cc.

928  {
929  node->set_op(machine()->IntLessThan());
930  node->ReplaceInput(0, StringComparison(node, true));
931  node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
932 }

References v8::internal::EQUAL, jsgraph(), machine(), and StringComparison().

Referenced by v8::internal::compiler::RepresentationSelector::VisitNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoStringLessThanOrEqual()

void v8::internal::compiler::SimplifiedLowering::DoStringLessThanOrEqual ( Node *  node)

Definition at line 935 of file simplified-lowering.cc.

935  {
936  node->set_op(machine()->IntLessThanOrEqual());
937  node->ReplaceInput(0, StringComparison(node, true));
938  node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
939 }

References v8::internal::EQUAL, jsgraph(), machine(), and StringComparison().

Referenced by v8::internal::compiler::RepresentationSelector::VisitNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ graph()

Graph* v8::internal::compiler::SimplifiedLowering::graph ( )
inlineprivate

Definition at line 48 of file simplified-lowering.h.

48 { return jsgraph()->graph(); }

References v8::internal::compiler::JSGraph::graph(), and jsgraph().

Referenced by ComputeIndex(), DoStringAdd(), IsTagged(), LowerAllNodes(), SmiTag(), StringComparison(), and Untag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsTagged()

Node * v8::internal::compiler::SimplifiedLowering::IsTagged ( Node *  node)
private

Definition at line 787 of file simplified-lowering.cc.

787  {
788  // TODO(titzer): factor this out to a TaggingScheme abstraction.
789  STATIC_ASSERT(kSmiTagMask == 1); // Only works if tag is the low bit.
790  return graph()->NewNode(machine()->WordAnd(), node,
791  jsgraph()->Int32Constant(kSmiTagMask));
792 }
STATIC_ASSERT(DoubleRegister::kMaxNumAllocatableRegisters >=Register::kMaxNumAllocatableRegisters)
const intptr_t kSmiTagMask
Definition: v8.h:5744

References graph(), jsgraph(), v8::internal::kSmiTagMask, machine(), v8::internal::compiler::Graph::NewNode(), and v8::internal::compiler::STATIC_ASSERT().

+ Here is the call graph for this function:

◆ jsgraph()

JSGraph* v8::internal::compiler::SimplifiedLowering::jsgraph ( )
inlineprivate

Definition at line 47 of file simplified-lowering.h.

47 { return jsgraph_; }

References jsgraph_.

Referenced by common(), ComputeIndex(), DoLoadField(), DoStoreField(), DoStringAdd(), DoStringEqual(), DoStringLessThan(), DoStringLessThanOrEqual(), graph(), IsTagged(), LowerAllNodes(), machine(), OffsetMinusTagConstant(), SmiTag(), StringComparison(), and Untag().

+ Here is the caller graph for this function:

◆ LowerAllNodes()

void v8::internal::compiler::SimplifiedLowering::LowerAllNodes ( )

Definition at line 795 of file simplified-lowering.cc.

795  {
796  SimplifiedOperatorBuilder simplified(graph()->zone());
797  RepresentationChanger changer(jsgraph(), &simplified,
798  graph()->zone()->isolate());
799  RepresentationSelector selector(jsgraph(), zone(), &changer);
800  selector.Run(this);
801 }

References graph(), jsgraph(), v8::internal::compiler::RepresentationSelector::Run(), and zone().

Referenced by v8::internal::compiler::Pipeline::GenerateCode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ machine()

MachineOperatorBuilder* v8::internal::compiler::SimplifiedLowering::machine ( )
inlineprivate

Definition at line 50 of file simplified-lowering.h.

50 { return jsgraph()->machine(); }
MachineOperatorBuilder * machine()
Definition: js-graph.h:88

References jsgraph(), and v8::internal::compiler::JSGraph::machine().

Referenced by ComputeIndex(), DoLoadElement(), DoLoadField(), DoStoreElement(), DoStoreField(), DoStringEqual(), DoStringLessThan(), DoStringLessThanOrEqual(), IsTagged(), SmiTag(), Untag(), and v8::internal::compiler::RepresentationSelector::VisitNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OffsetMinusTagConstant()

Node * v8::internal::compiler::SimplifiedLowering::OffsetMinusTagConstant ( int32_t  offset)
private

Definition at line 818 of file simplified-lowering.cc.

818  {
819  return jsgraph()->Int32Constant(offset - kHeapObjectTag);
820 }
const int kHeapObjectTag
Definition: v8.h:5737

References v8::internal::compiler::JSGraph::Int32Constant(), jsgraph(), and v8::internal::kHeapObjectTag.

+ Here is the call graph for this function:

◆ SmiTag()

Node * v8::internal::compiler::SimplifiedLowering::SmiTag ( Node *  node)
private

Definition at line 811 of file simplified-lowering.cc.

811  {
812  // TODO(titzer): factor this out to a TaggingScheme abstraction.
813  Node* shift_amount = jsgraph()->Int32Constant(kSmiTagSize + kSmiShiftSize);
814  return graph()->NewNode(machine()->WordShl(), node, shift_amount);
815 }
const int kSmiTagSize
Definition: v8.h:5743
const int kSmiShiftSize
Definition: v8.h:5805

References graph(), v8::internal::compiler::JSGraph::Int32Constant(), jsgraph(), v8::internal::kSmiShiftSize, v8::internal::kSmiTagSize, machine(), and v8::internal::compiler::Graph::NewNode().

+ Here is the call graph for this function:

◆ StringComparison()

Node * v8::internal::compiler::SimplifiedLowering::StringComparison ( Node *  node,
bool  requires_ordering 
)
private

Definition at line 902 of file simplified-lowering.cc.

902  {
903  CEntryStub stub(zone()->isolate(), 1);
905  requires_ordering ? Runtime::kStringCompare : Runtime::kStringEquals;
906  ExternalReference ref(f, zone()->isolate());
907  Operator::Properties props = node->op()->properties();
908  // TODO(mstarzinger): We should call StringCompareStub here instead, once an
909  // interface descriptor is available for it.
910  CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(f, 2, props, zone());
911  return graph()->NewNode(common()->Call(desc),
912  jsgraph()->HeapConstant(stub.GetCode()),
915  jsgraph()->ExternalConstant(ref),
916  jsgraph()->Int32Constant(2),
917  jsgraph()->UndefinedConstant());
918 }
CallDescriptor * GetRuntimeCallDescriptor(Runtime::FunctionId function, int parameter_count, Operator::Properties properties)
Definition: linkage.cc:95
static Node * GetValueInput(Node *node, int index)
base::Flags< Property, uint8_t > Properties
Definition: operator.h:48

References common(), v8::internal::compiler::Linkage::GetRuntimeCallDescriptor(), v8::internal::compiler::NodeProperties::GetValueInput(), graph(), jsgraph(), v8::internal::compiler::Graph::NewNode(), and zone().

Referenced by DoStringEqual(), DoStringLessThan(), and DoStringLessThanOrEqual().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Untag()

Node * v8::internal::compiler::SimplifiedLowering::Untag ( Node *  node)
private

Definition at line 804 of file simplified-lowering.cc.

804  {
805  // TODO(titzer): factor this out to a TaggingScheme abstraction.
806  Node* shift_amount = jsgraph()->Int32Constant(kSmiTagSize + kSmiShiftSize);
807  return graph()->NewNode(machine()->WordSar(), node, shift_amount);
808 }

References graph(), v8::internal::compiler::JSGraph::Int32Constant(), jsgraph(), v8::internal::kSmiShiftSize, v8::internal::kSmiTagSize, machine(), and v8::internal::compiler::Graph::NewNode().

+ Here is the call graph for this function:

◆ zone()

Zone* v8::internal::compiler::SimplifiedLowering::zone ( )
inlineprivate

Definition at line 46 of file simplified-lowering.h.

46 { return jsgraph_->zone(); }

References jsgraph_, and v8::internal::compiler::JSGraph::zone().

Referenced by DoLoadField(), DoStoreField(), DoStringAdd(), LowerAllNodes(), and StringComparison().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ RepresentationSelector

friend class RepresentationSelector
friend

Definition at line 44 of file simplified-lowering.h.

Member Data Documentation

◆ jsgraph_

JSGraph* v8::internal::compiler::SimplifiedLowering::jsgraph_
private

Definition at line 35 of file simplified-lowering.h.

Referenced by jsgraph(), and zone().


The documentation for this class was generated from the following files: