| 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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 DCHECK_EQ(0, local_type_vec_.size()); | 654 DCHECK_EQ(0, local_type_vec_.size()); |
| 655 // Initialize {local_type_vec} from signature. | 655 // Initialize {local_type_vec} from signature. |
| 656 if (sig_) { | 656 if (sig_) { |
| 657 local_type_vec_.reserve(sig_->parameter_count()); | 657 local_type_vec_.reserve(sig_->parameter_count()); |
| 658 for (size_t i = 0; i < sig_->parameter_count(); ++i) { | 658 for (size_t i = 0; i < sig_->parameter_count(); ++i) { |
| 659 local_type_vec_.push_back(sig_->GetParam(i)); | 659 local_type_vec_.push_back(sig_->GetParam(i)); |
| 660 } | 660 } |
| 661 } | 661 } |
| 662 // Decode local declarations, if any. | 662 // Decode local declarations, if any. |
| 663 uint32_t entries = consume_u32v("local decls count"); | 663 uint32_t entries = consume_u32v("local decls count"); |
| 664 TRACE("local decls count: %u\n", entries); |
| 664 while (entries-- > 0 && pc_ < limit_) { | 665 while (entries-- > 0 && pc_ < limit_) { |
| 665 uint32_t count = consume_u32v("local count"); | 666 uint32_t count = consume_u32v("local count"); |
| 667 if (count > kMaxNumWasmLocals) { |
| 668 error(pc_ - 1, "local count too large"); |
| 669 return; |
| 670 } |
| 666 byte code = consume_u8("local type"); | 671 byte code = consume_u8("local type"); |
| 667 LocalType type; | 672 LocalType type; |
| 668 switch (code) { | 673 switch (code) { |
| 669 case kLocalI32: | 674 case kLocalI32: |
| 670 type = kAstI32; | 675 type = kAstI32; |
| 671 break; | 676 break; |
| 672 case kLocalI64: | 677 case kLocalI64: |
| 673 type = kAstI64; | 678 type = kAstI64; |
| 674 break; | 679 break; |
| 675 case kLocalF32: | 680 case kLocalF32: |
| (...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 2064 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
| 2060 const byte* start, const byte* end) { | 2065 const byte* start, const byte* end) { |
| 2061 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 2066 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
| 2062 WasmFullDecoder decoder(zone, nullptr, body); | 2067 WasmFullDecoder decoder(zone, nullptr, body); |
| 2063 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 2068 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
| 2064 } | 2069 } |
| 2065 | 2070 |
| 2066 } // namespace wasm | 2071 } // namespace wasm |
| 2067 } // namespace internal | 2072 } // namespace internal |
| 2068 } // namespace v8 | 2073 } // namespace v8 |
| OLD | NEW |