OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/signature.h" | 5 #include "src/signature.h" |
6 | 6 |
7 #include "src/bit-vector.h" | 7 #include "src/bit-vector.h" |
8 #include "src/flags.h" | 8 #include "src/flags.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/zone/zone-containers.h" | 10 #include "src/zone/zone-containers.h" |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 SsaEnv* PrepareForLoop(const byte* pc, SsaEnv* env) { | 1620 SsaEnv* PrepareForLoop(const byte* pc, SsaEnv* env) { |
1621 if (!builder_) return Split(env); | 1621 if (!builder_) return Split(env); |
1622 if (!env->go()) return Split(env); | 1622 if (!env->go()) return Split(env); |
1623 env->state = SsaEnv::kMerged; | 1623 env->state = SsaEnv::kMerged; |
1624 | 1624 |
1625 env->control = builder_->Loop(env->control); | 1625 env->control = builder_->Loop(env->control); |
1626 env->effect = builder_->EffectPhi(1, &env->effect, env->control); | 1626 env->effect = builder_->EffectPhi(1, &env->effect, env->control); |
1627 builder_->Terminate(env->effect, env->control); | 1627 builder_->Terminate(env->effect, env->control); |
1628 if (FLAG_wasm_loop_assignment_analysis) { | 1628 if (FLAG_wasm_loop_assignment_analysis) { |
1629 BitVector* assigned = AnalyzeLoopAssignment(pc); | 1629 BitVector* assigned = AnalyzeLoopAssignment(pc); |
| 1630 if (failed()) return env; |
1630 if (assigned != nullptr) { | 1631 if (assigned != nullptr) { |
1631 // Only introduce phis for variables assigned in this loop. | 1632 // Only introduce phis for variables assigned in this loop. |
1632 for (int i = EnvironmentCount() - 1; i >= 0; i--) { | 1633 for (int i = EnvironmentCount() - 1; i >= 0; i--) { |
1633 if (!assigned->Contains(i)) continue; | 1634 if (!assigned->Contains(i)) continue; |
1634 env->locals[i] = builder_->Phi(local_type_vec_[i], 1, &env->locals[i], | 1635 env->locals[i] = builder_->Phi(local_type_vec_[i], 1, &env->locals[i], |
1635 env->control); | 1636 env->control); |
1636 } | 1637 } |
1637 SsaEnv* loop_body_env = Split(env); | 1638 SsaEnv* loop_body_env = Split(env); |
1638 builder_->StackCheck(position(), &(loop_body_env->effect), | 1639 builder_->StackCheck(position(), &(loop_body_env->effect), |
1639 &(loop_body_env->control)); | 1640 &(loop_body_env->control)); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 1951 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
1951 const byte* start, const byte* end) { | 1952 const byte* start, const byte* end) { |
1952 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 1953 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
1953 WasmFullDecoder decoder(zone, nullptr, body); | 1954 WasmFullDecoder decoder(zone, nullptr, body); |
1954 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 1955 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
1955 } | 1956 } |
1956 | 1957 |
1957 } // namespace wasm | 1958 } // namespace wasm |
1958 } // namespace internal | 1959 } // namespace internal |
1959 } // namespace v8 | 1960 } // namespace v8 |
OLD | NEW |