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/base/platform/elapsed-timer.h" | 5 #include "src/base/platform/elapsed-timer.h" |
6 #include "src/signature.h" | 6 #include "src/signature.h" |
7 | 7 |
8 #include "src/flags.h" | 8 #include "src/flags.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1117 } | 1117 } |
1118 TRACE("\n"); | 1118 TRACE("\n"); |
1119 ssa_env_ = env; | 1119 ssa_env_ = env; |
1120 if (builder_) { | 1120 if (builder_) { |
1121 builder_->set_control_ptr(&env->control); | 1121 builder_->set_control_ptr(&env->control); |
1122 builder_->set_effect_ptr(&env->effect); | 1122 builder_->set_effect_ptr(&env->effect); |
1123 } | 1123 } |
1124 } | 1124 } |
1125 | 1125 |
1126 void Goto(SsaEnv* from, SsaEnv* to) { | 1126 void Goto(SsaEnv* from, SsaEnv* to) { |
1127 DCHECK_NOT_NULL(to); | 1127 DCHECK_NOT_nullptr(to); |
Michael Starzinger
2016/01/08 12:11:03
Doesn't look right.
| |
1128 if (!from->go()) return; | 1128 if (!from->go()) return; |
1129 switch (to->state) { | 1129 switch (to->state) { |
1130 case SsaEnv::kUnreachable: { // Overwrite destination. | 1130 case SsaEnv::kUnreachable: { // Overwrite destination. |
1131 to->state = SsaEnv::kReached; | 1131 to->state = SsaEnv::kReached; |
1132 to->locals = from->locals; | 1132 to->locals = from->locals; |
1133 to->control = from->control; | 1133 to->control = from->control; |
1134 to->effect = from->effect; | 1134 to->effect = from->effect; |
1135 break; | 1135 break; |
1136 } | 1136 } |
1137 case SsaEnv::kReached: { // Create a new merge. | 1137 case SsaEnv::kReached: { // Create a new merge. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1234 for (int i = EnvironmentCount() - 1; i >= 0; i--) { | 1234 for (int i = EnvironmentCount() - 1; i >= 0; i--) { |
1235 env->locals[i] = builder_->Phi(function_env_->GetLocalType(i), 1, | 1235 env->locals[i] = builder_->Phi(function_env_->GetLocalType(i), 1, |
1236 &env->locals[i], env->control); | 1236 &env->locals[i], env->control); |
1237 } | 1237 } |
1238 } | 1238 } |
1239 } | 1239 } |
1240 } | 1240 } |
1241 | 1241 |
1242 // Create a complete copy of the {from}. | 1242 // Create a complete copy of the {from}. |
1243 SsaEnv* Split(SsaEnv* from) { | 1243 SsaEnv* Split(SsaEnv* from) { |
1244 DCHECK_NOT_NULL(from); | 1244 DCHECK_NOT_nullptr(from); |
Michael Starzinger
2016/01/08 12:11:03
Doesn't look right.
| |
1245 SsaEnv* result = reinterpret_cast<SsaEnv*>(zone_->New(sizeof(SsaEnv))); | 1245 SsaEnv* result = reinterpret_cast<SsaEnv*>(zone_->New(sizeof(SsaEnv))); |
1246 size_t size = sizeof(TFNode*) * EnvironmentCount(); | 1246 size_t size = sizeof(TFNode*) * EnvironmentCount(); |
1247 result->control = from->control; | 1247 result->control = from->control; |
1248 result->effect = from->effect; | 1248 result->effect = from->effect; |
1249 result->state = from->state == SsaEnv::kUnreachable ? SsaEnv::kUnreachable | 1249 result->state = from->state == SsaEnv::kUnreachable ? SsaEnv::kUnreachable |
1250 : SsaEnv::kReached; | 1250 : SsaEnv::kReached; |
1251 | 1251 |
1252 if (from->go()) { | 1252 if (from->go()) { |
1253 result->state = SsaEnv::kReached; | 1253 result->state = SsaEnv::kReached; |
1254 result->locals = | 1254 result->locals = |
1255 size > 0 ? reinterpret_cast<TFNode**>(zone_->New(size)) : nullptr; | 1255 size > 0 ? reinterpret_cast<TFNode**>(zone_->New(size)) : nullptr; |
1256 memcpy(result->locals, from->locals, size); | 1256 memcpy(result->locals, from->locals, size); |
1257 } else { | 1257 } else { |
1258 result->state = SsaEnv::kUnreachable; | 1258 result->state = SsaEnv::kUnreachable; |
1259 result->locals = nullptr; | 1259 result->locals = nullptr; |
1260 } | 1260 } |
1261 | 1261 |
1262 return result; | 1262 return result; |
1263 } | 1263 } |
1264 | 1264 |
1265 // Create a copy of {from} that steals its state and leaves {from} | 1265 // Create a copy of {from} that steals its state and leaves {from} |
1266 // unreachable. | 1266 // unreachable. |
1267 SsaEnv* Steal(SsaEnv* from) { | 1267 SsaEnv* Steal(SsaEnv* from) { |
1268 DCHECK_NOT_NULL(from); | 1268 DCHECK_NOT_nullptr(from); |
Michael Starzinger
2016/01/08 12:11:03
Doesn't look right.
| |
1269 if (!from->go()) return UnreachableEnv(); | 1269 if (!from->go()) return UnreachableEnv(); |
1270 SsaEnv* result = reinterpret_cast<SsaEnv*>(zone_->New(sizeof(SsaEnv))); | 1270 SsaEnv* result = reinterpret_cast<SsaEnv*>(zone_->New(sizeof(SsaEnv))); |
1271 result->state = SsaEnv::kReached; | 1271 result->state = SsaEnv::kReached; |
1272 result->locals = from->locals; | 1272 result->locals = from->locals; |
1273 result->control = from->control; | 1273 result->control = from->control; |
1274 result->effect = from->effect; | 1274 result->effect = from->effect; |
1275 from->Kill(SsaEnv::kUnreachable); | 1275 from->Kill(SsaEnv::kUnreachable); |
1276 return result; | 1276 return result; |
1277 } | 1277 } |
1278 | 1278 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1574 FOREACH_MISC_MEM_OPCODE(DECLARE_OPCODE_CASE) | 1574 FOREACH_MISC_MEM_OPCODE(DECLARE_OPCODE_CASE) |
1575 FOREACH_SIMPLE_OPCODE(DECLARE_OPCODE_CASE) | 1575 FOREACH_SIMPLE_OPCODE(DECLARE_OPCODE_CASE) |
1576 #undef DECLARE_OPCODE_CASE | 1576 #undef DECLARE_OPCODE_CASE |
1577 } | 1577 } |
1578 UNREACHABLE(); | 1578 UNREACHABLE(); |
1579 return 0; | 1579 return 0; |
1580 } | 1580 } |
1581 } // namespace wasm | 1581 } // namespace wasm |
1582 } // namespace internal | 1582 } // namespace internal |
1583 } // namespace v8 | 1583 } // namespace v8 |
OLD | NEW |