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 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 unsigned ExtractLane(WasmOpcode opcode, LocalType type) { | 1328 unsigned ExtractLane(WasmOpcode opcode, LocalType type) { |
1329 LaneOperand operand(this, pc_); | 1329 LaneOperand operand(this, pc_); |
1330 if (Validate(pc_, operand)) { | 1330 if (Validate(pc_, operand)) { |
1331 TFNode* input = Pop(0, LocalType::kSimd128).node; | 1331 TFNode* input = Pop(0, LocalType::kSimd128).node; |
1332 TFNode* node = BUILD(SimdExtractLane, opcode, operand.lane, input); | 1332 TFNode* node = BUILD(SimdExtractLane, opcode, operand.lane, input); |
1333 Push(type, node); | 1333 Push(type, node); |
1334 } | 1334 } |
1335 return operand.length; | 1335 return operand.length; |
1336 } | 1336 } |
1337 | 1337 |
| 1338 unsigned ReplaceLane(WasmOpcode opcode, LocalType type) { |
| 1339 LaneOperand operand(this, pc_); |
| 1340 if (Validate(pc_, operand)) { |
| 1341 TFNode* input = Pop(0, LocalType::kSimd128).node; |
| 1342 TFNode* replacement = Pop(1, type).node; |
| 1343 TFNode* node = |
| 1344 BUILD(SimdReplaceLane, opcode, operand.lane, input, replacement); |
| 1345 Push(LocalType::kSimd128, node); |
| 1346 } |
| 1347 return operand.length; |
| 1348 } |
| 1349 |
1338 unsigned DecodeSimdOpcode(WasmOpcode opcode) { | 1350 unsigned DecodeSimdOpcode(WasmOpcode opcode) { |
1339 unsigned len = 0; | 1351 unsigned len = 0; |
1340 switch (opcode) { | 1352 switch (opcode) { |
1341 case kExprI32x4ExtractLane: { | 1353 case kExprI32x4ExtractLane: { |
1342 len = ExtractLane(opcode, LocalType::kWord32); | 1354 len = ExtractLane(opcode, LocalType::kWord32); |
1343 break; | 1355 break; |
1344 } | 1356 } |
1345 case kExprF32x4ExtractLane: { | 1357 case kExprF32x4ExtractLane: { |
1346 len = ExtractLane(opcode, LocalType::kFloat32); | 1358 len = ExtractLane(opcode, LocalType::kFloat32); |
1347 break; | 1359 break; |
1348 } | 1360 } |
| 1361 case kExprI32x4ReplaceLane: { |
| 1362 len = ReplaceLane(opcode, LocalType::kWord32); |
| 1363 break; |
| 1364 } |
| 1365 case kExprF32x4ReplaceLane: { |
| 1366 len = ReplaceLane(opcode, LocalType::kFloat32); |
| 1367 break; |
| 1368 } |
1349 default: { | 1369 default: { |
1350 FunctionSig* sig = WasmOpcodes::Signature(opcode); | 1370 FunctionSig* sig = WasmOpcodes::Signature(opcode); |
1351 if (sig != nullptr) { | 1371 if (sig != nullptr) { |
1352 compiler::NodeVector inputs(sig->parameter_count(), zone_); | 1372 compiler::NodeVector inputs(sig->parameter_count(), zone_); |
1353 for (size_t i = sig->parameter_count(); i > 0; i--) { | 1373 for (size_t i = sig->parameter_count(); i > 0; i--) { |
1354 Value val = Pop(static_cast<int>(i - 1), sig->GetParam(i - 1)); | 1374 Value val = Pop(static_cast<int>(i - 1), sig->GetParam(i - 1)); |
1355 inputs[i - 1] = val.node; | 1375 inputs[i - 1] = val.node; |
1356 } | 1376 } |
1357 TFNode* node = BUILD(SimdOp, opcode, inputs); | 1377 TFNode* node = BUILD(SimdOp, opcode, inputs); |
1358 Push(GetReturnType(sig), node); | 1378 Push(GetReturnType(sig), node); |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 2055 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
2036 const byte* start, const byte* end) { | 2056 const byte* start, const byte* end) { |
2037 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 2057 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
2038 WasmFullDecoder decoder(zone, nullptr, body); | 2058 WasmFullDecoder decoder(zone, nullptr, body); |
2039 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 2059 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
2040 } | 2060 } |
2041 | 2061 |
2042 } // namespace wasm | 2062 } // namespace wasm |
2043 } // namespace internal | 2063 } // namespace internal |
2044 } // namespace v8 | 2064 } // namespace v8 |
OLD | NEW |