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-containers.h" | 10 #include "src/zone-containers.h" |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 CallImportOperand operand(this, pc_); | 1012 CallImportOperand operand(this, pc_); |
1013 if (Validate(pc_, operand)) { | 1013 if (Validate(pc_, operand)) { |
1014 TFNode** buffer = PopArgs(operand.sig); | 1014 TFNode** buffer = PopArgs(operand.sig); |
1015 TFNode* call = | 1015 TFNode* call = |
1016 BUILD(CallImport, operand.index, buffer, position()); | 1016 BUILD(CallImport, operand.index, buffer, position()); |
1017 Push(GetReturnType(operand.sig), call); | 1017 Push(GetReturnType(operand.sig), call); |
1018 } | 1018 } |
1019 len = 1 + operand.length; | 1019 len = 1 + operand.length; |
1020 break; | 1020 break; |
1021 } | 1021 } |
| 1022 case kSimdPrefix: { |
| 1023 if (FLAG_wasm_simd_prototype) { |
| 1024 len++; |
| 1025 byte simd_index = *(pc_ + 1); |
| 1026 opcode = static_cast<WasmOpcode>(opcode << 8 | simd_index); |
| 1027 DecodeSimdOpcode(opcode); |
| 1028 break; |
| 1029 } |
| 1030 } |
1022 case kExprJITSingleFunction: { | 1031 case kExprJITSingleFunction: { |
1023 if (FLAG_wasm_jit_prototype) { | 1032 if (FLAG_wasm_jit_prototype) { |
1024 JITSingleFunctionOperand operand(this, pc_); | 1033 JITSingleFunctionOperand operand(this, pc_); |
1025 if (Validate(pc_, operand)) { | 1034 if (Validate(pc_, operand)) { |
1026 Value index = Pop(2, kAstI32); | 1035 Value index = Pop(2, kAstI32); |
1027 Value length = Pop(1, kAstI32); | 1036 Value length = Pop(1, kAstI32); |
1028 Value base = Pop(0, kAstI32); | 1037 Value base = Pop(0, kAstI32); |
1029 TFNode* call = | 1038 TFNode* call = |
1030 BUILD(JITSingleFunction, base.node, length.node, index.node, | 1039 BUILD(JITSingleFunction, base.node, length.node, index.node, |
1031 operand.sig_index, operand.sig, position()); | 1040 operand.sig_index, operand.sig, position()); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 int DecodeStoreMem(LocalType type, MachineType mem_type) { | 1141 int DecodeStoreMem(LocalType type, MachineType mem_type) { |
1133 MemoryAccessOperand operand(this, pc_); | 1142 MemoryAccessOperand operand(this, pc_); |
1134 Value val = Pop(1, type); | 1143 Value val = Pop(1, type); |
1135 Value index = Pop(0, kAstI32); | 1144 Value index = Pop(0, kAstI32); |
1136 BUILD(StoreMem, mem_type, index.node, operand.offset, operand.alignment, | 1145 BUILD(StoreMem, mem_type, index.node, operand.offset, operand.alignment, |
1137 val.node, position()); | 1146 val.node, position()); |
1138 Push(type, val.node); | 1147 Push(type, val.node); |
1139 return 1 + operand.length; | 1148 return 1 + operand.length; |
1140 } | 1149 } |
1141 | 1150 |
| 1151 void DecodeSimdOpcode(WasmOpcode opcode) { |
| 1152 FunctionSig* sig = WasmOpcodes::Signature(opcode); |
| 1153 compiler::NodeVector inputs(sig->parameter_count(), zone_); |
| 1154 for (size_t i = sig->parameter_count(); i > 0; i--) { |
| 1155 Value val = Pop(static_cast<int>(i - 1), sig->GetParam(i - 1)); |
| 1156 inputs[i - 1] = val.node; |
| 1157 } |
| 1158 TFNode* node = BUILD(SimdOp, opcode, inputs); |
| 1159 Push(GetReturnType(sig), node); |
| 1160 } |
| 1161 |
1142 void DoReturn() { | 1162 void DoReturn() { |
1143 int count = static_cast<int>(sig_->return_count()); | 1163 int count = static_cast<int>(sig_->return_count()); |
1144 TFNode** buffer = nullptr; | 1164 TFNode** buffer = nullptr; |
1145 if (build()) buffer = builder_->Buffer(count); | 1165 if (build()) buffer = builder_->Buffer(count); |
1146 | 1166 |
1147 // Pop return values off the stack in reverse order. | 1167 // Pop return values off the stack in reverse order. |
1148 for (int i = count - 1; i >= 0; i--) { | 1168 for (int i = count - 1; i >= 0; i--) { |
1149 Value val = Pop(i, sig_->GetReturn(i)); | 1169 Value val = Pop(i, sig_->GetReturn(i)); |
1150 if (buffer) buffer[i] = val.node; | 1170 if (buffer) buffer[i] = val.node; |
1151 } | 1171 } |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1683 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 1703 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
1684 const byte* start, const byte* end) { | 1704 const byte* start, const byte* end) { |
1685 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 1705 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
1686 WasmFullDecoder decoder(zone, nullptr, body); | 1706 WasmFullDecoder decoder(zone, nullptr, body); |
1687 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 1707 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
1688 } | 1708 } |
1689 | 1709 |
1690 } // namespace wasm | 1710 } // namespace wasm |
1691 } // namespace internal | 1711 } // namespace internal |
1692 } // namespace v8 | 1712 } // namespace v8 |
OLD | NEW |