Chromium Code Reviews| Index: src/wasm/ast-decoder.cc |
| diff --git a/src/wasm/ast-decoder.cc b/src/wasm/ast-decoder.cc |
| index 025ccdf1d7bfc0d2c159e511600b0d313cf0fa9b..86a5e652af04060f08339d8ad4a58953f9aba331 100644 |
| --- a/src/wasm/ast-decoder.cc |
| +++ b/src/wasm/ast-decoder.cc |
| @@ -684,8 +684,7 @@ class WasmFullDecoder : public WasmDecoder { |
| BlockTypeOperand operand(this, pc_); |
| SsaEnv* finish_try_env = Steal(ssa_env_); |
| // The continue environment is the inner environment. |
| - PrepareForLoop(pc_, finish_try_env); |
| - SetEnv("loop:start", Split(finish_try_env)); |
| + SetEnv("loop:start", PrepareForLoop(pc_, finish_try_env)); |
|
titzer
2016/10/12 19:16:25
Please introduce a local variable here to make it
ahaas
2016/10/13 10:51:55
Done.
|
| ssa_env_->SetNotMerged(); |
| PushLoop(finish_try_env); |
| SetBlockType(&control_.back(), operand); |
| @@ -1611,10 +1610,15 @@ class WasmFullDecoder : public WasmDecoder { |
| return tnode; |
| } |
| - void PrepareForLoop(const byte* pc, SsaEnv* env) { |
| - if (!env->go()) return; |
| + SsaEnv* BuildLoopStackCheck(SsaEnv* env) { |
|
titzer
2016/10/12 19:16:25
You can inline this.
ahaas
2016/10/13 10:51:55
Done.
|
| + builder_->StackCheck(position(), &(env->effect), &(env->control)); |
| + return env; |
| + } |
| + |
| + SsaEnv* PrepareForLoop(const byte* pc, SsaEnv* env) { |
| + if (!builder_) return Split(env); |
| + if (!env->go()) return BuildLoopStackCheck(Split(env)); |
|
titzer
2016/10/12 19:16:25
You shouldn't build the stack check if the ssa env
ahaas
2016/10/13 10:51:55
Done.
|
| env->state = SsaEnv::kMerged; |
| - if (!builder_) return; |
| env->control = builder_->Loop(env->control); |
| env->effect = builder_->EffectPhi(1, &env->effect, env->control); |
| @@ -1628,7 +1632,7 @@ class WasmFullDecoder : public WasmDecoder { |
| env->locals[i] = builder_->Phi(local_type_vec_[i], 1, &env->locals[i], |
| env->control); |
| } |
| - return; |
| + return BuildLoopStackCheck(Split(env)); |
| } |
| } |
| @@ -1637,6 +1641,8 @@ class WasmFullDecoder : public WasmDecoder { |
| env->locals[i] = |
| builder_->Phi(local_type_vec_[i], 1, &env->locals[i], env->control); |
| } |
| + |
| + return BuildLoopStackCheck(Split(env)); |
| } |
| // Create a complete copy of the {from}. |