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/wasm/module-decoder.h" | 5 #include "src/wasm/module-decoder.h" |
6 #include "src/wasm/function-body-decoder-impl.h" | 6 #include "src/wasm/function-body-decoder-impl.h" |
7 | 7 |
8 #include "src/base/functional.h" | 8 #include "src/base/functional.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/counters.h" | 10 #include "src/counters.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 private: | 139 private: |
140 Decoder& decoder_; | 140 Decoder& decoder_; |
141 WasmSectionCode section_code_; | 141 WasmSectionCode section_code_; |
142 const byte* section_start_; | 142 const byte* section_start_; |
143 const byte* payload_start_; | 143 const byte* payload_start_; |
144 const byte* section_end_; | 144 const byte* section_end_; |
145 | 145 |
146 // Reads the section code/name at the current position and sets up | 146 // Reads the section code/name at the current position and sets up |
147 // the internal fields. | 147 // the embedder fields. |
148 void next() { | 148 void next() { |
149 while (true) { | 149 while (true) { |
150 if (!decoder_.more()) { | 150 if (!decoder_.more()) { |
151 section_code_ = kUnknownSectionCode; | 151 section_code_ = kUnknownSectionCode; |
152 return; | 152 return; |
153 } | 153 } |
154 uint8_t section_code = decoder_.consume_u8("section code"); | 154 uint8_t section_code = decoder_.consume_u8("section code"); |
155 // Read and check the section size. | 155 // Read and check the section size. |
156 uint32_t section_length = decoder_.consume_u32v("section length"); | 156 uint32_t section_length = decoder_.consume_u32v("section length"); |
157 section_start_ = decoder_.pc(); | 157 section_start_ = decoder_.pc(); |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 result.push_back({section_start, name_offset, name_length, payload_offset, | 1340 result.push_back({section_start, name_offset, name_length, payload_offset, |
1341 payload_length, section_length}); | 1341 payload_length, section_length}); |
1342 } | 1342 } |
1343 | 1343 |
1344 return result; | 1344 return result; |
1345 } | 1345 } |
1346 | 1346 |
1347 } // namespace wasm | 1347 } // namespace wasm |
1348 } // namespace internal | 1348 } // namespace internal |
1349 } // namespace v8 | 1349 } // namespace v8 |
OLD | NEW |