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

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

Issue 2440953002: [wasm] Binary 0xD: update encoding of opcodes, types, and add immediates. (Closed)
Patch Set: Created 4 years, 2 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/zone-containers.h" 10 #include "src/zone/zone-containers.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 return 1 + iterator.length(); 310 return 1 + iterator.length();
311 } 311 }
312 case kExprI32Const: { 312 case kExprI32Const: {
313 ImmI32Operand operand(this, pc); 313 ImmI32Operand operand(this, pc);
314 return 1 + operand.length; 314 return 1 + operand.length;
315 } 315 }
316 case kExprI64Const: { 316 case kExprI64Const: {
317 ImmI64Operand operand(this, pc); 317 ImmI64Operand operand(this, pc);
318 return 1 + operand.length; 318 return 1 + operand.length;
319 } 319 }
320 case kExprGrowMemory:
321 case kExprMemorySize: {
322 MemoryIndexOperand operand(this, pc);
323 return 1 + operand.length;
324 }
320 case kExprI8Const: 325 case kExprI8Const:
321 return 2; 326 return 2;
322 case kExprF32Const: 327 case kExprF32Const:
323 return 5; 328 return 5;
324 case kExprF64Const: 329 case kExprF64Const:
325 return 9; 330 return 9;
326 case kSimdPrefix: { 331 case kSimdPrefix: {
327 byte simd_index = *(pc + 1); 332 byte simd_index = *(pc + 1);
328 WasmOpcode opcode = 333 WasmOpcode opcode =
329 static_cast<WasmOpcode>(kSimdPrefix << 8 | simd_index); 334 static_cast<WasmOpcode>(kSimdPrefix << 8 | simd_index);
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 break; 1099 break;
1095 case kExprI64StoreMem: 1100 case kExprI64StoreMem:
1096 len = DecodeStoreMem(kAstI64, MachineType::Int64()); 1101 len = DecodeStoreMem(kAstI64, MachineType::Int64());
1097 break; 1102 break;
1098 case kExprF32StoreMem: 1103 case kExprF32StoreMem:
1099 len = DecodeStoreMem(kAstF32, MachineType::Float32()); 1104 len = DecodeStoreMem(kAstF32, MachineType::Float32());
1100 break; 1105 break;
1101 case kExprF64StoreMem: 1106 case kExprF64StoreMem:
1102 len = DecodeStoreMem(kAstF64, MachineType::Float64()); 1107 len = DecodeStoreMem(kAstF64, MachineType::Float64());
1103 break; 1108 break;
1104 case kExprGrowMemory: 1109 case kExprGrowMemory: {
1110 MemoryIndexOperand operand(this, pc_);
1105 if (module_->origin != kAsmJsOrigin) { 1111 if (module_->origin != kAsmJsOrigin) {
1106 Value val = Pop(0, kAstI32); 1112 Value val = Pop(0, kAstI32);
1107 Push(kAstI32, BUILD(GrowMemory, val.node)); 1113 Push(kAstI32, BUILD(GrowMemory, val.node));
1108 } else { 1114 } else {
1109 error("grow_memory is not supported for asmjs modules"); 1115 error("grow_memory is not supported for asmjs modules");
1110 } 1116 }
1117 len = 1 + operand.length;
1111 break; 1118 break;
1112 case kExprMemorySize: 1119 }
1120 case kExprMemorySize: {
1121 MemoryIndexOperand operand(this, pc_);
1113 Push(kAstI32, BUILD(CurrentMemoryPages)); 1122 Push(kAstI32, BUILD(CurrentMemoryPages));
1123 len = 1 + operand.length;
1114 break; 1124 break;
1125 }
1115 case kExprCallFunction: { 1126 case kExprCallFunction: {
1116 CallFunctionOperand operand(this, pc_); 1127 CallFunctionOperand operand(this, pc_);
1117 if (Validate(pc_, operand)) { 1128 if (Validate(pc_, operand)) {
1118 TFNode** buffer = PopArgs(operand.sig); 1129 TFNode** buffer = PopArgs(operand.sig);
1119 TFNode** rets = nullptr; 1130 TFNode** rets = nullptr;
1120 BUILD(CallDirect, operand.index, buffer, &rets, position()); 1131 BUILD(CallDirect, operand.index, buffer, &rets, position());
1121 PushReturns(operand.sig, rets); 1132 PushReturns(operand.sig, rets);
1122 } 1133 }
1123 len = 1 + operand.length; 1134 len = 1 + operand.length;
1124 break; 1135 break;
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 2009 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
1999 const byte* start, const byte* end) { 2010 const byte* start, const byte* end) {
2000 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 2011 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
2001 WasmFullDecoder decoder(zone, nullptr, body); 2012 WasmFullDecoder decoder(zone, nullptr, body);
2002 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 2013 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
2003 } 2014 }
2004 2015
2005 } // namespace wasm 2016 } // namespace wasm
2006 } // namespace internal 2017 } // namespace internal
2007 } // namespace v8 2018 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/ast-decoder.h ('k') | src/wasm/wasm-interpreter.cc » ('j') | src/wasm/wasm-opcodes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698