From c679efc44000ba731e3b394f4f23a15e26cce375 Mon Sep 17 00:00:00 2001 From: Tobias Tebbi Date: Thu, 19 Dec 2019 23:05:11 +0100 Subject: [PATCH] [turbofan] make GraphAssembler isolate independent This enables using the GraphAssembler for Wasm. Change-Id: Id1f46db6cc05c9de6e878fb062434211a9c390ff Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1977160 Commit-Queue: Tobias Tebbi Reviewed-by: Michael Stanton Cr-Commit-Position: refs/heads/master@{#65552} --- src/compiler/effect-control-linearizer.cc | 4 +- src/compiler/graph-assembler.cc | 119 ++++++++-------- src/compiler/graph-assembler.h | 161 ++++++++++++---------- src/compiler/js-call-reducer.cc | 24 ++-- src/compiler/memory-lowering.cc | 2 +- src/compiler/memory-lowering.h | 6 +- src/compiler/memory-optimizer.h | 2 +- src/compiler/pipeline.cc | 2 +- src/compiler/scheduled-machine-lowering.h | 4 +- src/compiler/select-lowering.cc | 2 +- src/compiler/select-lowering.h | 8 +- 11 files changed, 178 insertions(+), 156 deletions(-) diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc index 8cd40bc17e..b527676fc1 100644 --- a/src/compiler/effect-control-linearizer.cc +++ b/src/compiler/effect-control-linearizer.cc @@ -274,7 +274,7 @@ class EffectControlLinearizer { return js_graph_->simplified(); } MachineOperatorBuilder* machine() const { return js_graph_->machine(); } - GraphAssembler* gasm() { return &graph_assembler_; } + JSGraphAssembler* gasm() { return &graph_assembler_; } JSGraph* js_graph_; Schedule* schedule_; @@ -284,7 +284,7 @@ class EffectControlLinearizer { RegionObservability region_observability_ = RegionObservability::kObservable; SourcePositionTable* source_positions_; NodeOriginTable* node_origins_; - GraphAssembler graph_assembler_; + JSGraphAssembler graph_assembler_; Node* frame_state_zapper_; // For tracking down compiler::Node::New crashes. }; diff --git a/src/compiler/graph-assembler.cc b/src/compiler/graph-assembler.cc index 3489e0cd71..29fb22b275 100644 --- a/src/compiler/graph-assembler.cc +++ b/src/compiler/graph-assembler.cc @@ -335,27 +335,28 @@ BasicBlock* GraphAssembler::BasicBlockUpdater::Finalize(BasicBlock* original) { return block; } -GraphAssembler::GraphAssembler(JSGraph* jsgraph, Zone* zone, Schedule* schedule) +GraphAssembler::GraphAssembler(MachineGraph* mcgraph, Zone* zone, + Schedule* schedule) : temp_zone_(zone), - jsgraph_(jsgraph), + mcgraph_(mcgraph), effect_(nullptr), control_(nullptr), block_updater_(schedule != nullptr ? new BasicBlockUpdater( - schedule, jsgraph->graph(), zone) + schedule, mcgraph->graph(), zone) : nullptr) {} GraphAssembler::~GraphAssembler() = default; Node* GraphAssembler::IntPtrConstant(intptr_t value) { - return AddClonedNode(jsgraph()->IntPtrConstant(value)); + return AddClonedNode(mcgraph()->IntPtrConstant(value)); } Node* GraphAssembler::Int32Constant(int32_t value) { - return AddClonedNode(jsgraph()->Int32Constant(value)); + return AddClonedNode(mcgraph()->Int32Constant(value)); } Node* GraphAssembler::Int64Constant(int64_t value) { - return AddClonedNode(jsgraph()->Int64Constant(value)); + return AddClonedNode(mcgraph()->Int64Constant(value)); } Node* GraphAssembler::UniqueIntPtrConstant(intptr_t value) { @@ -365,37 +366,37 @@ Node* GraphAssembler::UniqueIntPtrConstant(intptr_t value) { : common()->Int32Constant(static_cast(value)))); } -Node* GraphAssembler::SmiConstant(int32_t value) { +Node* JSGraphAssembler::SmiConstant(int32_t value) { return AddClonedNode(jsgraph()->SmiConstant(value)); } Node* GraphAssembler::Uint32Constant(uint32_t value) { - return AddClonedNode(jsgraph()->Uint32Constant(value)); + return AddClonedNode(mcgraph()->Uint32Constant(value)); } Node* GraphAssembler::Float64Constant(double value) { - return AddClonedNode(jsgraph()->Float64Constant(value)); + return AddClonedNode(mcgraph()->Float64Constant(value)); } -TNode GraphAssembler::HeapConstant(Handle object) { +TNode JSGraphAssembler::HeapConstant(Handle object) { return TNode::UncheckedCast( AddClonedNode(jsgraph()->HeapConstant(object))); } -TNode GraphAssembler::Constant(const ObjectRef& ref) { +TNode JSGraphAssembler::Constant(const ObjectRef& ref) { return TNode::UncheckedCast(AddClonedNode(jsgraph()->Constant(ref))); } -TNode GraphAssembler::NumberConstant(double value) { +TNode JSGraphAssembler::NumberConstant(double value) { return TNode::UncheckedCast( AddClonedNode(jsgraph()->Constant(value))); } Node* GraphAssembler::ExternalConstant(ExternalReference ref) { - return AddClonedNode(jsgraph()->ExternalConstant(ref)); + return AddClonedNode(mcgraph()->ExternalConstant(ref)); } -Node* GraphAssembler::CEntryStubConstant(int result_size) { +Node* JSGraphAssembler::CEntryStubConstant(int result_size) { return AddClonedNode(jsgraph()->CEntryStubConstant(result_size)); } @@ -404,17 +405,17 @@ Node* GraphAssembler::LoadFramePointer() { } #define SINGLETON_CONST_DEF(Name, Type) \ - TNode GraphAssembler::Name##Constant() { \ + TNode JSGraphAssembler::Name##Constant() { \ return TNode::UncheckedCast( \ AddClonedNode(jsgraph()->Name##Constant())); \ } JSGRAPH_SINGLETON_CONSTANT_LIST(SINGLETON_CONST_DEF) #undef SINGLETON_CONST_DEF -#define SINGLETON_CONST_TEST_DEF(Name, ...) \ - TNode GraphAssembler::Is##Name(TNode value) { \ - return TNode::UncheckedCast( \ - ReferenceEqual(value, Name##Constant())); \ +#define SINGLETON_CONST_TEST_DEF(Name, ...) \ + TNode JSGraphAssembler::Is##Name(TNode value) { \ + return TNode::UncheckedCast( \ + ReferenceEqual(value, Name##Constant())); \ } JSGRAPH_SINGLETON_CONSTANT_LIST(SINGLETON_CONST_TEST_DEF) #undef SINGLETON_CONST_TEST_DEF @@ -485,115 +486,118 @@ Node* GraphAssembler::Projection(int index, Node* value) { graph()->NewNode(common()->Projection(index), value, control())); } -Node* GraphAssembler::Allocate(AllocationType allocation, Node* size) { +Node* JSGraphAssembler::Allocate(AllocationType allocation, Node* size) { return AddNode( graph()->NewNode(simplified()->AllocateRaw(Type::Any(), allocation), size, effect(), control())); } -Node* GraphAssembler::LoadField(FieldAccess const& access, Node* object) { +Node* JSGraphAssembler::LoadField(FieldAccess const& access, Node* object) { Node* value = AddNode(graph()->NewNode(simplified()->LoadField(access), object, effect(), control())); return value; } -Node* GraphAssembler::LoadElement(ElementAccess const& access, Node* object, - Node* index) { +Node* JSGraphAssembler::LoadElement(ElementAccess const& access, Node* object, + Node* index) { Node* value = AddNode(graph()->NewNode(simplified()->LoadElement(access), object, index, effect(), control())); return value; } -Node* GraphAssembler::StoreField(FieldAccess const& access, Node* object, - Node* value) { +Node* JSGraphAssembler::StoreField(FieldAccess const& access, Node* object, + Node* value) { return AddNode(graph()->NewNode(simplified()->StoreField(access), object, value, effect(), control())); } -Node* GraphAssembler::StoreElement(ElementAccess const& access, Node* object, - Node* index, Node* value) { +Node* JSGraphAssembler::StoreElement(ElementAccess const& access, Node* object, + Node* index, Node* value) { return AddNode(graph()->NewNode(simplified()->StoreElement(access), object, index, value, effect(), control())); } -void GraphAssembler::TransitionAndStoreElement(MapRef double_map, - MapRef fast_map, - TNode object, - TNode index, - TNode value) { +void JSGraphAssembler::TransitionAndStoreElement(MapRef double_map, + MapRef fast_map, + TNode object, + TNode index, + TNode value) { AddNode(graph()->NewNode(simplified()->TransitionAndStoreElement( double_map.object(), fast_map.object()), object, index, value, effect(), control())); } -TNode GraphAssembler::StringLength(TNode string) { +TNode JSGraphAssembler::StringLength(TNode string) { return AddNode( graph()->NewNode(simplified()->StringLength(), string)); } -TNode GraphAssembler::ReferenceEqual(TNode lhs, - TNode rhs) { +TNode JSGraphAssembler::ReferenceEqual(TNode lhs, + TNode rhs) { return AddNode( graph()->NewNode(simplified()->ReferenceEqual(), lhs, rhs)); } -TNode GraphAssembler::NumberMin(TNode lhs, TNode rhs) { +TNode JSGraphAssembler::NumberMin(TNode lhs, + TNode rhs) { return AddNode(graph()->NewNode(simplified()->NumberMin(), lhs, rhs)); } -TNode GraphAssembler::NumberMax(TNode lhs, TNode rhs) { +TNode JSGraphAssembler::NumberMax(TNode lhs, + TNode rhs) { return AddNode(graph()->NewNode(simplified()->NumberMax(), lhs, rhs)); } -TNode GraphAssembler::NumberAdd(TNode lhs, TNode rhs) { +TNode JSGraphAssembler::NumberAdd(TNode lhs, + TNode rhs) { return AddNode(graph()->NewNode(simplified()->NumberAdd(), lhs, rhs)); } -TNode GraphAssembler::NumberSubtract(TNode lhs, - TNode rhs) { +TNode JSGraphAssembler::NumberSubtract(TNode lhs, + TNode rhs) { return AddNode( graph()->NewNode(simplified()->NumberSubtract(), lhs, rhs)); } -TNode GraphAssembler::NumberLessThan(TNode lhs, - TNode rhs) { +TNode JSGraphAssembler::NumberLessThan(TNode lhs, + TNode rhs) { return AddNode( graph()->NewNode(simplified()->NumberLessThan(), lhs, rhs)); } -TNode GraphAssembler::NumberLessThanOrEqual(TNode lhs, - TNode rhs) { +TNode JSGraphAssembler::NumberLessThanOrEqual(TNode lhs, + TNode rhs) { return AddNode( graph()->NewNode(simplified()->NumberLessThanOrEqual(), lhs, rhs)); } -TNode GraphAssembler::StringSubstring(TNode string, - TNode from, - TNode to) { +TNode JSGraphAssembler::StringSubstring(TNode string, + TNode from, + TNode to) { return AddNode(graph()->NewNode( simplified()->StringSubstring(), string, from, to, effect(), control())); } -TNode GraphAssembler::ObjectIsCallable(TNode value) { +TNode JSGraphAssembler::ObjectIsCallable(TNode value) { return AddNode( graph()->NewNode(simplified()->ObjectIsCallable(), value)); } -Node* GraphAssembler::CheckIf(Node* cond, DeoptimizeReason reason) { +Node* JSGraphAssembler::CheckIf(Node* cond, DeoptimizeReason reason) { return AddNode(graph()->NewNode(simplified()->CheckIf(reason), cond, effect(), control())); } -TNode GraphAssembler::NumberIsFloat64Hole(TNode value) { +TNode JSGraphAssembler::NumberIsFloat64Hole(TNode value) { return AddNode( graph()->NewNode(simplified()->NumberIsFloat64Hole(), value)); } -TNode GraphAssembler::ToBoolean(TNode value) { +TNode JSGraphAssembler::ToBoolean(TNode value) { return AddNode(graph()->NewNode(simplified()->ToBoolean(), value)); } -TNode GraphAssembler::MaybeGrowFastElements( +TNode JSGraphAssembler::MaybeGrowFastElements( ElementsKind kind, const FeedbackSource& feedback, TNode array, TNode elements, TNode new_length, TNode old_length) { @@ -677,7 +681,7 @@ Node* GraphAssembler::UnsafePointerAdd(Node* base, Node* external) { effect(), control())); } -TNode GraphAssembler::ToNumber(TNode value) { +TNode JSGraphAssembler::ToNumber(TNode value) { return AddNode(graph()->NewNode(ToNumberOperator(), ToNumberBuiltinConstant(), value, NoContextConstant(), effect())); @@ -798,7 +802,7 @@ void GraphAssembler::GotoIfBasicBlock(BasicBlock* block, Node* branch, BasicBlock* GraphAssembler::FinalizeCurrentBlock(BasicBlock* block) { if (block_updater_) { block = block_updater_->Finalize(block); - if (control() == jsgraph()->Dead()) { + if (control() == mcgraph()->Dead()) { // If the block's end is unreachable, then reset current effect and // control to that of the block's throw control node. DCHECK(block->control() == BasicBlock::kThrow); @@ -814,7 +818,7 @@ void GraphAssembler::ConnectUnreachableToEnd() { DCHECK_EQ(effect()->opcode(), IrOpcode::kUnreachable); Node* throw_node = graph()->NewNode(common()->Throw(), effect(), control()); NodeProperties::MergeControlToEnd(graph(), common(), throw_node); - effect_ = control_ = jsgraph()->Dead(); + effect_ = control_ = mcgraph()->Dead(); if (block_updater_) { block_updater_->AddThrow(throw_node); } @@ -856,10 +860,9 @@ void GraphAssembler::InitializeEffectControl(Node* effect, Node* control) { control_ = control; } -Operator const* GraphAssembler::ToNumberOperator() { +Operator const* JSGraphAssembler::ToNumberOperator() { if (!to_number_operator_.is_set()) { - Callable callable = - Builtins::CallableFor(jsgraph()->isolate(), Builtins::kToNumber); + Callable callable = Builtins::CallableFor(isolate(), Builtins::kToNumber); CallDescriptor::Flags flags = CallDescriptor::kNoFlags; auto call_descriptor = Linkage::GetStubCallDescriptor( graph()->zone(), callable.descriptor(), diff --git a/src/compiler/graph-assembler.h b/src/compiler/graph-assembler.h index 418e9ad583..c3f19d56dd 100644 --- a/src/compiler/graph-assembler.h +++ b/src/compiler/graph-assembler.h @@ -232,7 +232,8 @@ class V8_EXPORT_PRIVATE GraphAssembler { public: // Constructs a GraphAssembler. If {schedule} is not null, the graph assembler // will maintain the schedule as it updates blocks. - GraphAssembler(JSGraph* jsgraph, Zone* zone, Schedule* schedule = nullptr); + GraphAssembler(MachineGraph* jsgraph, Zone* zone, + Schedule* schedule = nullptr); virtual ~GraphAssembler(); void Reset(BasicBlock* block); @@ -271,26 +272,12 @@ class V8_EXPORT_PRIVATE GraphAssembler { Node* Int32Constant(int32_t value); Node* Int64Constant(int64_t value); Node* UniqueIntPtrConstant(intptr_t value); - Node* SmiConstant(int32_t value); Node* Float64Constant(double value); Node* Projection(int index, Node* value); - TNode HeapConstant(Handle object); - TNode Constant(const ObjectRef& ref); - TNode NumberConstant(double value); - Node* CEntryStubConstant(int result_size); Node* ExternalConstant(ExternalReference ref); Node* LoadFramePointer(); -#define SINGLETON_CONST_DECL(Name, Type) TNode Name##Constant(); - JSGRAPH_SINGLETON_CONSTANT_LIST(SINGLETON_CONST_DECL) -#undef SINGLETON_CONST_DECL - -#define SINGLETON_CONST_TEST_DECL(Name, ...) \ - TNode Is##Name(TNode value); - JSGRAPH_SINGLETON_CONSTANT_LIST(SINGLETON_CONST_TEST_DECL) -#undef SINGLETON_CONST_TEST_DECL - #define PURE_UNOP_DECL(Name) Node* Name(Node* input); PURE_ASSEMBLER_MACH_UNOP_LIST(PURE_UNOP_DECL) #undef PURE_UNOP_DECL @@ -314,54 +301,9 @@ class V8_EXPORT_PRIVATE GraphAssembler { Node* Float64RoundDown(Node* value); Node* Float64RoundTruncate(Node* value); - TNode ToNumber(TNode value); Node* BitcastWordToTagged(Node* value); Node* BitcastTaggedToWord(Node* value); Node* BitcastTaggedToWordForTagAndSmiBits(Node* value); - Node* Allocate(AllocationType allocation, Node* size); - Node* LoadField(FieldAccess const&, Node* object); - template - TNode LoadField(FieldAccess const& access, TNode object) { - // TODO(jgruber): Investigate issues on ptr compression bots and enable. - // DCHECK(IsMachineRepresentationOf( - // access.machine_type.representation())); - return TNode::UncheckedCast(LoadField(access, object)); - } - Node* LoadElement(ElementAccess const&, Node* object, Node* index); - template - TNode LoadElement(ElementAccess const& access, TNode object, - TNode index) { - // TODO(jgruber): Investigate issues on ptr compression bots and enable. - // DCHECK(IsMachineRepresentationOf( - // access.machine_type.representation())); - return TNode::UncheckedCast(LoadElement(access, object, index)); - } - Node* StoreField(FieldAccess const&, Node* object, Node* value); - Node* StoreElement(ElementAccess const&, Node* object, Node* index, - Node* value); - void TransitionAndStoreElement(MapRef double_map, MapRef fast_map, - TNode object, TNode index, - TNode value); - TNode StringLength(TNode string); - TNode ReferenceEqual(TNode lhs, TNode rhs); - TNode NumberMin(TNode lhs, TNode rhs); - TNode NumberMax(TNode lhs, TNode rhs); - TNode NumberLessThan(TNode lhs, TNode rhs); - TNode NumberLessThanOrEqual(TNode lhs, TNode rhs); - TNode NumberAdd(TNode lhs, TNode rhs); - TNode NumberSubtract(TNode lhs, TNode rhs); - TNode StringSubstring(TNode string, TNode from, - TNode to); - TNode ObjectIsCallable(TNode value); - Node* CheckIf(Node* cond, DeoptimizeReason reason); - TNode NumberIsFloat64Hole(TNode value); - TNode ToBoolean(TNode value); - TNode MaybeGrowFastElements(ElementsKind kind, - const FeedbackSource& feedback, - TNode array, - TNode elements, - TNode new_length, - TNode old_length); Node* TypeGuard(Type type, Node* value); Node* Checkpoint(FrameState frame_state); @@ -468,17 +410,11 @@ class V8_EXPORT_PRIVATE GraphAssembler { V8_INLINE Node* AddClonedNode(Node* node); - Operator const* ToNumberOperator(); - - JSGraph* jsgraph() const { return jsgraph_; } - Isolate* isolate() const { return jsgraph_->isolate(); } - Graph* graph() const { return jsgraph_->graph(); } + MachineGraph* mcgraph() const { return mcgraph_; } + Graph* graph() const { return mcgraph_->graph(); } Zone* temp_zone() const { return temp_zone_; } - CommonOperatorBuilder* common() const { return jsgraph()->common(); } - MachineOperatorBuilder* machine() const { return jsgraph()->machine(); } - SimplifiedOperatorBuilder* simplified() const { - return jsgraph()->simplified(); - } + CommonOperatorBuilder* common() const { return mcgraph()->common(); } + MachineOperatorBuilder* machine() const { return mcgraph()->machine(); } private: template @@ -491,9 +427,8 @@ class V8_EXPORT_PRIVATE GraphAssembler { BasicBlock* if_true_block, BasicBlock* if_false_block); - SetOncePointer to_number_operator_; Zone* temp_zone_; - JSGraph* jsgraph_; + MachineGraph* mcgraph_; Node* effect_; Node* control_; std::unique_ptr block_updater_; @@ -718,6 +653,88 @@ Node* GraphAssembler::Call(const Operator* op, Args... args) { return AddNode(call); } +class V8_EXPORT_PRIVATE JSGraphAssembler : public GraphAssembler { + public: + // Constructs a JSGraphAssembler. If {schedule} is not null, the graph + // assembler will maintain the schedule as it updates blocks. + JSGraphAssembler(JSGraph* jsgraph, Zone* zone, Schedule* schedule = nullptr) + : GraphAssembler(jsgraph, zone, schedule), jsgraph_(jsgraph) {} + + Node* SmiConstant(int32_t value); + TNode HeapConstant(Handle object); + TNode Constant(const ObjectRef& ref); + TNode NumberConstant(double value); + Node* CEntryStubConstant(int result_size); + +#define SINGLETON_CONST_DECL(Name, Type) TNode Name##Constant(); + JSGRAPH_SINGLETON_CONSTANT_LIST(SINGLETON_CONST_DECL) +#undef SINGLETON_CONST_DECL + +#define SINGLETON_CONST_TEST_DECL(Name, ...) \ + TNode Is##Name(TNode value); + JSGRAPH_SINGLETON_CONSTANT_LIST(SINGLETON_CONST_TEST_DECL) +#undef SINGLETON_CONST_TEST_DECL + + Node* Allocate(AllocationType allocation, Node* size); + Node* LoadField(FieldAccess const&, Node* object); + template + TNode LoadField(FieldAccess const& access, TNode object) { + // TODO(jgruber): Investigate issues on ptr compression bots and enable. + // DCHECK(IsMachineRepresentationOf( + // access.machine_type.representation())); + return TNode::UncheckedCast(LoadField(access, object)); + } + Node* LoadElement(ElementAccess const&, Node* object, Node* index); + template + TNode LoadElement(ElementAccess const& access, TNode object, + TNode index) { + // TODO(jgruber): Investigate issues on ptr compression bots and enable. + // DCHECK(IsMachineRepresentationOf( + // access.machine_type.representation())); + return TNode::UncheckedCast(LoadElement(access, object, index)); + } + Node* StoreField(FieldAccess const&, Node* object, Node* value); + Node* StoreElement(ElementAccess const&, Node* object, Node* index, + Node* value); + void TransitionAndStoreElement(MapRef double_map, MapRef fast_map, + TNode object, TNode index, + TNode value); + TNode StringLength(TNode string); + TNode ReferenceEqual(TNode lhs, TNode rhs); + TNode ToNumber(TNode value); + TNode NumberMin(TNode lhs, TNode rhs); + TNode NumberMax(TNode lhs, TNode rhs); + TNode NumberLessThan(TNode lhs, TNode rhs); + TNode NumberLessThanOrEqual(TNode lhs, TNode rhs); + TNode NumberAdd(TNode lhs, TNode rhs); + TNode NumberSubtract(TNode lhs, TNode rhs); + TNode StringSubstring(TNode string, TNode from, + TNode to); + TNode ObjectIsCallable(TNode value); + Node* CheckIf(Node* cond, DeoptimizeReason reason); + TNode NumberIsFloat64Hole(TNode value); + TNode ToBoolean(TNode value); + TNode MaybeGrowFastElements(ElementsKind kind, + const FeedbackSource& feedback, + TNode array, + TNode elements, + TNode new_length, + TNode old_length); + + JSGraph* jsgraph() const { return jsgraph_; } + Isolate* isolate() const { return jsgraph()->isolate(); } + SimplifiedOperatorBuilder* simplified() const { + return jsgraph()->simplified(); + } + + protected: + Operator const* ToNumberOperator(); + + private: + JSGraph* jsgraph_; + SetOncePointer to_number_operator_; +}; + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/js-call-reducer.cc b/src/compiler/js-call-reducer.cc index 9e4e3d39bb..c446c9f8a7 100644 --- a/src/compiler/js-call-reducer.cc +++ b/src/compiler/js-call-reducer.cc @@ -41,10 +41,12 @@ namespace compiler { // Shorter lambda declarations with less visual clutter. #define _ [&]() // NOLINT(whitespace/braces) -class JSCallReducerAssembler : public GraphAssembler { +class JSCallReducerAssembler : public JSGraphAssembler { public: JSCallReducerAssembler(JSGraph* jsgraph, Zone* zone, Node* node) - : GraphAssembler(jsgraph, zone), node_(node), if_exception_nodes_(zone) { + : JSGraphAssembler(jsgraph, zone), + node_(node), + if_exception_nodes_(zone) { InitializeEffectControl(NodeProperties::GetEffectInput(node), NodeProperties::GetControlInput(node)); @@ -84,7 +86,7 @@ class JSCallReducerAssembler : public GraphAssembler { // implementation. class IfBuilder0 { public: - IfBuilder0(GraphAssembler* gasm, TNode cond, bool negate_cond) + IfBuilder0(JSGraphAssembler* gasm, TNode cond, bool negate_cond) : gasm_(gasm), cond_(cond), negate_cond_(negate_cond) {} V8_WARN_UNUSED_RESULT IfBuilder0& ExpectTrue() { @@ -134,7 +136,7 @@ class JSCallReducerAssembler : public GraphAssembler { } private: - GraphAssembler* const gasm_; + JSGraphAssembler* const gasm_; const TNode cond_; const bool negate_cond_; BranchHint hint_ = BranchHint::kNone; @@ -150,7 +152,7 @@ class JSCallReducerAssembler : public GraphAssembler { using If1BodyFunction = std::function()>; public: - IfBuilder1(GraphAssembler* gasm, TNode cond) + IfBuilder1(JSGraphAssembler* gasm, TNode cond) : gasm_(gasm), cond_(cond) {} V8_WARN_UNUSED_RESULT IfBuilder1& ExpectTrue() { @@ -200,7 +202,7 @@ class JSCallReducerAssembler : public GraphAssembler { static constexpr MachineRepresentation kPhiRepresentation = MachineRepresentation::kTagged; - GraphAssembler* const gasm_; + JSGraphAssembler* const gasm_; const TNode cond_; BranchHint hint_ = BranchHint::kNone; If1BodyFunction then_body_; @@ -288,7 +290,7 @@ class JSCallReducerAssembler : public GraphAssembler { using For0BodyFunction = std::function)>; public: - ForBuilder0(GraphAssembler* gasm, TNode initial_value, + ForBuilder0(JSGraphAssembler* gasm, TNode initial_value, const ConditionFunction1& cond, const StepFunction1& step) : gasm_(gasm), initial_value_(initial_value), @@ -324,7 +326,7 @@ class JSCallReducerAssembler : public GraphAssembler { static constexpr MachineRepresentation kPhiRepresentation = MachineRepresentation::kTagged; - GraphAssembler* const gasm_; + JSGraphAssembler* const gasm_; const TNode initial_value_; const ConditionFunction1 cond_; const StepFunction1 step_; @@ -347,7 +349,7 @@ class JSCallReducerAssembler : public GraphAssembler { using For1BodyFunction = std::function, TNode*)>; class ForBuilder1 { public: - ForBuilder1(GraphAssembler* gasm, TNode initial_value, + ForBuilder1(JSGraphAssembler* gasm, TNode initial_value, const ConditionFunction1& cond, const StepFunction1& step, TNode initial_arg0) : gasm_(gasm), @@ -399,7 +401,7 @@ class JSCallReducerAssembler : public GraphAssembler { static constexpr MachineRepresentation kPhiRepresentation = MachineRepresentation::kTagged; - GraphAssembler* const gasm_; + JSGraphAssembler* const gasm_; const TNode initial_value_; const ConditionFunction1 cond_; const StepFunction1 step_; @@ -670,7 +672,7 @@ TNode JSCallReducerAssembler::CreateArrayNoThrow(TNode ctor, TNode JSCallReducerAssembler::AllocateEmptyJSArray( ElementsKind kind, const NativeContextRef& native_context) { - // TODO(jgruber): Port AllocationBuilder to GraphAssembler. + // TODO(jgruber): Port AllocationBuilder to JSGraphAssembler. MapRef map = native_context.GetInitialJSArrayMap(kind); AllocationBuilder ab(jsgraph(), effect(), control()); diff --git a/src/compiler/memory-lowering.cc b/src/compiler/memory-lowering.cc index 6019a90aa0..6012ae62c5 100644 --- a/src/compiler/memory-lowering.cc +++ b/src/compiler/memory-lowering.cc @@ -44,7 +44,7 @@ class MemoryLowering::AllocationGroup final : public ZoneObject { }; MemoryLowering::MemoryLowering(JSGraph* jsgraph, Zone* zone, - GraphAssembler* graph_assembler, + JSGraphAssembler* graph_assembler, PoisoningMitigationLevel poisoning_level, AllocationFolding allocation_folding, WriteBarrierAssertFailedCallback callback, diff --git a/src/compiler/memory-lowering.h b/src/compiler/memory-lowering.h index 1ac9a7b6dc..2c9a0accdb 100644 --- a/src/compiler/memory-lowering.h +++ b/src/compiler/memory-lowering.h @@ -71,7 +71,7 @@ class MemoryLowering final : public Reducer { Node* node, Node* object, const char* name, Zone* temp_zone)>; MemoryLowering( - JSGraph* jsgraph, Zone* zone, GraphAssembler* graph_assembler, + JSGraph* jsgraph, Zone* zone, JSGraphAssembler* graph_assembler, PoisoningMitigationLevel poisoning_level, AllocationFolding allocation_folding = AllocationFolding::kDontAllocationFolding, @@ -116,7 +116,7 @@ class MemoryLowering final : public Reducer { Zone* graph_zone() const { return graph_zone_; } CommonOperatorBuilder* common() const { return common_; } MachineOperatorBuilder* machine() const { return machine_; } - GraphAssembler* gasm() const { return graph_assembler_; } + JSGraphAssembler* gasm() const { return graph_assembler_; } SetOncePointer allocate_operator_; Isolate* isolate_; @@ -124,7 +124,7 @@ class MemoryLowering final : public Reducer { Zone* graph_zone_; CommonOperatorBuilder* common_; MachineOperatorBuilder* machine_; - GraphAssembler* graph_assembler_; + JSGraphAssembler* graph_assembler_; AllocationFolding allocation_folding_; PoisoningMitigationLevel poisoning_level_; WriteBarrierAssertFailedCallback write_barrier_assert_failed_; diff --git a/src/compiler/memory-optimizer.h b/src/compiler/memory-optimizer.h index 9f37949563..0f85fea191 100644 --- a/src/compiler/memory-optimizer.h +++ b/src/compiler/memory-optimizer.h @@ -79,7 +79,7 @@ class MemoryOptimizer final { JSGraph* jsgraph() const { return jsgraph_; } Zone* zone() const { return zone_; } - GraphAssembler graph_assembler_; + JSGraphAssembler graph_assembler_; MemoryLowering memory_lowering_; JSGraph* jsgraph_; AllocationState const* const empty_state_; diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc index 0eb4486f32..a585801df7 100644 --- a/src/compiler/pipeline.cc +++ b/src/compiler/pipeline.cc @@ -1801,7 +1801,7 @@ struct LateOptimizationPhase { CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), data->broker(), data->common(), data->machine(), temp_zone); - GraphAssembler graph_assembler(data->jsgraph(), temp_zone); + JSGraphAssembler graph_assembler(data->jsgraph(), temp_zone); SelectLowering select_lowering(&graph_assembler, data->graph()); AddReducer(data, &graph_reducer, &branch_condition_elimination); AddReducer(data, &graph_reducer, &dead_code_elimination); diff --git a/src/compiler/scheduled-machine-lowering.h b/src/compiler/scheduled-machine-lowering.h index 06337f9c39..ca078a2a53 100644 --- a/src/compiler/scheduled-machine-lowering.h +++ b/src/compiler/scheduled-machine-lowering.h @@ -32,11 +32,11 @@ class ScheduledMachineLowering final { private: bool LowerNode(Node* node); - GraphAssembler* gasm() { return &graph_assembler_; } + JSGraphAssembler* gasm() { return &graph_assembler_; } Schedule* schedule() { return schedule_; } Schedule* schedule_; - GraphAssembler graph_assembler_; + JSGraphAssembler graph_assembler_; SelectLowering select_lowering_; MemoryLowering memory_lowering_; ZoneVector reducers_; diff --git a/src/compiler/select-lowering.cc b/src/compiler/select-lowering.cc index aacea7a343..590df6ae1f 100644 --- a/src/compiler/select-lowering.cc +++ b/src/compiler/select-lowering.cc @@ -15,7 +15,7 @@ namespace v8 { namespace internal { namespace compiler { -SelectLowering::SelectLowering(GraphAssembler* graph_assembler, Graph* graph) +SelectLowering::SelectLowering(JSGraphAssembler* graph_assembler, Graph* graph) : graph_assembler_(graph_assembler), start_(graph->start()) {} SelectLowering::~SelectLowering() = default; diff --git a/src/compiler/select-lowering.h b/src/compiler/select-lowering.h index 53eb7dc585..bbe14e92ff 100644 --- a/src/compiler/select-lowering.h +++ b/src/compiler/select-lowering.h @@ -12,12 +12,12 @@ namespace internal { namespace compiler { // Forward declarations. -class GraphAssembler; +class JSGraphAssembler; // Lowers Select nodes to diamonds. class SelectLowering final : public Reducer { public: - SelectLowering(GraphAssembler* graph_assembler, Graph* graph); + SelectLowering(JSGraphAssembler* graph_assembler, Graph* graph); ~SelectLowering() override; const char* reducer_name() const override { return "SelectLowering"; } @@ -27,10 +27,10 @@ class SelectLowering final : public Reducer { private: Reduction LowerSelect(Node* node); - GraphAssembler* gasm() const { return graph_assembler_; } + JSGraphAssembler* gasm() const { return graph_assembler_; } Node* start() const { return start_; } - GraphAssembler* graph_assembler_; + JSGraphAssembler* graph_assembler_; Node* start_; };