OLD | NEW |
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 Loading... |
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 = global_scope_.LookupOrInsert( | 364 ZoneHashMap::Entry* entry = |
365 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); | 365 global_scope_.LookupOrInsert(variable, ComputePointerHash(variable)); |
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 = local_scope_.LookupOrInsert( | 381 ZoneHashMap::Entry* entry = |
382 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); | 382 local_scope_.LookupOrInsert(variable, ComputePointerHash(variable)); |
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 Loading... |
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 |
OLD | NEW |