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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1129 if (Validate(pc_, operand)) { | 1129 if (Validate(pc_, operand)) { |
1130 TFNode** buffer = PopArgs(operand.sig); | 1130 TFNode** buffer = PopArgs(operand.sig); |
1131 TFNode** rets = nullptr; | 1131 TFNode** rets = nullptr; |
1132 BUILD(CallDirect, operand.index, buffer, &rets, position()); | 1132 BUILD(CallDirect, operand.index, buffer, &rets, position()); |
1133 PushReturns(operand.sig, rets); | 1133 PushReturns(operand.sig, rets); |
1134 } | 1134 } |
1135 len = 1 + operand.length; | 1135 len = 1 + operand.length; |
1136 break; | 1136 break; |
1137 } | 1137 } |
1138 case kExprCallIndirect: { | 1138 case kExprCallIndirect: { |
1139 uint32_t table_index = 0; | |
1139 CallIndirectOperand operand(this, pc_); | 1140 CallIndirectOperand operand(this, pc_); |
1140 if (Validate(pc_, operand)) { | 1141 if (Validate(pc_, operand) && module_->IsValidTable(table_index)) { |
titzer
2016/11/07 09:24:11
Why not just move this logic into the Validate met
ahaas
2016/11/07 09:35:56
Done. I misunderstood the Validate method.
| |
1141 Value index = Pop(0, kAstI32); | 1142 Value index = Pop(0, kAstI32); |
1142 TFNode** buffer = PopArgs(operand.sig); | 1143 TFNode** buffer = PopArgs(operand.sig); |
1143 if (buffer) buffer[0] = index.node; | 1144 if (buffer) buffer[0] = index.node; |
1144 TFNode** rets = nullptr; | 1145 TFNode** rets = nullptr; |
1145 BUILD(CallIndirect, operand.index, buffer, &rets, position()); | 1146 BUILD(CallIndirect, operand.index, buffer, &rets, position()); |
1146 PushReturns(operand.sig, rets); | 1147 PushReturns(operand.sig, rets); |
1148 } else { | |
1149 error("function table has to exist to execute call_indirect"); | |
1147 } | 1150 } |
1148 len = 1 + operand.length; | 1151 len = 1 + operand.length; |
1149 break; | 1152 break; |
1150 } | 1153 } |
1151 case kSimdPrefix: { | 1154 case kSimdPrefix: { |
1152 CHECK_PROTOTYPE_OPCODE(wasm_simd_prototype); | 1155 CHECK_PROTOTYPE_OPCODE(wasm_simd_prototype); |
1153 len++; | 1156 len++; |
1154 byte simd_index = checked_read_u8(pc_, 1, "simd index"); | 1157 byte simd_index = checked_read_u8(pc_, 1, "simd index"); |
1155 opcode = static_cast<WasmOpcode>(opcode << 8 | simd_index); | 1158 opcode = static_cast<WasmOpcode>(opcode << 8 | simd_index); |
1156 TRACE(" @%-4d #%02x #%02x:%-20s|", startrel(pc_), kSimdPrefix, | 1159 TRACE(" @%-4d #%02x #%02x:%-20s|", startrel(pc_), kSimdPrefix, |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2030 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 2033 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
2031 const byte* start, const byte* end) { | 2034 const byte* start, const byte* end) { |
2032 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 2035 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
2033 WasmFullDecoder decoder(zone, nullptr, body); | 2036 WasmFullDecoder decoder(zone, nullptr, body); |
2034 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 2037 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
2035 } | 2038 } |
2036 | 2039 |
2037 } // namespace wasm | 2040 } // namespace wasm |
2038 } // namespace internal | 2041 } // namespace internal |
2039 } // namespace v8 | 2042 } // namespace v8 |
OLD | NEW |