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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 p->tree->node, expr->node); | 1309 p->tree->node, expr->node); |
1310 } | 1310 } |
1311 } | 1311 } |
1312 } | 1312 } |
1313 | 1313 |
1314 void ReduceLoadMem(Production* p, LocalType type, MachineType mem_type) { | 1314 void ReduceLoadMem(Production* p, LocalType type, MachineType mem_type) { |
1315 DCHECK_EQ(1, p->index); | 1315 DCHECK_EQ(1, p->index); |
1316 TypeCheckLast(p, kAstI32); // index | 1316 TypeCheckLast(p, kAstI32); // index |
1317 if (build()) { | 1317 if (build()) { |
1318 MemoryAccessOperand operand(this, p->pc()); | 1318 MemoryAccessOperand operand(this, p->pc()); |
1319 p->tree->node = | 1319 p->tree->node = builder_->LoadMem(type, mem_type, p->last()->node, |
1320 builder_->LoadMem(type, mem_type, p->last()->node, operand.offset); | 1320 operand.offset, operand.alignment); |
1321 } | 1321 } |
1322 } | 1322 } |
1323 | 1323 |
1324 void ReduceStoreMem(Production* p, LocalType type, MachineType mem_type) { | 1324 void ReduceStoreMem(Production* p, LocalType type, MachineType mem_type) { |
1325 if (p->index == 1) { | 1325 if (p->index == 1) { |
1326 TypeCheckLast(p, kAstI32); // index | 1326 TypeCheckLast(p, kAstI32); // index |
1327 } else { | 1327 } else { |
1328 DCHECK_EQ(2, p->index); | 1328 DCHECK_EQ(2, p->index); |
1329 TypeCheckLast(p, type); | 1329 TypeCheckLast(p, type); |
1330 if (build()) { | 1330 if (build()) { |
1331 MemoryAccessOperand operand(this, p->pc()); | 1331 MemoryAccessOperand operand(this, p->pc()); |
1332 TFNode* val = p->tree->children[1]->node; | 1332 TFNode* val = p->tree->children[1]->node; |
1333 builder_->StoreMem(mem_type, p->tree->children[0]->node, operand.offset, | 1333 builder_->StoreMem(mem_type, p->tree->children[0]->node, operand.offset, |
1334 val); | 1334 operand.alignment, val); |
1335 p->tree->node = val; | 1335 p->tree->node = val; |
1336 } | 1336 } |
1337 } | 1337 } |
1338 } | 1338 } |
1339 | 1339 |
1340 void TypeCheckLast(Production* p, LocalType expected) { | 1340 void TypeCheckLast(Production* p, LocalType expected) { |
1341 LocalType result = p->last()->type; | 1341 LocalType result = p->last()->type; |
1342 if (result == expected) return; | 1342 if (result == expected) return; |
1343 if (result == kAstEnd) return; | 1343 if (result == kAstEnd) return; |
1344 if (expected != kAstStmt) { | 1344 if (expected != kAstStmt) { |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 1783 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
1784 const byte* start, const byte* end) { | 1784 const byte* start, const byte* end) { |
1785 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 1785 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
1786 SR_WasmDecoder decoder(zone, nullptr, body); | 1786 SR_WasmDecoder decoder(zone, nullptr, body); |
1787 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 1787 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
1788 } | 1788 } |
1789 | 1789 |
1790 } // namespace wasm | 1790 } // namespace wasm |
1791 } // namespace internal | 1791 } // namespace internal |
1792 } // namespace v8 | 1792 } // namespace v8 |
OLD | NEW |