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 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 (assigned != nullptr) { | 1630 if (assigned != nullptr) { |
1631 // Only introduce phis for variables assigned in this loop. | 1631 // Only introduce phis for variables assigned in this loop. |
1632 for (int i = EnvironmentCount() - 1; i >= 0; i--) { | 1632 for (int i = EnvironmentCount() - 1; i >= 0; i--) { |
1633 if (!assigned->Contains(i)) continue; | 1633 if (!assigned->Contains(i)) continue; |
1634 env->locals[i] = builder_->Phi(local_type_vec_[i], 1, &env->locals[i], | 1634 env->locals[i] = builder_->Phi(local_type_vec_[i], 1, &env->locals[i], |
1635 env->control); | 1635 env->control); |
1636 } | 1636 } |
1637 SsaEnv* loop_body_env = Split(env); | 1637 SsaEnv* loop_body_env = Split(env); |
1638 if (failed()) return loop_body_env; | |
titzer
2016/10/13 13:24:42
I think you should move this up to just after the
ahaas
2016/10/13 13:31:55
Done.
| |
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)); |
1640 return loop_body_env; | 1641 return loop_body_env; |
1641 } | 1642 } |
1642 } | 1643 } |
1643 | 1644 |
1644 // Conservatively introduce phis for all local variables. | 1645 // Conservatively introduce phis for all local variables. |
1645 for (int i = EnvironmentCount() - 1; i >= 0; i--) { | 1646 for (int i = EnvironmentCount() - 1; i >= 0; i--) { |
1646 env->locals[i] = | 1647 env->locals[i] = |
1647 builder_->Phi(local_type_vec_[i], 1, &env->locals[i], env->control); | 1648 builder_->Phi(local_type_vec_[i], 1, &env->locals[i], env->control); |
1648 } | 1649 } |
1649 | 1650 |
1650 SsaEnv* loop_body_env = Split(env); | 1651 SsaEnv* loop_body_env = Split(env); |
1652 if (failed()) return loop_body_env; | |
titzer
2016/10/13 13:24:42
I don't think this check is necessary, since we ha
ahaas
2016/10/13 13:31:55
Done.
| |
1651 builder_->StackCheck(position(), &(loop_body_env->effect), | 1653 builder_->StackCheck(position(), &(loop_body_env->effect), |
1652 &(loop_body_env->control)); | 1654 &(loop_body_env->control)); |
1653 return loop_body_env; | 1655 return loop_body_env; |
1654 } | 1656 } |
1655 | 1657 |
1656 // Create a complete copy of the {from}. | 1658 // Create a complete copy of the {from}. |
1657 SsaEnv* Split(SsaEnv* from) { | 1659 SsaEnv* Split(SsaEnv* from) { |
1658 DCHECK_NOT_NULL(from); | 1660 DCHECK_NOT_NULL(from); |
1659 SsaEnv* result = reinterpret_cast<SsaEnv*>(zone_->New(sizeof(SsaEnv))); | 1661 SsaEnv* result = reinterpret_cast<SsaEnv*>(zone_->New(sizeof(SsaEnv))); |
1660 size_t size = sizeof(TFNode*) * EnvironmentCount(); | 1662 size_t size = sizeof(TFNode*) * EnvironmentCount(); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1950 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 1952 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
1951 const byte* start, const byte* end) { | 1953 const byte* start, const byte* end) { |
1952 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 1954 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
1953 WasmFullDecoder decoder(zone, nullptr, body); | 1955 WasmFullDecoder decoder(zone, nullptr, body); |
1954 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 1956 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
1955 } | 1957 } |
1956 | 1958 |
1957 } // namespace wasm | 1959 } // namespace wasm |
1958 } // namespace internal | 1960 } // namespace internal |
1959 } // namespace v8 | 1961 } // namespace v8 |
OLD | NEW |