Commit 2a9c225c authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Use GraphAssembler for effect and control handling

This changes the WasmGraphBuilder to use the GraphAssembler for storing
the current effect and control, instead of having separate fields.
This will allow us to use GraphAssembler methods anywhere in the
WasmGraphBuilder without first transferring the WasmGraphBuilder's
effect and control to the GraphAssembler and storing it back afterwards.

Some methods (StackCheck, BuildCallToRuntimeWithContext) have been
changed to work on the current effect and control instead of receiving
them as parameters. This is necessary to also use the GraphAssembler
there, and it makes the code a bit easier.

R=ecmziegler@chromium.org

Bug: v8:10123
Change-Id: Ia9f6359cfe44a67a875c3eb0fe51f87db8bd17db
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2017470
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65975}
parent 8dfdc86c
This diff is collapsed.
...@@ -220,8 +220,7 @@ class WasmGraphBuilder { ...@@ -220,8 +220,7 @@ class WasmGraphBuilder {
void AppendToMerge(Node* merge, Node* from); void AppendToMerge(Node* merge, Node* from);
void AppendToPhi(Node* phi, Node* from); void AppendToPhi(Node* phi, Node* from);
void StackCheck(wasm::WasmCodePosition position, Node** effect = nullptr, void StackCheck(wasm::WasmCodePosition);
Node** control = nullptr);
void PatchInStackCheckIfNeeded(); void PatchInStackCheckIfNeeded();
...@@ -297,26 +296,16 @@ class WasmGraphBuilder { ...@@ -297,26 +296,16 @@ class WasmGraphBuilder {
this->instance_node_ = instance_node; this->instance_node_ = instance_node;
} }
Node* Control() { // TODO(clemensb): This should be {effect()} and {control()}.
DCHECK_NOT_NULL(*control_); Node* Effect();
return *control_; Node* Control();
Node* SetEffect(Node* node);
Node* SetControl(Node* node);
void SetEffectControl(Node* effect, Node* control);
Node* SetEffectControl(Node* effect_and_control) {
SetEffectControl(effect_and_control, effect_and_control);
return effect_and_control;
} }
Node* Effect() {
DCHECK_NOT_NULL(*effect_);
return *effect_;
}
Node* SetControl(Node* node) {
*control_ = node;
return node;
}
Node* SetEffect(Node* node) {
*effect_ = node;
return node;
}
void set_control_ptr(Node** control) { this->control_ = control; }
void set_effect_ptr(Node** effect) { this->effect_ = effect; }
Node* GetImportedMutableGlobals(); Node* GetImportedMutableGlobals();
...@@ -560,8 +549,7 @@ class WasmGraphBuilder { ...@@ -560,8 +549,7 @@ class WasmGraphBuilder {
int parameter_count); int parameter_count);
Node* BuildCallToRuntimeWithContext(Runtime::FunctionId f, Node* js_context, Node* BuildCallToRuntimeWithContext(Runtime::FunctionId f, Node* js_context,
Node** parameters, int parameter_count, Node** parameters, int parameter_count);
Node** effect, Node* control);
TrapId GetTrapIdForTrap(wasm::TrapReason reason); TrapId GetTrapIdForTrap(wasm::TrapReason reason);
std::unique_ptr<WasmGraphAssembler> gasm_; std::unique_ptr<WasmGraphAssembler> gasm_;
...@@ -569,8 +557,6 @@ class WasmGraphBuilder { ...@@ -569,8 +557,6 @@ class WasmGraphBuilder {
MachineGraph* const mcgraph_; MachineGraph* const mcgraph_;
wasm::CompilationEnv* const env_; wasm::CompilationEnv* const env_;
Node** control_ = nullptr;
Node** effect_ = nullptr;
WasmInstanceCacheNodes* instance_cache_ = nullptr; WasmInstanceCacheNodes* instance_cache_ = nullptr;
SetOncePointer<Node> instance_node_; SetOncePointer<Node> instance_node_;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment