Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/wasm/wasm-interpreter.cc

Issue 2463063002: [wasm] Fix br_table in the wasm interpreter to use varuint32. (Closed)
Patch Set: Remove unused variable Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/wasm-interpreter.h" 5 #include "src/wasm/wasm-interpreter.h"
6 6
7 #include "src/utils.h" 7 #include "src/utils.h"
8 #include "src/wasm/ast-decoder.h" 8 #include "src/wasm/ast-decoder.h"
9 #include "src/wasm/decoder.h" 9 #include "src/wasm/decoder.h"
10 #include "src/wasm/wasm-external-refs.h" 10 #include "src/wasm/wasm-external-refs.h"
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 len = DoBreak(code, pc, operand.depth); 1324 len = DoBreak(code, pc, operand.depth);
1325 TRACE(" br_if => @%zu\n", pc + len); 1325 TRACE(" br_if => @%zu\n", pc + len);
1326 } else { 1326 } else {
1327 TRACE(" false => fallthrough\n"); 1327 TRACE(" false => fallthrough\n");
1328 len = 1 + operand.length; 1328 len = 1 + operand.length;
1329 } 1329 }
1330 break; 1330 break;
1331 } 1331 }
1332 case kExprBrTable: { 1332 case kExprBrTable: {
1333 BranchTableOperand operand(&decoder, code->at(pc)); 1333 BranchTableOperand operand(&decoder, code->at(pc));
1334 BranchTableIterator iterator(&decoder, operand);
1334 uint32_t key = Pop().to<uint32_t>(); 1335 uint32_t key = Pop().to<uint32_t>();
1336 uint32_t depth = 0;
1335 if (key >= operand.table_count) key = operand.table_count; 1337 if (key >= operand.table_count) key = operand.table_count;
1336 len = key + DoBreak(code, pc + key, operand.table[key]); 1338 for (uint32_t i = 0; i <= key; i++) {
1339 DCHECK(iterator.has_next());
1340 depth = iterator.next();
1341 }
1342 len = key + DoBreak(code, pc + key, static_cast<size_t>(depth));
1337 TRACE(" br[%u] => @%zu\n", key, pc + key + len); 1343 TRACE(" br[%u] => @%zu\n", key, pc + key + len);
1338 break; 1344 break;
1339 } 1345 }
1340 case kExprReturn: { 1346 case kExprReturn: {
1341 size_t arity = code->function->sig->return_count(); 1347 size_t arity = code->function->sig->return_count();
1342 if (!DoReturn(&code, &pc, &limit, arity)) return; 1348 if (!DoReturn(&code, &pc, &limit, arity)) return;
1343 decoder.Reset(code->start, code->end); 1349 decoder.Reset(code->start, code->end);
1344 continue; 1350 continue;
1345 } 1351 }
1346 case kExprUnreachable: { 1352 case kExprUnreachable: {
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 1885
1880 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( 1886 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting(
1881 Zone* zone, const byte* start, const byte* end) { 1887 Zone* zone, const byte* start, const byte* end) {
1882 ControlTransfers targets(zone, nullptr, nullptr, start, end); 1888 ControlTransfers targets(zone, nullptr, nullptr, start, end);
1883 return targets.map_; 1889 return targets.map_;
1884 } 1890 }
1885 1891
1886 } // namespace wasm 1892 } // namespace wasm
1887 } // namespace internal 1893 } // namespace internal
1888 } // namespace v8 1894 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698