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 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 Value val = Pop(1, type); | 1324 Value val = Pop(1, type); |
1325 Value index = Pop(0, kAstI32); | 1325 Value index = Pop(0, kAstI32); |
1326 BUILD(StoreMem, mem_type, index.node, operand.offset, operand.alignment, | 1326 BUILD(StoreMem, mem_type, index.node, operand.offset, operand.alignment, |
1327 val.node, position()); | 1327 val.node, position()); |
1328 return 1 + operand.length; | 1328 return 1 + operand.length; |
1329 } | 1329 } |
1330 | 1330 |
1331 unsigned ExtractLane(WasmOpcode opcode, LocalType type) { | 1331 unsigned ExtractLane(WasmOpcode opcode, LocalType type) { |
1332 LaneOperand operand(this, pc_); | 1332 LaneOperand operand(this, pc_); |
1333 if (Validate(pc_, operand)) { | 1333 if (Validate(pc_, operand)) { |
1334 TFNode* input = Pop(0, LocalType::kSimd128).node; | 1334 compiler::NodeVector inputs(2, zone_); |
1335 TFNode* node = BUILD(SimdExtractLane, opcode, operand.lane, input); | 1335 inputs[1] = builder_->Int32Constant(operand.lane); |
| 1336 inputs[0] = Pop(0, LocalType::kSimd128).node; |
| 1337 TFNode* node = BUILD(SimdOp, opcode, inputs); |
1336 Push(type, node); | 1338 Push(type, node); |
1337 } | 1339 } |
1338 return operand.length; | 1340 return operand.length; |
1339 } | 1341 } |
1340 | 1342 |
| 1343 unsigned ReplaceLane(WasmOpcode opcode, LocalType type) { |
| 1344 LaneOperand operand(this, pc_); |
| 1345 if (Validate(pc_, operand)) { |
| 1346 compiler::NodeVector inputs(3, zone_); |
| 1347 inputs[2] = Pop(1, type).node; |
| 1348 inputs[1] = builder_->Int32Constant(operand.lane); |
| 1349 inputs[0] = Pop(0, LocalType::kSimd128).node; |
| 1350 TFNode* node = BUILD(SimdOp, opcode, inputs); |
| 1351 Push(LocalType::kSimd128, node); |
| 1352 } |
| 1353 return operand.length; |
| 1354 } |
| 1355 |
1341 unsigned DecodeSimdOpcode(WasmOpcode opcode) { | 1356 unsigned DecodeSimdOpcode(WasmOpcode opcode) { |
1342 unsigned len = 0; | 1357 unsigned len = 0; |
1343 switch (opcode) { | 1358 switch (opcode) { |
| 1359 case kExprI32x4ReplaceLane: { |
| 1360 len = ReplaceLane(opcode, LocalType::kWord32); |
| 1361 break; |
| 1362 } |
1344 case kExprI32x4ExtractLane: { | 1363 case kExprI32x4ExtractLane: { |
1345 len = ExtractLane(opcode, LocalType::kWord32); | 1364 len = ExtractLane(opcode, LocalType::kWord32); |
1346 break; | 1365 break; |
1347 } | 1366 } |
1348 case kExprF32x4ExtractLane: { | 1367 case kExprF32x4ExtractLane: { |
1349 len = ExtractLane(opcode, LocalType::kFloat32); | 1368 len = ExtractLane(opcode, LocalType::kFloat32); |
1350 break; | 1369 break; |
1351 } | 1370 } |
1352 default: { | 1371 default: { |
1353 FunctionSig* sig = WasmOpcodes::Signature(opcode); | 1372 FunctionSig* sig = WasmOpcodes::Signature(opcode); |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 2057 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
2039 const byte* start, const byte* end) { | 2058 const byte* start, const byte* end) { |
2040 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 2059 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
2041 WasmFullDecoder decoder(zone, nullptr, body); | 2060 WasmFullDecoder decoder(zone, nullptr, body); |
2042 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 2061 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
2043 } | 2062 } |
2044 | 2063 |
2045 } // namespace wasm | 2064 } // namespace wasm |
2046 } // namespace internal | 2065 } // namespace internal |
2047 } // namespace v8 | 2066 } // namespace v8 |
OLD | NEW |