| 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-containers.h" | 10 #include "src/zone-containers.h" |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 startrel(error_pc_), error_msg_.get()); | 409 startrel(error_pc_), error_msg_.get()); |
| 410 } | 410 } |
| 411 | 411 |
| 412 return toResult(tree); | 412 return toResult(tree); |
| 413 } | 413 } |
| 414 | 414 |
| 415 bool DecodeLocalDecls(AstLocalDecls& decls) { | 415 bool DecodeLocalDecls(AstLocalDecls& decls) { |
| 416 DecodeLocalDecls(); | 416 DecodeLocalDecls(); |
| 417 if (failed()) return false; | 417 if (failed()) return false; |
| 418 decls.decls_encoded_size = pc_offset(); | 418 decls.decls_encoded_size = pc_offset(); |
| 419 decls.total_local_count = 0; | |
| 420 decls.local_types.reserve(local_type_vec_.size()); | 419 decls.local_types.reserve(local_type_vec_.size()); |
| 421 for (size_t pos = 0; pos < local_type_vec_.size();) { | 420 for (size_t pos = 0; pos < local_type_vec_.size();) { |
| 422 uint32_t count = 0; | 421 uint32_t count = 0; |
| 423 LocalType type = local_type_vec_[pos]; | 422 LocalType type = local_type_vec_[pos]; |
| 424 while (pos < local_type_vec_.size() && local_type_vec_[pos] == type) { | 423 while (pos < local_type_vec_.size() && local_type_vec_[pos] == type) { |
| 425 pos++; | 424 pos++; |
| 426 count++; | 425 count++; |
| 427 } | 426 } |
| 428 decls.total_local_count += count; | |
| 429 decls.local_types.push_back(std::pair<LocalType, uint32_t>(type, count)); | 427 decls.local_types.push_back(std::pair<LocalType, uint32_t>(type, count)); |
| 430 } | 428 } |
| 429 decls.total_local_count = static_cast<uint32_t>(local_type_vec_.size()); |
| 431 return true; | 430 return true; |
| 432 } | 431 } |
| 433 | 432 |
| 434 BitVector* AnalyzeLoopAssignmentForTesting(const byte* pc, | 433 BitVector* AnalyzeLoopAssignmentForTesting(const byte* pc, |
| 435 size_t num_locals) { | 434 size_t num_locals) { |
| 436 total_locals_ = num_locals; | 435 total_locals_ = num_locals; |
| 437 local_type_vec_.reserve(num_locals); | 436 local_type_vec_.reserve(num_locals); |
| 438 if (num_locals > local_type_vec_.size()) { | 437 if (num_locals > local_type_vec_.size()) { |
| 439 local_type_vec_.insert(local_type_vec_.end(), | 438 local_type_vec_.insert(local_type_vec_.end(), |
| 440 num_locals - local_type_vec_.size(), kAstI32); | 439 num_locals - local_type_vec_.size(), kAstI32); |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1788 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 1787 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
| 1789 const byte* start, const byte* end) { | 1788 const byte* start, const byte* end) { |
| 1790 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 1789 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
| 1791 SR_WasmDecoder decoder(zone, nullptr, body); | 1790 SR_WasmDecoder decoder(zone, nullptr, body); |
| 1792 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 1791 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
| 1793 } | 1792 } |
| 1794 | 1793 |
| 1795 } // namespace wasm | 1794 } // namespace wasm |
| 1796 } // namespace internal | 1795 } // namespace internal |
| 1797 } // namespace v8 | 1796 } // namespace v8 |
| OLD | NEW |