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

Side by Side Diff: src/asmjs/asm-typer.cc

Issue 2351393003: [base] Revert "Move hashmap allocator to a field" (Closed)
Patch Set: Whoops, patch sets should build Created 4 years, 3 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 | « no previous file | src/asmjs/asm-wasm-builder.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/asmjs/asm-typer.h" 5 #include "src/asmjs/asm-typer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // We can't DCHECK(!in_function_) because function may actually install global 354 // We can't DCHECK(!in_function_) because function may actually install global
355 // names (forward defined functions and function tables.) 355 // names (forward defined functions and function tables.)
356 DCHECK(info->mutability() != VariableInfo::kInvalidMutability); 356 DCHECK(info->mutability() != VariableInfo::kInvalidMutability);
357 DCHECK(info->IsGlobal()); 357 DCHECK(info->IsGlobal());
358 DCHECK(ValidAsmIdentifier(variable->name())); 358 DCHECK(ValidAsmIdentifier(variable->name()));
359 359
360 if (!module_name_.is_null() && module_name_->Equals(*variable->name())) { 360 if (!module_name_.is_null() && module_name_->Equals(*variable->name())) {
361 return false; 361 return false;
362 } 362 }
363 363
364 ZoneHashMap::Entry* entry = 364 ZoneHashMap::Entry* entry = global_scope_.LookupOrInsert(
365 global_scope_.LookupOrInsert(variable, ComputePointerHash(variable)); 365 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_));
366 366
367 if (entry->value != nullptr) { 367 if (entry->value != nullptr) {
368 return false; 368 return false;
369 } 369 }
370 370
371 entry->value = info; 371 entry->value = info;
372 return true; 372 return true;
373 } 373 }
374 374
375 bool AsmTyper::AddLocal(Variable* variable, VariableInfo* info) { 375 bool AsmTyper::AddLocal(Variable* variable, VariableInfo* info) {
376 DCHECK(in_function_); 376 DCHECK(in_function_);
377 DCHECK(info->mutability() != VariableInfo::kInvalidMutability); 377 DCHECK(info->mutability() != VariableInfo::kInvalidMutability);
378 DCHECK(!info->IsGlobal()); 378 DCHECK(!info->IsGlobal());
379 DCHECK(ValidAsmIdentifier(variable->name())); 379 DCHECK(ValidAsmIdentifier(variable->name()));
380 380
381 ZoneHashMap::Entry* entry = 381 ZoneHashMap::Entry* entry = local_scope_.LookupOrInsert(
382 local_scope_.LookupOrInsert(variable, ComputePointerHash(variable)); 382 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_));
383 383
384 if (entry->value != nullptr) { 384 if (entry->value != nullptr) {
385 return false; 385 return false;
386 } 386 }
387 387
388 entry->value = info; 388 entry->value = info;
389 return true; 389 return true;
390 } 390 }
391 391
392 void AsmTyper::SetTypeOf(AstNode* node, AsmType* type) { 392 void AsmTyper::SetTypeOf(AstNode* node, AsmType* type) {
(...skipping 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 return true; 2765 return true;
2766 } 2766 }
2767 2767
2768 *error_message = typer.error_message(); 2768 *error_message = typer.error_message();
2769 return false; 2769 return false;
2770 } 2770 }
2771 2771
2772 } // namespace wasm 2772 } // namespace wasm
2773 } // namespace internal 2773 } // namespace internal
2774 } // namespace v8 2774 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/asmjs/asm-wasm-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698