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

Side by Side Diff: src/asmjs/asm-wasm-builder.cc

Issue 2369963002: [base] Remove PointersMatch, making a separate std::equals hashmap (Closed)
Patch Set: Fix the other simulators 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
« no previous file with comments | « src/asmjs/asm-typer.cc ('k') | src/ast/ast.h » ('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/v8.h" 5 #include "src/v8.h"
6 6
7 // Required to get M_E etc. in MSVC. 7 // Required to get M_E etc. in MSVC.
8 #if defined(_WIN32) 8 #if defined(_WIN32)
9 #define _USE_MATH_DEFINES 9 #define _USE_MATH_DEFINES
10 #endif 10 #endif
(...skipping 26 matching lines...) Expand all
37 struct ForeignVariable { 37 struct ForeignVariable {
38 Handle<Name> name; 38 Handle<Name> name;
39 Variable* var; 39 Variable* var;
40 LocalType type; 40 LocalType type;
41 }; 41 };
42 42
43 class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> { 43 class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> {
44 public: 44 public:
45 AsmWasmBuilderImpl(Isolate* isolate, Zone* zone, FunctionLiteral* literal, 45 AsmWasmBuilderImpl(Isolate* isolate, Zone* zone, FunctionLiteral* literal,
46 AsmTyper* typer) 46 AsmTyper* typer)
47 : local_variables_(base::HashMap::PointersMatch, 47 : local_variables_(ZoneHashMap::kDefaultHashMapCapacity,
48 ZoneHashMap::kDefaultHashMapCapacity,
49 ZoneAllocationPolicy(zone)), 48 ZoneAllocationPolicy(zone)),
50 functions_(base::HashMap::PointersMatch, 49 functions_(ZoneHashMap::kDefaultHashMapCapacity,
51 ZoneHashMap::kDefaultHashMapCapacity,
52 ZoneAllocationPolicy(zone)), 50 ZoneAllocationPolicy(zone)),
53 global_variables_(base::HashMap::PointersMatch, 51 global_variables_(ZoneHashMap::kDefaultHashMapCapacity,
54 ZoneHashMap::kDefaultHashMapCapacity,
55 ZoneAllocationPolicy(zone)), 52 ZoneAllocationPolicy(zone)),
56 scope_(kModuleScope), 53 scope_(kModuleScope),
57 builder_(new (zone) WasmModuleBuilder(zone)), 54 builder_(new (zone) WasmModuleBuilder(zone)),
58 current_function_builder_(nullptr), 55 current_function_builder_(nullptr),
59 literal_(literal), 56 literal_(literal),
60 isolate_(isolate), 57 isolate_(isolate),
61 zone_(zone), 58 zone_(zone),
62 typer_(typer), 59 typer_(typer),
63 breakable_blocks_(zone), 60 breakable_blocks_(zone),
64 foreign_variables_(zone), 61 foreign_variables_(zone),
65 init_function_(nullptr), 62 init_function_(nullptr),
66 foreign_init_function_(nullptr), 63 foreign_init_function_(nullptr),
67 next_table_index_(0), 64 next_table_index_(0),
68 function_tables_(base::HashMap::PointersMatch, 65 function_tables_(ZoneHashMap::kDefaultHashMapCapacity,
69 ZoneHashMap::kDefaultHashMapCapacity,
70 ZoneAllocationPolicy(zone)), 66 ZoneAllocationPolicy(zone)),
71 imported_function_table_(this) { 67 imported_function_table_(this) {
72 InitializeAstVisitor(isolate); 68 InitializeAstVisitor(isolate);
73 } 69 }
74 70
75 void InitializeInitFunction() { 71 void InitializeInitFunction() {
76 FunctionSig::Builder b(zone(), 0, 0); 72 FunctionSig::Builder b(zone(), 0, 0);
77 init_function_ = builder_->AddFunction(b.Build()); 73 init_function_ = builder_->AddFunction(b.Build());
78 builder_->MarkStartFunction(init_function_); 74 builder_->MarkStartFunction(init_function_);
79 } 75 }
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 WasmModuleBuilder::SignatureMap signature_to_index_; 737 WasmModuleBuilder::SignatureMap signature_to_index_;
742 738
743 explicit ImportedFunctionIndices(Zone* zone) 739 explicit ImportedFunctionIndices(Zone* zone)
744 : has_name_(false), signature_to_index_(zone) {} 740 : has_name_(false), signature_to_index_(zone) {}
745 }; 741 };
746 ZoneHashMap table_; 742 ZoneHashMap table_;
747 AsmWasmBuilderImpl* builder_; 743 AsmWasmBuilderImpl* builder_;
748 744
749 public: 745 public:
750 explicit ImportedFunctionTable(AsmWasmBuilderImpl* builder) 746 explicit ImportedFunctionTable(AsmWasmBuilderImpl* builder)
751 : table_(base::HashMap::PointersMatch, 747 : table_(ZoneHashMap::kDefaultHashMapCapacity,
752 ZoneHashMap::kDefaultHashMapCapacity,
753 ZoneAllocationPolicy(builder->zone())), 748 ZoneAllocationPolicy(builder->zone())),
754 builder_(builder) {} 749 builder_(builder) {}
755 750
756 // Set the imported name of a variable. Must happen after all signatures 751 // Set the imported name of a variable. Must happen after all signatures
757 // (and thus import indices) are added for a given variable. 752 // (and thus import indices) are added for a given variable.
758 void SetImportName(Variable* v, const char* name, int name_length) { 753 void SetImportName(Variable* v, const char* name, int name_length) {
759 auto indices = GetEntry(v); 754 auto indices = GetEntry(v);
760 if (indices) { 755 if (indices) {
761 for (auto entry : indices->signature_to_index_) { 756 for (auto entry : indices->signature_to_index_) {
762 uint32_t index = entry.second; 757 uint32_t index = entry.second;
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 impl.builder_->WriteTo(*buffer); 1914 impl.builder_->WriteTo(*buffer);
1920 return buffer; 1915 return buffer;
1921 } 1916 }
1922 1917
1923 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__"; 1918 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__";
1924 const char* AsmWasmBuilder::single_function_name = "__single_function__"; 1919 const char* AsmWasmBuilder::single_function_name = "__single_function__";
1925 1920
1926 } // namespace wasm 1921 } // namespace wasm
1927 } // namespace internal 1922 } // namespace internal
1928 } // namespace v8 1923 } // namespace v8
OLDNEW
« no previous file with comments | « src/asmjs/asm-typer.cc ('k') | src/ast/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698