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

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

Issue 2209433002: [wasm] Make LoadGlobal/StoreGlobal opcodes match what is coming in binary 0xC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-interpreter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 FOREACH_SIGNATURE(DECLARE_ARITY); 249 FOREACH_SIGNATURE(DECLARE_ARITY);
250 #undef DECLARE_ARITY 250 #undef DECLARE_ARITY
251 251
252 switch (static_cast<WasmOpcode>(*pc)) { 252 switch (static_cast<WasmOpcode>(*pc)) {
253 case kExprI8Const: 253 case kExprI8Const:
254 case kExprI32Const: 254 case kExprI32Const:
255 case kExprI64Const: 255 case kExprI64Const:
256 case kExprF64Const: 256 case kExprF64Const:
257 case kExprF32Const: 257 case kExprF32Const:
258 case kExprGetLocal: 258 case kExprGetLocal:
259 case kExprLoadGlobal: 259 case kExprGetGlobal:
260 case kExprNop: 260 case kExprNop:
261 case kExprUnreachable: 261 case kExprUnreachable:
262 case kExprEnd: 262 case kExprEnd:
263 case kExprBlock: 263 case kExprBlock:
264 case kExprLoop: 264 case kExprLoop:
265 return 0; 265 return 0;
266 266
267 case kExprStoreGlobal: 267 case kExprSetGlobal:
268 case kExprSetLocal: 268 case kExprSetLocal:
269 case kExprElse: 269 case kExprElse:
270 return 1; 270 return 1;
271 271
272 case kExprBr: { 272 case kExprBr: {
273 BreakDepthOperand operand(this, pc); 273 BreakDepthOperand operand(this, pc);
274 return operand.arity; 274 return operand.arity;
275 } 275 }
276 case kExprBrIf: { 276 case kExprBrIf: {
277 BreakDepthOperand operand(this, pc); 277 BreakDepthOperand operand(this, pc);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 #undef DECLARE_OPCODE_CASE 332 #undef DECLARE_OPCODE_CASE
333 { 333 {
334 MemoryAccessOperand operand(this, pc); 334 MemoryAccessOperand operand(this, pc);
335 return 1 + operand.length; 335 return 1 + operand.length;
336 } 336 }
337 case kExprBr: 337 case kExprBr:
338 case kExprBrIf: { 338 case kExprBrIf: {
339 BreakDepthOperand operand(this, pc); 339 BreakDepthOperand operand(this, pc);
340 return 1 + operand.length; 340 return 1 + operand.length;
341 } 341 }
342 case kExprStoreGlobal: 342 case kExprSetGlobal:
343 case kExprLoadGlobal: { 343 case kExprGetGlobal: {
344 GlobalIndexOperand operand(this, pc); 344 GlobalIndexOperand operand(this, pc);
345 return 1 + operand.length; 345 return 1 + operand.length;
346 } 346 }
347 347
348 case kExprCallFunction: { 348 case kExprCallFunction: {
349 CallFunctionOperand operand(this, pc); 349 CallFunctionOperand operand(this, pc);
350 return 1 + operand.length; 350 return 1 + operand.length;
351 } 351 }
352 case kExprCallIndirect: { 352 case kExprCallIndirect: {
353 CallIndirectOperand operand(this, pc); 353 CallIndirectOperand operand(this, pc);
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 case kExprSetLocal: { 884 case kExprSetLocal: {
885 LocalIndexOperand operand(this, pc_); 885 LocalIndexOperand operand(this, pc_);
886 if (Validate(pc_, operand)) { 886 if (Validate(pc_, operand)) {
887 Value val = Pop(0, local_type_vec_[operand.index]); 887 Value val = Pop(0, local_type_vec_[operand.index]);
888 if (ssa_env_->locals) ssa_env_->locals[operand.index] = val.node; 888 if (ssa_env_->locals) ssa_env_->locals[operand.index] = val.node;
889 Push(val.type, val.node); 889 Push(val.type, val.node);
890 } 890 }
891 len = 1 + operand.length; 891 len = 1 + operand.length;
892 break; 892 break;
893 } 893 }
894 case kExprLoadGlobal: { 894 case kExprGetGlobal: {
895 GlobalIndexOperand operand(this, pc_); 895 GlobalIndexOperand operand(this, pc_);
896 if (Validate(pc_, operand)) { 896 if (Validate(pc_, operand)) {
897 Push(operand.type, BUILD(LoadGlobal, operand.index)); 897 Push(operand.type, BUILD(GetGlobal, operand.index));
898 } 898 }
899 len = 1 + operand.length; 899 len = 1 + operand.length;
900 break; 900 break;
901 } 901 }
902 case kExprStoreGlobal: { 902 case kExprSetGlobal: {
903 GlobalIndexOperand operand(this, pc_); 903 GlobalIndexOperand operand(this, pc_);
904 if (Validate(pc_, operand)) { 904 if (Validate(pc_, operand)) {
905 Value val = Pop(0, operand.type); 905 Value val = Pop(0, operand.type);
906 BUILD(StoreGlobal, operand.index, val.node); 906 BUILD(SetGlobal, operand.index, val.node);
907 Push(val.type, val.node); 907 Push(val.type, val.node);
908 } 908 }
909 len = 1 + operand.length; 909 len = 1 + operand.length;
910 break; 910 break;
911 } 911 }
912 case kExprI32LoadMem8S: 912 case kExprI32LoadMem8S:
913 len = DecodeLoadMem(kAstI32, MachineType::Int8()); 913 len = DecodeLoadMem(kAstI32, MachineType::Int8());
914 break; 914 break;
915 case kExprI32LoadMem8U: 915 case kExprI32LoadMem8U:
916 len = DecodeLoadMem(kAstI32, MachineType::Uint8()); 916 len = DecodeLoadMem(kAstI32, MachineType::Uint8());
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 1702 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
1703 const byte* start, const byte* end) { 1703 const byte* start, const byte* end) {
1704 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 1704 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
1705 WasmFullDecoder decoder(zone, nullptr, body); 1705 WasmFullDecoder decoder(zone, nullptr, body);
1706 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 1706 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
1707 } 1707 }
1708 1708
1709 } // namespace wasm 1709 } // namespace wasm
1710 } // namespace internal 1710 } // namespace internal
1711 } // namespace v8 1711 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698