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