Commit 96a039aa authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm][cleanup] Rename SsaEnv::go to SsaEnv::reached

{go} sounds active, as if the state would be changed. {reached} sounds
like an accessor.

Drive-by: Make the accessor const to further clarify that this is just
an accessor.

R=titzer@chromium.org

Bug: v8:8015
Change-Id: I80d5223b9573345d3de386d68871a9e828621fc0
Reviewed-on: https://chromium-review.googlesource.com/1203992Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55614}
parent a1da383f
...@@ -37,7 +37,7 @@ struct SsaEnv { ...@@ -37,7 +37,7 @@ struct SsaEnv {
compiler::WasmInstanceCacheNodes instance_cache; compiler::WasmInstanceCacheNodes instance_cache;
TFNode** locals; TFNode** locals;
bool go() { return state >= kReached; } bool reached() const { return state >= kReached; }
void Kill(State new_state = kControlEnd) { void Kill(State new_state = kControlEnd) {
state = new_state; state = new_state;
locals = nullptr; locals = nullptr;
...@@ -52,7 +52,7 @@ struct SsaEnv { ...@@ -52,7 +52,7 @@ struct SsaEnv {
#define BUILD(func, ...) \ #define BUILD(func, ...) \
([&] { \ ([&] { \
DCHECK(ssa_env_->go()); \ DCHECK(ssa_env_->reached()); \
DCHECK(decoder->ok()); \ DCHECK(decoder->ok()); \
return CheckForException(decoder, builder_->func(__VA_ARGS__)); \ return CheckForException(decoder, builder_->func(__VA_ARGS__)); \
})() })()
...@@ -127,7 +127,7 @@ class WasmGraphBuildingInterface { ...@@ -127,7 +127,7 @@ class WasmGraphBuildingInterface {
// Reload the instance cache entries into the Ssa Environment. // Reload the instance cache entries into the Ssa Environment.
void LoadContextIntoSsa(SsaEnv* ssa_env) { void LoadContextIntoSsa(SsaEnv* ssa_env) {
if (!ssa_env || !ssa_env->go()) return; if (!ssa_env || !ssa_env->reached()) return;
builder_->InitInstanceCache(&ssa_env->instance_cache); builder_->InitInstanceCache(&ssa_env->instance_cache);
} }
...@@ -181,7 +181,9 @@ class WasmGraphBuildingInterface { ...@@ -181,7 +181,9 @@ class WasmGraphBuildingInterface {
void If(FullDecoder* decoder, const Value& cond, Control* if_block) { void If(FullDecoder* decoder, const Value& cond, Control* if_block) {
TFNode* if_true = nullptr; TFNode* if_true = nullptr;
TFNode* if_false = nullptr; TFNode* if_false = nullptr;
if (ssa_env_->go()) BUILD(BranchNoHint, cond.node, &if_true, &if_false); if (ssa_env_->reached()) {
BUILD(BranchNoHint, cond.node, &if_true, &if_false);
}
SsaEnv* end_env = ssa_env_; SsaEnv* end_env = ssa_env_;
SsaEnv* false_env = Split(decoder, ssa_env_); SsaEnv* false_env = Split(decoder, ssa_env_);
false_env->control = if_false; false_env->control = if_false;
...@@ -436,7 +438,7 @@ class WasmGraphBuildingInterface { ...@@ -436,7 +438,7 @@ class WasmGraphBuildingInterface {
// The catch block is unreachable if no possible throws in the try block // The catch block is unreachable if no possible throws in the try block
// exist. We only build a landing pad if some node in the try block can // exist. We only build a landing pad if some node in the try block can
// (possibly) throw. Otherwise the below catch environments remain empty. // (possibly) throw. Otherwise the below catch environments remain empty.
DCHECK_EQ(exception != nullptr, ssa_env_->go()); DCHECK_EQ(exception != nullptr, ssa_env_->reached());
TFNode* if_catch = nullptr; TFNode* if_catch = nullptr;
TFNode* if_no_catch = nullptr; TFNode* if_no_catch = nullptr;
...@@ -596,7 +598,7 @@ class WasmGraphBuildingInterface { ...@@ -596,7 +598,7 @@ class WasmGraphBuildingInterface {
void MergeValuesInto(FullDecoder* decoder, Control* c, Merge<Value>* merge) { void MergeValuesInto(FullDecoder* decoder, Control* c, Merge<Value>* merge) {
DCHECK(merge == &c->start_merge || merge == &c->end_merge); DCHECK(merge == &c->start_merge || merge == &c->end_merge);
if (!ssa_env_->go()) return; if (!ssa_env_->reached()) return;
SsaEnv* target = c->end_env; SsaEnv* target = c->end_env;
const bool first = target->state == SsaEnv::kUnreachable; const bool first = target->state == SsaEnv::kUnreachable;
...@@ -619,7 +621,7 @@ class WasmGraphBuildingInterface { ...@@ -619,7 +621,7 @@ class WasmGraphBuildingInterface {
void Goto(FullDecoder* decoder, SsaEnv* from, SsaEnv* to) { void Goto(FullDecoder* decoder, SsaEnv* from, SsaEnv* to) {
DCHECK_NOT_NULL(to); DCHECK_NOT_NULL(to);
if (!from->go()) return; if (!from->reached()) return;
switch (to->state) { switch (to->state) {
case SsaEnv::kUnreachable: { // Overwrite destination. case SsaEnv::kUnreachable: { // Overwrite destination.
to->state = SsaEnv::kReached; to->state = SsaEnv::kReached;
...@@ -680,7 +682,7 @@ class WasmGraphBuildingInterface { ...@@ -680,7 +682,7 @@ class WasmGraphBuildingInterface {
} }
SsaEnv* PrepareForLoop(FullDecoder* decoder, SsaEnv* env) { SsaEnv* PrepareForLoop(FullDecoder* decoder, SsaEnv* env) {
if (!env->go()) return Split(decoder, env); if (!env->reached()) return Split(decoder, env);
env->state = SsaEnv::kMerged; env->state = SsaEnv::kMerged;
env->control = builder_->Loop(env->control); env->control = builder_->Loop(env->control);
...@@ -734,7 +736,7 @@ class WasmGraphBuildingInterface { ...@@ -734,7 +736,7 @@ class WasmGraphBuildingInterface {
result->control = from->control; result->control = from->control;
result->effect = from->effect; result->effect = from->effect;
if (from->go()) { if (from->reached()) {
result->state = SsaEnv::kReached; result->state = SsaEnv::kReached;
result->locals = result->locals =
size > 0 ? reinterpret_cast<TFNode**>(decoder->zone()->New(size)) size > 0 ? reinterpret_cast<TFNode**>(decoder->zone()->New(size))
...@@ -754,7 +756,7 @@ class WasmGraphBuildingInterface { ...@@ -754,7 +756,7 @@ class WasmGraphBuildingInterface {
// unreachable. // unreachable.
SsaEnv* Steal(Zone* zone, SsaEnv* from) { SsaEnv* Steal(Zone* zone, SsaEnv* from) {
DCHECK_NOT_NULL(from); DCHECK_NOT_NULL(from);
if (!from->go()) return UnreachableEnv(zone); if (!from->reached()) return UnreachableEnv(zone);
SsaEnv* result = reinterpret_cast<SsaEnv*>(zone->New(sizeof(SsaEnv))); SsaEnv* result = reinterpret_cast<SsaEnv*>(zone->New(sizeof(SsaEnv)));
result->state = SsaEnv::kReached; result->state = SsaEnv::kReached;
result->locals = from->locals; result->locals = from->locals;
......
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