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

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: Rebase 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 324 }
325 325
326 #define DECLARE_OPCODE_CASE(name, opcode, sig) \ 326 #define DECLARE_OPCODE_CASE(name, opcode, sig) \
327 case kExpr##name: \ 327 case kExpr##name: \
328 return kArity_##sig; 328 return kArity_##sig;
329 329
330 FOREACH_LOAD_MEM_OPCODE(DECLARE_OPCODE_CASE) 330 FOREACH_LOAD_MEM_OPCODE(DECLARE_OPCODE_CASE)
331 FOREACH_STORE_MEM_OPCODE(DECLARE_OPCODE_CASE) 331 FOREACH_STORE_MEM_OPCODE(DECLARE_OPCODE_CASE)
332 FOREACH_MISC_MEM_OPCODE(DECLARE_OPCODE_CASE) 332 FOREACH_MISC_MEM_OPCODE(DECLARE_OPCODE_CASE)
333 FOREACH_SIMPLE_OPCODE(DECLARE_OPCODE_CASE) 333 FOREACH_SIMPLE_OPCODE(DECLARE_OPCODE_CASE)
334 FOREACH_SIMPLE_MEM_OPCODE(DECLARE_OPCODE_CASE)
334 FOREACH_ASMJS_COMPAT_OPCODE(DECLARE_OPCODE_CASE) 335 FOREACH_ASMJS_COMPAT_OPCODE(DECLARE_OPCODE_CASE)
335 FOREACH_SIMD_OPCODE(DECLARE_OPCODE_CASE) 336 FOREACH_SIMD_OPCODE(DECLARE_OPCODE_CASE)
336 #undef DECLARE_OPCODE_CASE 337 #undef DECLARE_OPCODE_CASE
337 default: 338 default:
338 UNREACHABLE(); 339 UNREACHABLE();
339 return 0; 340 return 0;
340 } 341 }
341 } 342 }
342 343
343 int OpcodeLength(const byte* pc) { 344 int OpcodeLength(const byte* pc) {
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 case kExprF32StoreMem: 990 case kExprF32StoreMem:
990 len = DecodeStoreMem(kAstF32, MachineType::Float32()); 991 len = DecodeStoreMem(kAstF32, MachineType::Float32());
991 break; 992 break;
992 case kExprF64StoreMem: 993 case kExprF64StoreMem:
993 len = DecodeStoreMem(kAstF64, MachineType::Float64()); 994 len = DecodeStoreMem(kAstF64, MachineType::Float64());
994 break; 995 break;
995 996
996 case kExprMemorySize: 997 case kExprMemorySize:
997 Push(kAstI32, BUILD(MemSize, 0)); 998 Push(kAstI32, BUILD(MemSize, 0));
998 break; 999 break;
999 case kExprGrowMemory: {
1000 Value val = Pop(0, kAstI32);
1001 USE(val); // TODO(titzer): build node for grow memory
1002 Push(kAstI32, BUILD(Int32Constant, 0));
1003 break;
1004 }
1005 case kExprCallFunction: { 1000 case kExprCallFunction: {
1006 CallFunctionOperand operand(this, pc_); 1001 CallFunctionOperand operand(this, pc_);
1007 if (Validate(pc_, operand)) { 1002 if (Validate(pc_, operand)) {
1008 TFNode** buffer = PopArgs(operand.sig); 1003 TFNode** buffer = PopArgs(operand.sig);
1009 TFNode* call = 1004 TFNode* call =
1010 BUILD(CallDirect, operand.index, buffer, position()); 1005 BUILD(CallDirect, operand.index, buffer, position());
1011 Push(GetReturnType(operand.sig), call); 1006 Push(GetReturnType(operand.sig), call);
1012 } 1007 }
1013 len = 1 + operand.length; 1008 len = 1 + operand.length;
1014 break; 1009 break;
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 1680 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
1686 const byte* start, const byte* end) { 1681 const byte* start, const byte* end) {
1687 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 1682 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
1688 SR_WasmDecoder decoder(zone, nullptr, body); 1683 SR_WasmDecoder decoder(zone, nullptr, body);
1689 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 1684 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
1690 } 1685 }
1691 1686
1692 } // namespace wasm 1687 } // namespace wasm
1693 } // namespace internal 1688 } // namespace internal
1694 } // namespace v8 1689 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698