OLD | NEW |
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 #include "src/wasm/ast-decoder.h" | 6 #include "src/wasm/ast-decoder.h" |
7 #include "src/wasm/decoder.h" | 7 #include "src/wasm/decoder.h" |
8 #include "src/wasm/wasm-external-refs.h" | 8 #include "src/wasm/wasm-external-refs.h" |
9 #include "src/wasm/wasm-module.h" | 9 #include "src/wasm/wasm-module.h" |
10 | 10 |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 DoCall(target, &pc, pc + 1 + operand.length, &limit); | 1390 DoCall(target, &pc, pc + 1 + operand.length, &limit); |
1391 code = target; | 1391 code = target; |
1392 decoder.Reset(code->start, code->end); | 1392 decoder.Reset(code->start, code->end); |
1393 continue; | 1393 continue; |
1394 } | 1394 } |
1395 case kExprCallIndirect: { | 1395 case kExprCallIndirect: { |
1396 CallIndirectOperand operand(&decoder, code->at(pc)); | 1396 CallIndirectOperand operand(&decoder, code->at(pc)); |
1397 size_t index = stack_.size() - operand.arity - 1; | 1397 size_t index = stack_.size() - operand.arity - 1; |
1398 DCHECK_LT(index, stack_.size()); | 1398 DCHECK_LT(index, stack_.size()); |
1399 uint32_t entry_index = stack_[index].to<uint32_t>(); | 1399 uint32_t entry_index = stack_[index].to<uint32_t>(); |
1400 // Assume only one table for now. | 1400 InterpreterCode* target = |
1401 DCHECK_LE(module()->function_tables.size(), 1u); | 1401 codemap()->GetIndirectCode(operand.table_index, entry_index); |
1402 InterpreterCode* target = codemap()->GetIndirectCode(0, entry_index); | |
1403 if (target == nullptr) { | 1402 if (target == nullptr) { |
1404 return DoTrap(kTrapFuncInvalid, pc); | 1403 return DoTrap(kTrapFuncInvalid, pc); |
1405 } else if (target->function->sig_index != operand.index) { | |
1406 return DoTrap(kTrapFuncSigMismatch, pc); | |
1407 } | 1404 } |
1408 | 1405 |
1409 DoCall(target, &pc, pc + 1 + operand.length, &limit); | 1406 DoCall(target, &pc, pc + 1 + operand.length, &limit); |
1410 code = target; | 1407 code = target; |
1411 decoder.Reset(code->start, code->end); | 1408 decoder.Reset(code->start, code->end); |
1412 continue; | 1409 continue; |
1413 } | 1410 } |
1414 case kExprCallImport: { | 1411 case kExprCallImport: { |
1415 UNIMPLEMENTED(); | 1412 UNIMPLEMENTED(); |
1416 break; | 1413 break; |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 | 1817 |
1821 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( | 1818 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( |
1822 Zone* zone, const byte* start, const byte* end) { | 1819 Zone* zone, const byte* start, const byte* end) { |
1823 ControlTransfers targets(zone, 0, start, end); | 1820 ControlTransfers targets(zone, 0, start, end); |
1824 return targets.map_; | 1821 return targets.map_; |
1825 } | 1822 } |
1826 | 1823 |
1827 } // namespace wasm | 1824 } // namespace wasm |
1828 } // namespace internal | 1825 } // namespace internal |
1829 } // namespace v8 | 1826 } // namespace v8 |
OLD | NEW |