| 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 | 6 | 
| 7 #include "src/base/functional.h" | 7 #include "src/base/functional.h" | 
| 8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" | 
| 9 #include "src/flags.h" | 9 #include "src/flags.h" | 
| 10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" | 
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 171       } | 171       } | 
| 172     } | 172     } | 
| 173   } | 173   } | 
| 174 }; | 174 }; | 
| 175 | 175 | 
| 176 // The main logic for decoding the bytes of a module. | 176 // The main logic for decoding the bytes of a module. | 
| 177 class ModuleDecoder : public Decoder { | 177 class ModuleDecoder : public Decoder { | 
| 178  public: | 178  public: | 
| 179   ModuleDecoder(Zone* zone, const byte* module_start, const byte* module_end, | 179   ModuleDecoder(Zone* zone, const byte* module_start, const byte* module_end, | 
| 180                 ModuleOrigin origin) | 180                 ModuleOrigin origin) | 
| 181       : Decoder(module_start, module_end), module_zone(zone), origin_(origin) { | 181       : Decoder(module_start, module_end), | 
|  | 182         module_zone(zone), | 
|  | 183         origin_(FLAG_assume_asmjs_origin ? kAsmJsOrigin : origin) { | 
| 182     result_.start = start_; | 184     result_.start = start_; | 
| 183     if (end_ < start_) { | 185     if (end_ < start_) { | 
| 184       error(start_, "end is less than start"); | 186       error(start_, "end is less than start"); | 
| 185       end_ = start_; | 187       end_ = start_; | 
| 186     } | 188     } | 
| 187   } | 189   } | 
| 188 | 190 | 
| 189   virtual void onFirstError() { | 191   virtual void onFirstError() { | 
| 190     pc_ = end_;  // On error, terminate section decoding loop. | 192     pc_ = end_;  // On error, terminate section decoding loop. | 
| 191   } | 193   } | 
| (...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1294     result.push_back({section_start, name_offset, name_length, payload_offset, | 1296     result.push_back({section_start, name_offset, name_length, payload_offset, | 
| 1295                       payload_length, section_length}); | 1297                       payload_length, section_length}); | 
| 1296   } | 1298   } | 
| 1297 | 1299 | 
| 1298   return result; | 1300   return result; | 
| 1299 } | 1301 } | 
| 1300 | 1302 | 
| 1301 }  // namespace wasm | 1303 }  // namespace wasm | 
| 1302 }  // namespace internal | 1304 }  // namespace internal | 
| 1303 }  // namespace v8 | 1305 }  // namespace v8 | 
| OLD | NEW | 
|---|