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

Side by Side Diff: src/wasm/ast-decoder.cc

Issue 2385393002: [wasm] Implement I32x4ReplaceLane, I32x4Add, I32x4Sub. (Closed)
Patch Set: Add lanes as compile time constants Created 4 years 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
OLDNEW
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
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(1, zone_);
1335 TFNode* node = BUILD(SimdExtractLane, opcode, operand.lane, input); 1335 inputs[0] = Pop(0, LocalType::kSimd128).node;
1336 TFNode* node = BUILD(SimdLaneOp, opcode, operand.lane, inputs);
1336 Push(type, node); 1337 Push(type, node);
1337 } 1338 }
1338 return operand.length; 1339 return operand.length;
1339 } 1340 }
1340 1341
1342 unsigned ReplaceLane(WasmOpcode opcode, LocalType type) {
1343 LaneOperand operand(this, pc_);
1344 if (Validate(pc_, operand)) {
1345 compiler::NodeVector inputs(2, zone_);
1346 inputs[1] = Pop(1, type).node;
1347 inputs[0] = Pop(0, LocalType::kSimd128).node;
1348 TFNode* node = BUILD(SimdLaneOp, opcode, operand.lane, inputs);
1349 Push(LocalType::kSimd128, node);
1350 }
1351 return operand.length;
1352 }
1353
1341 unsigned DecodeSimdOpcode(WasmOpcode opcode) { 1354 unsigned DecodeSimdOpcode(WasmOpcode opcode) {
1342 unsigned len = 0; 1355 unsigned len = 0;
1343 switch (opcode) { 1356 switch (opcode) {
1357 case kExprI32x4ReplaceLane: {
1358 len = ReplaceLane(opcode, LocalType::kWord32);
1359 break;
1360 }
1344 case kExprI32x4ExtractLane: { 1361 case kExprI32x4ExtractLane: {
1345 len = ExtractLane(opcode, LocalType::kWord32); 1362 len = ExtractLane(opcode, LocalType::kWord32);
1346 break; 1363 break;
1347 } 1364 }
1348 case kExprF32x4ExtractLane: { 1365 case kExprF32x4ExtractLane: {
1349 len = ExtractLane(opcode, LocalType::kFloat32); 1366 len = ExtractLane(opcode, LocalType::kFloat32);
1350 break; 1367 break;
1351 } 1368 }
1352 default: { 1369 default: {
1353 FunctionSig* sig = WasmOpcodes::Signature(opcode); 1370 FunctionSig* sig = WasmOpcodes::Signature(opcode);
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 2055 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
2039 const byte* start, const byte* end) { 2056 const byte* start, const byte* end) {
2040 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 2057 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
2041 WasmFullDecoder decoder(zone, nullptr, body); 2058 WasmFullDecoder decoder(zone, nullptr, body);
2042 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 2059 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
2043 } 2060 }
2044 2061
2045 } // namespace wasm 2062 } // namespace wasm
2046 } // namespace internal 2063 } // namespace internal
2047 } // namespace v8 2064 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698