Commit 8afce15a authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm][cleanup] Fix NumLocals function

Should be num_locals, and const.

R=titzer@chromium.org

Bug: v8:8562
Change-Id: I60889c9912ef95d344ede4d7755028116feee47e
Reviewed-on: https://chromium-review.googlesource.com/c/1373784Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58197}
parent 4084185b
......@@ -230,7 +230,7 @@ class LiftoffCompiler {
}
void StartFunction(FullDecoder* decoder) {
int num_locals = decoder->NumLocals();
int num_locals = decoder->num_locals();
__ set_num_locals(num_locals);
for (int i = 0; i < num_locals; ++i) {
__ set_local_type(i, decoder->GetLocalType(i));
......
......@@ -1492,7 +1492,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
inline Zone* zone() const { return zone_; }
inline uint32_t NumLocals() {
inline uint32_t num_locals() const {
return static_cast<uint32_t>(local_type_vec_.size());
}
......
......@@ -87,7 +87,7 @@ class WasmGraphBuildingInterface {
void StartFunction(FullDecoder* decoder) {
SsaEnv* ssa_env =
reinterpret_cast<SsaEnv*>(decoder->zone()->New(sizeof(SsaEnv)));
uint32_t num_locals = decoder->NumLocals();
uint32_t num_locals = decoder->num_locals();
uint32_t env_count = num_locals;
size_t size = sizeof(TFNode*) * env_count;
ssa_env->state = SsaEnv::kReached;
......@@ -702,7 +702,7 @@ class WasmGraphBuildingInterface {
to->effect = builder_->EffectPhi(2, effects, merge);
}
// Merge SSA values.
for (int i = decoder->NumLocals() - 1; i >= 0; i--) {
for (int i = decoder->num_locals() - 1; i >= 0; i--) {
TFNode* a = to->locals[i];
TFNode* b = from->locals[i];
if (a != b) {
......@@ -724,7 +724,7 @@ class WasmGraphBuildingInterface {
to->effect = builder_->CreateOrMergeIntoEffectPhi(merge, to->effect,
from->effect);
// Merge locals.
for (int i = decoder->NumLocals() - 1; i >= 0; i--) {
for (int i = decoder->num_locals() - 1; i >= 0; i--) {
to->locals[i] = builder_->CreateOrMergeIntoPhi(
ValueTypes::MachineRepresentationFor(decoder->GetLocalType(i)),
merge, to->locals[i], from->locals[i]);
......@@ -754,7 +754,7 @@ class WasmGraphBuildingInterface {
if (assigned != nullptr) {
// Only introduce phis for variables assigned in this loop.
int instance_cache_index = decoder->total_locals();
for (int i = decoder->NumLocals() - 1; i >= 0; i--) {
for (int i = decoder->num_locals() - 1; i >= 0; i--) {
if (!assigned->Contains(i)) continue;
env->locals[i] = builder_->Phi(decoder->GetLocalType(i), 1,
&env->locals[i], env->control);
......@@ -772,7 +772,7 @@ class WasmGraphBuildingInterface {
}
// Conservatively introduce phis for all local variables.
for (int i = decoder->NumLocals() - 1; i >= 0; i--) {
for (int i = decoder->num_locals() - 1; i >= 0; i--) {
env->locals[i] = builder_->Phi(decoder->GetLocalType(i), 1,
&env->locals[i], env->control);
}
......@@ -791,7 +791,7 @@ class WasmGraphBuildingInterface {
DCHECK_NOT_NULL(from);
SsaEnv* result =
reinterpret_cast<SsaEnv*>(decoder->zone()->New(sizeof(SsaEnv)));
size_t size = sizeof(TFNode*) * decoder->NumLocals();
size_t size = sizeof(TFNode*) * decoder->num_locals();
result->control = from->control;
result->effect = from->effect;
......
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