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

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

Issue 2051043002: Implement Wasm GrowMemory opcode as a wasm runtime call (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test failures Created 4 years, 6 months 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-containers.h" 10 #include "src/zone-containers.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 303 }
304 304
305 #define DECLARE_OPCODE_CASE(name, opcode, sig) \ 305 #define DECLARE_OPCODE_CASE(name, opcode, sig) \
306 case kExpr##name: \ 306 case kExpr##name: \
307 return kArity_##sig; 307 return kArity_##sig;
308 308
309 FOREACH_LOAD_MEM_OPCODE(DECLARE_OPCODE_CASE) 309 FOREACH_LOAD_MEM_OPCODE(DECLARE_OPCODE_CASE)
310 FOREACH_STORE_MEM_OPCODE(DECLARE_OPCODE_CASE) 310 FOREACH_STORE_MEM_OPCODE(DECLARE_OPCODE_CASE)
311 FOREACH_MISC_MEM_OPCODE(DECLARE_OPCODE_CASE) 311 FOREACH_MISC_MEM_OPCODE(DECLARE_OPCODE_CASE)
312 FOREACH_SIMPLE_OPCODE(DECLARE_OPCODE_CASE) 312 FOREACH_SIMPLE_OPCODE(DECLARE_OPCODE_CASE)
313 FOREACH_SIMPLE_MEM_OPCODE(DECLARE_OPCODE_CASE)
313 FOREACH_ASMJS_COMPAT_OPCODE(DECLARE_OPCODE_CASE) 314 FOREACH_ASMJS_COMPAT_OPCODE(DECLARE_OPCODE_CASE)
314 FOREACH_SIMD_OPCODE(DECLARE_OPCODE_CASE) 315 FOREACH_SIMD_OPCODE(DECLARE_OPCODE_CASE)
315 #undef DECLARE_OPCODE_CASE 316 #undef DECLARE_OPCODE_CASE
316 default: 317 default:
317 UNREACHABLE(); 318 UNREACHABLE();
318 return 0; 319 return 0;
319 } 320 }
320 } 321 }
321 322
322 int OpcodeLength(const byte* pc) { 323 int OpcodeLength(const byte* pc) {
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 case kExprF32StoreMem: 969 case kExprF32StoreMem:
969 len = DecodeStoreMem(kAstF32, MachineType::Float32()); 970 len = DecodeStoreMem(kAstF32, MachineType::Float32());
970 break; 971 break;
971 case kExprF64StoreMem: 972 case kExprF64StoreMem:
972 len = DecodeStoreMem(kAstF64, MachineType::Float64()); 973 len = DecodeStoreMem(kAstF64, MachineType::Float64());
973 break; 974 break;
974 975
975 case kExprMemorySize: 976 case kExprMemorySize:
976 Push(kAstI32, BUILD(MemSize, 0)); 977 Push(kAstI32, BUILD(MemSize, 0));
977 break; 978 break;
978 case kExprGrowMemory: {
979 Value val = Pop(0, kAstI32);
980 USE(val); // TODO(titzer): build node for grow memory
981 Push(kAstI32, BUILD(Int32Constant, 0));
982 break;
983 }
984 case kExprCallFunction: { 979 case kExprCallFunction: {
985 CallFunctionOperand operand(this, pc_); 980 CallFunctionOperand operand(this, pc_);
986 if (Validate(pc_, operand)) { 981 if (Validate(pc_, operand)) {
987 TFNode** buffer = PopArgs(operand.sig); 982 TFNode** buffer = PopArgs(operand.sig);
988 TFNode* call = 983 TFNode* call =
989 BUILD(CallDirect, operand.index, buffer, position()); 984 BUILD(CallDirect, operand.index, buffer, position());
990 Push(GetReturnType(operand.sig), call); 985 Push(GetReturnType(operand.sig), call);
991 } 986 }
992 len = 1 + operand.length; 987 len = 1 + operand.length;
993 break; 988 break;
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 1643 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
1649 const byte* start, const byte* end) { 1644 const byte* start, const byte* end) {
1650 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 1645 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
1651 SR_WasmDecoder decoder(zone, nullptr, body); 1646 SR_WasmDecoder decoder(zone, nullptr, body);
1652 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 1647 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
1653 } 1648 }
1654 1649
1655 } // namespace wasm 1650 } // namespace wasm
1656 } // namespace internal 1651 } // namespace internal
1657 } // namespace v8 1652 } // namespace v8
OLDNEW
« src/runtime/runtime-wasm.cc ('K') | « src/v8.gyp ('k') | src/wasm/wasm-opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698