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

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

Issue 1847543002: Expose a lower bound of malloc'd memory via heap statistics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 8 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/wasm/ast-decoder.h ('k') | src/wasm/module-decoder.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 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 while (arity_stack.back() == 0) { 1619 while (arity_stack.back() == 0) {
1620 arity_stack.pop_back(); 1620 arity_stack.pop_back();
1621 if (arity_stack.empty()) return assigned; // reached end of loop 1621 if (arity_stack.empty()) return assigned; // reached end of loop
1622 arity_stack.back()--; 1622 arity_stack.back()--;
1623 } 1623 }
1624 } 1624 }
1625 return assigned; 1625 return assigned;
1626 } 1626 }
1627 }; 1627 };
1628 1628
1629 std::vector<LocalType>* DecodeLocalDeclsForTesting(const byte* start, 1629 std::vector<LocalType>* DecodeLocalDeclsForTesting(
1630 const byte* end) { 1630 base::AccountingAllocator* allocator, const byte* start, const byte* end) {
1631 Zone zone; 1631 Zone zone(allocator);
1632 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 1632 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
1633 SR_WasmDecoder decoder(&zone, nullptr, body); 1633 SR_WasmDecoder decoder(&zone, nullptr, body);
1634 return decoder.DecodeLocalDeclsForTesting(); 1634 return decoder.DecodeLocalDeclsForTesting();
1635 } 1635 }
1636 1636
1637 TreeResult VerifyWasmCode(FunctionBody& body) { 1637 TreeResult VerifyWasmCode(base::AccountingAllocator* allocator,
1638 Zone zone; 1638 FunctionBody& body) {
1639 Zone zone(allocator);
1639 SR_WasmDecoder decoder(&zone, nullptr, body); 1640 SR_WasmDecoder decoder(&zone, nullptr, body);
1640 TreeResult result = decoder.Decode(); 1641 TreeResult result = decoder.Decode();
1641 return result; 1642 return result;
1642 } 1643 }
1643 1644
1644 TreeResult BuildTFGraph(TFBuilder* builder, FunctionBody& body) { 1645 TreeResult BuildTFGraph(base::AccountingAllocator* allocator,
1645 Zone zone; 1646 TFBuilder* builder, FunctionBody& body) {
1647 Zone zone(allocator);
1646 SR_WasmDecoder decoder(&zone, builder, body); 1648 SR_WasmDecoder decoder(&zone, builder, body);
1647 TreeResult result = decoder.Decode(); 1649 TreeResult result = decoder.Decode();
1648 return result; 1650 return result;
1649 } 1651 }
1650 1652
1651 1653
1652 std::ostream& operator<<(std::ostream& os, const Tree& tree) { 1654 std::ostream& operator<<(std::ostream& os, const Tree& tree) {
1653 if (tree.pc == nullptr) { 1655 if (tree.pc == nullptr) {
1654 os << "null"; 1656 os << "null";
1655 return os; 1657 return os;
(...skipping 23 matching lines...) Expand all
1679 WasmDecoder decoder(nullptr, nullptr, pc, end); 1681 WasmDecoder decoder(nullptr, nullptr, pc, end);
1680 return decoder.OpcodeLength(pc); 1682 return decoder.OpcodeLength(pc);
1681 } 1683 }
1682 1684
1683 int OpcodeArity(ModuleEnv* module, FunctionSig* sig, const byte* pc, 1685 int OpcodeArity(ModuleEnv* module, FunctionSig* sig, const byte* pc,
1684 const byte* end) { 1686 const byte* end) {
1685 WasmDecoder decoder(module, sig, pc, end); 1687 WasmDecoder decoder(module, sig, pc, end);
1686 return decoder.OpcodeArity(pc); 1688 return decoder.OpcodeArity(pc);
1687 } 1689 }
1688 1690
1689 void PrintAst(FunctionBody& body) { 1691 void PrintAst(base::AccountingAllocator* allocator, FunctionBody& body) {
1690 Zone zone; 1692 Zone zone(allocator);
1691 SR_WasmDecoder decoder(&zone, nullptr, body); 1693 SR_WasmDecoder decoder(&zone, nullptr, body);
1692 1694
1693 OFStream os(stdout); 1695 OFStream os(stdout);
1694 1696
1695 // Print the function signature. 1697 // Print the function signature.
1696 if (body.sig) { 1698 if (body.sig) {
1697 os << "// signature: " << *body.sig << std::endl; 1699 os << "// signature: " << *body.sig << std::endl;
1698 } 1700 }
1699 1701
1700 // Print the local declarations. 1702 // Print the local declarations.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 1785 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
1784 const byte* start, const byte* end) { 1786 const byte* start, const byte* end) {
1785 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 1787 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
1786 SR_WasmDecoder decoder(zone, nullptr, body); 1788 SR_WasmDecoder decoder(zone, nullptr, body);
1787 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 1789 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
1788 } 1790 }
1789 1791
1790 } // namespace wasm 1792 } // namespace wasm
1791 } // namespace internal 1793 } // namespace internal
1792 } // namespace v8 1794 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/ast-decoder.h ('k') | src/wasm/module-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698