| 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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 case kSimdPrefix: { | 1151 case kSimdPrefix: { |
| 1152 CHECK_PROTOTYPE_OPCODE(wasm_simd_prototype); | 1152 CHECK_PROTOTYPE_OPCODE(wasm_simd_prototype); |
| 1153 len++; | 1153 len++; |
| 1154 byte simd_index = checked_read_u8(pc_, 1, "simd index"); | 1154 byte simd_index = checked_read_u8(pc_, 1, "simd index"); |
| 1155 opcode = static_cast<WasmOpcode>(opcode << 8 | simd_index); | 1155 opcode = static_cast<WasmOpcode>(opcode << 8 | simd_index); |
| 1156 TRACE(" @%-4d #%02x #%02x:%-20s|", startrel(pc_), kSimdPrefix, | 1156 TRACE(" @%-4d #%02x #%02x:%-20s|", startrel(pc_), kSimdPrefix, |
| 1157 simd_index, WasmOpcodes::ShortOpcodeName(opcode)); | 1157 simd_index, WasmOpcodes::ShortOpcodeName(opcode)); |
| 1158 len += DecodeSimdOpcode(opcode); | 1158 len += DecodeSimdOpcode(opcode); |
| 1159 break; | 1159 break; |
| 1160 } | 1160 } |
| 1161 case kAtomicPrefix: { |
| 1162 if (!module_ || module_->origin != kAsmJsOrigin) { |
| 1163 error("Atomics are allowed only in AsmJs modules"); |
| 1164 break; |
| 1165 } |
| 1166 if (!FLAG_wasm_atomics_prototype) { |
| 1167 error("Invalid opcode (enable with --wasm_atomics_prototype)"); |
| 1168 break; |
| 1169 } |
| 1170 len = 2; |
| 1171 byte atomic_opcode = checked_read_u8(pc_, 1, "atomic index"); |
| 1172 opcode = static_cast<WasmOpcode>(opcode << 8 | atomic_opcode); |
| 1173 sig = WasmOpcodes::AtomicSignature(opcode); |
| 1174 if (sig) { |
| 1175 BuildAtomicOperator(opcode); |
| 1176 } |
| 1177 break; |
| 1178 } |
| 1161 default: { | 1179 default: { |
| 1162 // Deal with special asmjs opcodes. | 1180 // Deal with special asmjs opcodes. |
| 1163 if (module_ && module_->origin == kAsmJsOrigin) { | 1181 if (module_ && module_->origin == kAsmJsOrigin) { |
| 1164 sig = WasmOpcodes::AsmjsSignature(opcode); | 1182 sig = WasmOpcodes::AsmjsSignature(opcode); |
| 1165 if (sig) { | 1183 if (sig) { |
| 1166 BuildSimpleOperator(opcode, sig); | 1184 BuildSimpleOperator(opcode, sig); |
| 1167 } | 1185 } |
| 1168 } else { | 1186 } else { |
| 1169 error("Invalid opcode"); | 1187 error("Invalid opcode"); |
| 1170 return; | 1188 return; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 TFNode* node = BUILD(SimdOp, opcode, inputs); | 1351 TFNode* node = BUILD(SimdOp, opcode, inputs); |
| 1334 Push(GetReturnType(sig), node); | 1352 Push(GetReturnType(sig), node); |
| 1335 } else { | 1353 } else { |
| 1336 error("invalid simd opcode"); | 1354 error("invalid simd opcode"); |
| 1337 } | 1355 } |
| 1338 } | 1356 } |
| 1339 } | 1357 } |
| 1340 return len; | 1358 return len; |
| 1341 } | 1359 } |
| 1342 | 1360 |
| 1361 void BuildAtomicOperator(WasmOpcode opcode) { UNIMPLEMENTED(); } |
| 1362 |
| 1343 void DoReturn() { | 1363 void DoReturn() { |
| 1344 int count = static_cast<int>(sig_->return_count()); | 1364 int count = static_cast<int>(sig_->return_count()); |
| 1345 TFNode** buffer = nullptr; | 1365 TFNode** buffer = nullptr; |
| 1346 if (build()) buffer = builder_->Buffer(count); | 1366 if (build()) buffer = builder_->Buffer(count); |
| 1347 | 1367 |
| 1348 // Pop return values off the stack in reverse order. | 1368 // Pop return values off the stack in reverse order. |
| 1349 for (int i = count - 1; i >= 0; i--) { | 1369 for (int i = count - 1; i >= 0; i--) { |
| 1350 Value val = Pop(i, sig_->GetReturn(i)); | 1370 Value val = Pop(i, sig_->GetReturn(i)); |
| 1351 if (buffer) buffer[i] = val.node; | 1371 if (buffer) buffer[i] = val.node; |
| 1352 } | 1372 } |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 2030 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
| 2011 const byte* start, const byte* end) { | 2031 const byte* start, const byte* end) { |
| 2012 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 2032 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
| 2013 WasmFullDecoder decoder(zone, nullptr, body); | 2033 WasmFullDecoder decoder(zone, nullptr, body); |
| 2014 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 2034 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
| 2015 } | 2035 } |
| 2016 | 2036 |
| 2017 } // namespace wasm | 2037 } // namespace wasm |
| 2018 } // namespace internal | 2038 } // namespace internal |
| 2019 } // namespace v8 | 2039 } // namespace v8 |
| OLD | NEW |