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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 local_type_vec_.reserve(sig_->parameter_count()); | 583 local_type_vec_.reserve(sig_->parameter_count()); |
584 for (size_t i = 0; i < sig_->parameter_count(); ++i) { | 584 for (size_t i = 0; i < sig_->parameter_count(); ++i) { |
585 local_type_vec_.push_back(sig_->GetParam(i)); | 585 local_type_vec_.push_back(sig_->GetParam(i)); |
586 } | 586 } |
587 } | 587 } |
588 // Decode local declarations, if any. | 588 // Decode local declarations, if any. |
589 uint32_t entries = consume_u32v("local decls count"); | 589 uint32_t entries = consume_u32v("local decls count"); |
590 TRACE("local decls count: %u\n", entries); | 590 TRACE("local decls count: %u\n", entries); |
591 while (entries-- > 0 && pc_ < limit_) { | 591 while (entries-- > 0 && pc_ < limit_) { |
592 uint32_t count = consume_u32v("local count"); | 592 uint32_t count = consume_u32v("local count"); |
593 if (count > kMaxNumWasmLocals) { | 593 if ((count + local_type_vec_.size()) > kMaxNumWasmLocals) { |
594 error(pc_ - 1, "local count too large"); | 594 error(pc_ - 1, "local count too large"); |
595 return; | 595 return; |
596 } | 596 } |
597 byte code = consume_u8("local type"); | 597 byte code = consume_u8("local type"); |
598 LocalType type; | 598 LocalType type; |
599 switch (code) { | 599 switch (code) { |
600 case kLocalI32: | 600 case kLocalI32: |
601 type = kAstI32; | 601 type = kAstI32; |
602 break; | 602 break; |
603 case kLocalI64: | 603 case kLocalI64: |
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2059 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 2059 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
2060 const byte* start, const byte* end) { | 2060 const byte* start, const byte* end) { |
2061 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 2061 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
2062 WasmFullDecoder decoder(zone, nullptr, body); | 2062 WasmFullDecoder decoder(zone, nullptr, body); |
2063 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 2063 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
2064 } | 2064 } |
2065 | 2065 |
2066 } // namespace wasm | 2066 } // namespace wasm |
2067 } // namespace internal | 2067 } // namespace internal |
2068 } // namespace v8 | 2068 } // namespace v8 |
OLD | NEW |