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-containers.h" | 10 #include "src/zone-containers.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 } | 394 } |
395 } | 395 } |
396 | 396 |
397 unsigned OpcodeLength(const byte* pc) { | 397 unsigned OpcodeLength(const byte* pc) { |
398 switch (static_cast<WasmOpcode>(*pc)) { | 398 switch (static_cast<WasmOpcode>(*pc)) { |
399 #define DECLARE_OPCODE_CASE(name, opcode, sig) case kExpr##name: | 399 #define DECLARE_OPCODE_CASE(name, opcode, sig) case kExpr##name: |
400 FOREACH_LOAD_MEM_OPCODE(DECLARE_OPCODE_CASE) | 400 FOREACH_LOAD_MEM_OPCODE(DECLARE_OPCODE_CASE) |
401 FOREACH_STORE_MEM_OPCODE(DECLARE_OPCODE_CASE) | 401 FOREACH_STORE_MEM_OPCODE(DECLARE_OPCODE_CASE) |
402 #undef DECLARE_OPCODE_CASE | 402 #undef DECLARE_OPCODE_CASE |
403 { | 403 { |
404 MemoryAccessOperand operand(this, pc); | 404 MemoryAccessOperand operand(this, pc, MachineType::None()); |
405 return 1 + operand.length; | 405 return 1 + operand.length; |
406 } | 406 } |
407 case kExprBr: | 407 case kExprBr: |
408 case kExprBrIf: { | 408 case kExprBrIf: { |
409 BreakDepthOperand operand(this, pc); | 409 BreakDepthOperand operand(this, pc); |
410 return 1 + operand.length; | 410 return 1 + operand.length; |
411 } | 411 } |
412 case kExprSetGlobal: | 412 case kExprSetGlobal: |
413 case kExprGetGlobal: { | 413 case kExprGetGlobal: { |
414 GlobalIndexOperand operand(this, pc); | 414 GlobalIndexOperand operand(this, pc); |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 } | 1366 } |
1367 | 1367 |
1368 void PopControl() { | 1368 void PopControl() { |
1369 const Control& c = control_.back(); | 1369 const Control& c = control_.back(); |
1370 most_recent_finally_ = c.prev_finally; | 1370 most_recent_finally_ = c.prev_finally; |
1371 control_.pop_back(); | 1371 control_.pop_back(); |
1372 // No more accesses to (danging pointer) c | 1372 // No more accesses to (danging pointer) c |
1373 } | 1373 } |
1374 | 1374 |
1375 int DecodeLoadMem(LocalType type, MachineType mem_type) { | 1375 int DecodeLoadMem(LocalType type, MachineType mem_type) { |
1376 MemoryAccessOperand operand(this, pc_); | 1376 MemoryAccessOperand operand(this, pc_, mem_type); |
| 1377 |
1377 Value index = Pop(0, kAstI32); | 1378 Value index = Pop(0, kAstI32); |
1378 TFNode* node = BUILD(LoadMem, type, mem_type, index.node, operand.offset, | 1379 TFNode* node = BUILD(LoadMem, type, mem_type, index.node, operand.offset, |
1379 operand.alignment, position()); | 1380 operand.alignment, position()); |
1380 Push(type, node); | 1381 Push(type, node); |
1381 return 1 + operand.length; | 1382 return 1 + operand.length; |
1382 } | 1383 } |
1383 | 1384 |
1384 int DecodeStoreMem(LocalType type, MachineType mem_type) { | 1385 int DecodeStoreMem(LocalType type, MachineType mem_type) { |
1385 MemoryAccessOperand operand(this, pc_); | 1386 MemoryAccessOperand operand(this, pc_, mem_type); |
1386 Value val = Pop(1, type); | 1387 Value val = Pop(1, type); |
1387 Value index = Pop(0, kAstI32); | 1388 Value index = Pop(0, kAstI32); |
1388 BUILD(StoreMem, mem_type, index.node, operand.offset, operand.alignment, | 1389 BUILD(StoreMem, mem_type, index.node, operand.offset, operand.alignment, |
1389 val.node, position()); | 1390 val.node, position()); |
1390 Push(type, val.node); | 1391 Push(type, val.node); |
1391 return 1 + operand.length; | 1392 return 1 + operand.length; |
1392 } | 1393 } |
1393 | 1394 |
1394 void DecodeSimdOpcode(WasmOpcode opcode) { | 1395 void DecodeSimdOpcode(WasmOpcode opcode) { |
1395 FunctionSig* sig = WasmOpcodes::Signature(opcode); | 1396 FunctionSig* sig = WasmOpcodes::Signature(opcode); |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2059 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 2060 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
2060 const byte* start, const byte* end) { | 2061 const byte* start, const byte* end) { |
2061 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 2062 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
2062 WasmFullDecoder decoder(zone, nullptr, body); | 2063 WasmFullDecoder decoder(zone, nullptr, body); |
2063 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 2064 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
2064 } | 2065 } |
2065 | 2066 |
2066 } // namespace wasm | 2067 } // namespace wasm |
2067 } // namespace internal | 2068 } // namespace internal |
2068 } // namespace v8 | 2069 } // namespace v8 |
OLD | NEW |